Java Code Examples for com.sun.org.apache.xpath.internal.objects.XNodeSet#mutableNodeset()
The following examples show how to use
com.sun.org.apache.xpath.internal.objects.XNodeSet#mutableNodeset() .
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: FuncHere.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 2
Source File: FuncHere.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 3
Source File: FuncHere.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 4
Source File: FuncHere.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 5
Source File: FuncHere.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 6
Source File: FuncHere.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 7
Source File: FuncHere.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 8
Source File: FuncHere.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 9
Source File: FuncHere.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public XObject execute(XPathContext xctxt) throws TransformerException { Node xpathOwnerNode = (Node)xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (docContext == DTM.NULL) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } // check whether currentNode and the node containing the XPath // expression are in the same document Document currentDoc = getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException("Owner documents differ"); } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE: case Node.PROCESSING_INSTRUCTION_NODE: { // returns a node-set containing the attribute / processing // instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 10
Source File: FuncHere.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 11
Source File: FuncHere.java From Bytecoder with Apache License 2.0 | 4 votes |
@Override public XObject execute(XPathContext xctxt) throws TransformerException { Node xpathOwnerNode = (Node)xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (docContext == DTM.NULL) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } // check whether currentNode and the node containing the XPath // expression are in the same document Document currentDoc = getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException("Owner documents differ"); } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE: case Node.PROCESSING_INSTRUCTION_NODE: { // returns a node-set containing the attribute / processing // instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 12
Source File: FuncHere.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 13
Source File: FuncHere.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 14
Source File: FuncHere.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 15
Source File: FuncHere.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 16
Source File: FuncHere.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }
Example 17
Source File: FuncHere.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * The here function returns a node-set containing the attribute or * processing instruction node or the parent element of the text node * that directly bears the XPath expression. This expression results * in an error if the containing XPath expression does not appear in the * same XML document against which the XPath expression is being evaluated. * * @param xctxt * @return the xobject * @throws javax.xml.transform.TransformerException */ @Override public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); if (xpathOwnerNode == null) { return null; } int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) { error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); } { // check whether currentNode and the node containing the XPath expression // are in the same document Document currentDoc = XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); if (currentDoc != xpathOwnerDoc) { throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer")); } } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); { int hereNode = DTM.NULL; switch (dtm.getNodeType(xpathOwnerNodeDTM)) { case Node.ATTRIBUTE_NODE : case Node.PROCESSING_INSTRUCTION_NODE : { // returns a node-set containing the attribute / processing instruction node hereNode = xpathOwnerNodeDTM; nodeSet.addNode(hereNode); break; } case Node.TEXT_NODE : { // returns a node-set containing the parent element of the // text node that directly bears the XPath expression hereNode = dtm.getParent(xpathOwnerNodeDTM); nodeSet.addNode(hereNode); break; } default : break; } } /** $todo$ Do I have to do this detach() call? */ nodeSet.detach(); return nodes; }