<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="extensibility" page="converting-args" subpage="converting-node"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Converting Nodes</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: Converting Nodes"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Converting Nodes</h1>
      <p>If the expected type is a generic collection type, or an array of the Saxon class <a class="bodylink" href="../../javadoc/net/sf/saxon/om/NodeInfo.html"><code>NodeInfo</code></a>, or a
<a class="bodylink" href="../../javadoc/net/sf/saxon/om/Value.html"><code>Value</code></a> or <a class="bodylink" href="../../javadoc/net/sf/saxon/om/SequenceIterator.html"><code>SequenceIterator</code></a>, Saxon will pass the nodes supplied in the call in their native
Saxon representation, that is, as instances of <code>net.sf.saxon.om.NodeInfo</code>.</p>
      <p>Saxon recognizes methods that expect nodes in an external object model (DOM, DOM4J, JDOM, or XOM) only if the supporting
JAR file is on the classpath (that is, saxon9-dom.jar, saxon9-dom4j.jar, saxon9-jdom.jar, or saxon9-xom.jar). 
In all four cases, if the XPath node is
actually a view of a DOM, DOM4J, JDOM, or XOM node, then the underlying node will be passed to the method. If the XPath node is
a text node that maps to a sequence of adjacent text and/or CDATA nodes in the underlying model, the first node in this sequence
will be passed to the extension function.</p>
      <p>In addition, in the case of DOM only (but only if saxon9-dom.jar is on the classpath), if the XPath node
is <b>not</b> a view of a DOM node, Saxon will create a DOM wrapper for the native Saxon node, and pass this wrapper.
This is also done if the required type is a DOM NodeList. Note that the wrapper is a read-only
DOM implementation: any attempt to update nodes through the wrapper interface will throw an exception. 
A consequence of the way the
wrapping works is that it's not safe to rely on object identity when testing node identity - the same node can be represented by 
more than one Java object. Use the DOM method <code>isSameNode()</code> instead.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="converting-wrapped-java.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>