Example usage for org.dom4j.dtd ExternalEntityDecl getSystemID

List of usage examples for org.dom4j.dtd ExternalEntityDecl getSystemID

Introduction

In this page you can find the example usage for org.dom4j.dtd ExternalEntityDecl getSystemID.

Prototype

public String getSystemID() 

Source Link

Document

Getter for property systemID.

Usage

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

License:Open Source License

private void write(Writer writer, ExternalEntityDecl decl) throws IOException {
    String name = decl.getName();
    String publicID = decl.getPublicID();
    String systemID = decl.getSystemID();

    if (name.startsWith("%")) {
        name = "% " + name.substring(1);
    }/*from  www  . j  a  va 2  s. c  o  m*/

    StringBuffer buffer = new StringBuffer("<!ENTITY ");
    buffer.append(name);
    if (publicID != null) {
        buffer.append(" PUBLIC \"");
        buffer.append(publicID);
        buffer.append("\" ");

        if (systemID != null) {
            buffer.append(" \"");
            buffer.append(systemID);
            buffer.append("\" ");
        }
    } else if (systemID != null) {
        buffer.append(" SYSTEM \"");
        buffer.append(systemID);
        buffer.append("\" ");
    }
    buffer.append(">");
    writer.write(buffer.toString());
}