
com.github.fartherp.javaxml.Attribute Maven / Gradle / Ivy
/*
* Copyright (c) 2017. CK. All rights reserved.
*/
package com.github.fartherp.javaxml;
/**
* the XML of attribute. the format is name
="value
"
* Element attribute = new Attribute("id", "getList");
* attribute.getFormattedContent(1);
* the result is id="getList"
* Author: CK.
* Date: 2015/6/5.
*/
public class Attribute implements Element {
private String name;
private String value;
public Attribute(String name, String value) {
this.name = name;
this.value = value;
}
public String getFormattedContent(int indentLevel) {
StringBuilder sb = new StringBuilder();
sb.append(name);
sb.append("=\"");
sb.append(value);
sb.append('\"');
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy