Java Code Examples for com.sun.org.apache.xml.internal.serializer.SerializationHandler#comment()
The following examples show how to use
com.sun.org.apache.xml.internal.serializer.SerializationHandler#comment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SAXImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 2
Source File: SAXImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 3
Source File: SAXImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 4
Source File: SAXImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 5
Source File: SAXImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 6
Source File: SAXImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 7
Source File: SAXImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 8
Source File: SAXImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 9
Source File: SAXImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 10
Source File: SAXImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 11
Source File: SAXImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 12
Source File: SAXImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 13
Source File: SAXImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 14
Source File: SAXImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 15
Source File: SAXImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 16
Source File: SAXImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 17
Source File: SAXImpl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 18
Source File: SAXImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }
Example 19
Source File: SAXImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } }
Example 20
Source File: SAXImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } }