Example usage for org.dom4j.dtd AttributeDecl getAttributeName

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

Introduction

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

Prototype

public String getAttributeName() 

Source Link

Document

Getter for property attributeName.

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 . j  a  v 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());
}