Example usage for org.dom4j.dtd AttributeDecl getValueDefault

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

Introduction

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

Prototype

public String getValueDefault() 

Source Link

Document

Getter for property valueDefault.

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  w ww  .jav  a2  s.c o  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());
}