String ecmaToXMLString(XmlProcessor processor) { if (this.isElementType()) { Element copy = (Element) this.dom.cloneNode(true); Namespace[] inScope = this.getInScopeNamespaces(); for (int i = 0; i < inScope.length; i++) { declareNamespace(copy, inScope[i].getPrefix(), inScope[i].getUri()); } return processor.ecmaToXmlString(copy); } else { return processor.ecmaToXmlString(dom); } }
String debug() { XmlProcessor raw = new XmlProcessor(); raw.setIgnoreComments(false); raw.setIgnoreProcessingInstructions(false); raw.setIgnoreWhitespace(false); raw.setPrettyPrinting(false); return raw.ecmaToXmlString(this.dom); }
static XmlNode newElementWithText( XmlProcessor processor, XmlNode reference, XmlNode.QName qname, String value) { if (reference instanceof org.w3c.dom.Document) throw new IllegalArgumentException("Cannot use Document node as reference"); Document document = null; if (reference != null) { document = reference.dom.getOwnerDocument(); } else { document = processor.newDocument(); } Node referenceDom = (reference != null) ? reference.dom : null; Element e = document.createElementNS(qname.getUri(), qname.qualify(referenceDom)); if (value != null) { e.appendChild(document.createTextNode(value)); } return XmlNode.createImpl(e); }
@Override public String escapeAttributeValue(Object o) { return options.escapeAttributeValue(o); }
@Override public String escapeTextValue(Object o) { return options.escapeTextValue(o); }
static XmlNode createText(XmlProcessor processor, String value) { return createImpl(processor.newDocument().createTextNode(value)); }
String toXmlString(XmlProcessor processor) { return processor.ecmaToXmlString(this.dom); }
static XmlNode createElement(XmlProcessor processor, String namespaceUri, String xml) throws org.xml.sax.SAXException { return createImpl(processor.toXml(namespaceUri, xml)); }