List of usage examples for org.dom4j.dtd InternalEntityDecl getValue
public String getValue()
From source file:com.cladonia.xml.ExchangerXMLWriter.java
License:Open Source License
protected void writeDocType(DocumentType docType) throws IOException { if (DEBUG)/*from w ww.j ava2 s . com*/ System.out.println("ExchangerXMLWriter.writeDocType( " + docType + ")"); if (docType != null) { List list = docType.getInternalDeclarations(); if (list != null) { for (int i = 0; i < list.size(); i++) { Object internalDecl = list.get(i); if (internalDecl instanceof InternalEntityDecl) { InternalEntityDecl decl = (InternalEntityDecl) internalDecl; // System.out.println( "<!ENTITY "+decl.getName()+" \""+decl.getValue()+"\">"); String value = decl.getValue(); StringBuffer result = new StringBuffer("&"); int index = value.indexOf("&"); if (index != -1 && value.length() > 5) { if (index > 0) { result.append(value.substring(0, index + 1)); } result.append(value.substring(index + 5, value.length())); decl.setValue(result.toString()); } } else if (internalDecl instanceof ExternalEntityDecl) { ExternalEntityDecl decl = (ExternalEntityDecl) internalDecl; // System.out.println( "<!ENTITY "+decl.getName()+" \""+decl.getPublicID()+"\" \""+decl.getSystemID()+"\">"); // System.out.println( internalDecl.getClass()); // System.out.println( internalDecl.toString()); } } } docType.write(writer); writer.write(format.getLineSeparator()); writer.write(format.getLineSeparator()); } }
From source file:com.cladonia.xml.XDocumentType.java
License:Open Source License
private void write(Writer writer, InternalEntityDecl decl) throws IOException { String name = decl.getName(); String value = decl.getValue(); if (name.startsWith("%")) { name = "% " + name.substring(1); }//from w ww.j a v a2 s. c om StringBuffer buffer = new StringBuffer("<!ENTITY "); buffer.append(name); buffer.append(" \""); buffer.append(value); buffer.append("\">"); writer.write(buffer.toString()); }
From source file:com.cladonia.xml.XMLFormatter.java
License:Mozilla Public License
protected void writeDocType(DocumentType docType) throws IOException { if (DEBUG)/*w ww. j a v a 2 s.c o m*/ System.out.println("XMLFormatter.writeDocType( " + docType + ")"); if (docType != null) { List list = docType.getInternalDeclarations(); if (list != null) { for (int i = 0; i < list.size(); i++) { Object internalDecl = list.get(i); if (internalDecl instanceof InternalEntityDecl) { InternalEntityDecl decl = (InternalEntityDecl) internalDecl; String value = decl.getValue(); StringBuffer result = new StringBuffer("&"); int index = value.indexOf("&"); if (index != -1 && value.length() > 5) { if (index > 0) { result.append(value.substring(0, index + 1)); } result.append(value.substring(index + 5, value.length())); decl.setValue(result.toString()); } } } } docType.write(writer); writer.write(format.getLineSeparator()); writer.write(format.getLineSeparator()); } }