/** * Serializes the Level 3 DOM node by creating an instance of DOM3TreeWalker * which traverses the DOM tree and invokes handler events to serialize * the DOM NOde. Throws an exception only if an I/O exception occured * while serializing. * This interface is a public API. * * @param node the Level 3 DOM node to serialize * @throws IOException if an I/O exception occured while serializing */ public void serializeDOM3(Node node) throws IOException { try { DOM3TreeWalker walker = new DOM3TreeWalker(fSerializationHandler, fErrorHandler, fSerializerFilter, fNewLine); walker.traverse(node); } catch (org.xml.sax.SAXException se) { throw new WrappedRuntimeException(se); } }
isElementWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; fLocalNSBinder.reset(); recordLocalNSDecl(node); fixupElementNS(node); node.getNodeName()); serializeAttList(node); if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return;
/** * Serializes a Comment Node. * * @param node The Comment Node to serialize */ protected void serializeComment(Comment node) throws SAXException { // comments=true if ((fFeatures & COMMENTS) != 0) { String data = node.getData(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCommentWellFormed(data); } if (fLexicalHandler != null) { // apply the LSSerializer filter after the operations requested by the // DOMConfiguration parameters have been applied if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) { return; } fLexicalHandler.comment(data.toCharArray(), 0, data.length()); } } }
javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); fSerializer.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, isTextWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_TEXT)) { return; dispatachChars(node);
isCDATASectionWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; fLexicalHandler.startCDATA(); dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); dispatachChars(node);
/** * Constructor. * @param contentHandler serialHandler The implemention of the SerializationHandler interface */ DOM3TreeWalker( SerializationHandler serialHandler, DOMErrorHandler errHandler, LSSerializerFilter filter, String newLine) { fSerializer = serialHandler; //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default? fErrorHandler = errHandler; fFilter = filter; fLexicalHandler = null; fNewLine = newLine; fNSBinder = new NamespaceSupport(); fLocalNSBinder = new NamespaceSupport(); fDOMConfigProperties = fSerializer.getOutputFormat(); fSerializer.setDocumentLocator(fLocator); initProperties(fDOMConfigProperties); try { // Bug see Bugzilla 26741 fLocator.setSystemId( System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) { // user.dir not accessible from applet } }
/** * Serializes an ProcessingInstruction Node. * * @param node The ProcessingInstruction Node to serialize */ protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
isCDATASectionWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; fLexicalHandler.startCDATA(); dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); dispatachChars(node);
javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); fSerializer.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, isTextWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_TEXT)) { return; dispatachChars(node);
/** * Serializes a Comment Node. * * @param node The Comment Node to serialize */ protected void serializeComment(Comment node) throws SAXException { // comments=true if ((fFeatures & COMMENTS) != 0) { String data = node.getData(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCommentWellFormed(data); } if (fLexicalHandler != null) { // apply the LSSerializer filter after the operations requested by the // DOMConfiguration parameters have been applied if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) { return; } fLexicalHandler.comment(data.toCharArray(), 0, data.length()); } } }
/** * Constructor. * @param contentHandler serialHandler The implemention of the SerializationHandler interface */ DOM3TreeWalker( SerializationHandler serialHandler, DOMErrorHandler errHandler, LSSerializerFilter filter, String newLine) { fSerializer = serialHandler; //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default? fErrorHandler = errHandler; fFilter = filter; fLexicalHandler = null; fNewLine = newLine; fNSBinder = new NamespaceSupport(); fLocalNSBinder = new NamespaceSupport(); fDOMConfigProperties = fSerializer.getOutputFormat(); fSerializer.setDocumentLocator(fLocator); initProperties(fDOMConfigProperties); try { // Bug see Bugzilla 26741 fLocator.setSystemId( System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) { // user.dir not accessible from applet } }
/** * Serializes an ProcessingInstruction Node. * * @param node The ProcessingInstruction Node to serialize */ protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
isElementWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; fLocalNSBinder.reset(); recordLocalNSDecl(node); fixupElementNS(node); node.getNodeName()); serializeAttList(node); if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return;
isCDATASectionWellFormed(node); if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; fLexicalHandler.startCDATA(); dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); dispatachChars(node);