List of usage examples for org.dom4j.dtd InternalEntityDecl setValue
public void setValue(String value)
From source file:com.cladonia.xml.ExchangerXMLWriter.java
License:Open Source License
protected void writeDocType(DocumentType docType) throws IOException { if (DEBUG)// ww w. j a va 2 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.XMLFormatter.java
License:Mozilla Public License
protected void writeDocType(DocumentType docType) throws IOException { if (DEBUG)//from w w w . j a va2 s . co 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()); } }