Example usage for org.dom4j.dtd AttributeDecl getType

List of usage examples for org.dom4j.dtd AttributeDecl getType

Introduction

In this page you can find the example usage for org.dom4j.dtd AttributeDecl getType.

Prototype

public String getType() 

Source Link

Document

Getter for property type.

Usage

From source file:com.cladonia.xml.XDocumentType.java

License:Open Source License

private void write(Writer writer, AttributeDecl decl) throws IOException {
    String elementName = decl.getElementName();
    String attributeName = decl.getAttributeName();
    String type = decl.getType();
    String valueDefault = decl.getValueDefault();
    String value = decl.getValue();

    StringBuffer buffer = new StringBuffer("<!ATTLIST ");
    buffer.append(elementName);/*from   ww w .j av  a2  s  . co m*/
    buffer.append(" ");
    buffer.append(attributeName);
    buffer.append(" ");
    buffer.append(type);
    buffer.append(" ");
    if (valueDefault != null) {
        buffer.append(valueDefault);
        if (valueDefault.equals("#FIXED")) {
            buffer.append(" \"");
            buffer.append(value);
            buffer.append("\"");
        }
    } else {
        buffer.append("\"");
        buffer.append(value);
        buffer.append("\"");
    }
    buffer.append(">");

    writer.write(buffer.toString());
}