⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jaxp.xtp

📁 RESIN 3.2 最新源码
💻 XTP
字号:
<document><header><product>resin</product><title>JAXP - specifying XML and XSLT implementations</title><description><p>JAXP is a standard interface which supports pluggable XML and XSLimplementations.  JAXP selects the parser based onsystem properties.  You can set the properties to selecta different parser than the default one.</p><p>By default, Resin will use the JDK's parsers.  Other parsers, includingResin's own parsers can be selected with the &lt;system-property> tag.</p></description></header><body><summary/><s1 name="resin" title="The Resin parsers and transformers"><deftable title="Resin XML DOM parsers"><tr>  <th>JAXP property</th>  <th>Resin class</th></tr><tr>  <td>javax.xml.parsers.DocumentBuilderFactory</td>  <td>com.caucho.xml.parsers.XmlDocumentBuilderFactory</td></tr><tr>  <td>javax.xml.parsers.DocumentBuilderFactory</td>  <td>com.caucho.xml.parsers.HtmlDocumentBuilderFactory</td></tr><tr>  <td>javax.xml.parsers.DocumentBuilderFactory</td>  <td>com.caucho.xml.parsers.LooseXmlDocumentBuilderFactory</td></tr><tr>  <td>javax.xml.parsers.DocumentBuilderFactory</td>  <td>com.caucho.xml.parsers.LooseHtmlDocumentBuilderFactory</td></tr></deftable><deftable title="Resin XML SAX parsers"><tr>  <td>javax.xml.parsers.SAXParserFactory</td>  <td>com.caucho.xml.parsers.XmlSAXParserFactory</td></tr><tr>  <td>javax.xml.parsers.SAXParserFactory</td>  <td>com.caucho.xml.parsers.HtmlSAXParserFactory</td></tr><tr>  <td>javax.xml.parsers.SAXParserFactory</td>  <td>com.caucho.xml.parsers.LooseXmlSAXParserFactory</td></tr><tr>  <td>javax.xml.parsers.SAXParserFactory</td>  <td>com.caucho.xml.parsers.LooseHtmlSAXParserFactory</td></tr></deftable><deftable title="Resin XSLT transformer"><tr><th>JAXP property</th><th>Resin class</th></tr><tr><td>javax.xml.transform.TransformerFactory    </td><td>com.caucho.xsl.Xsl</td></tr></deftable><p>Usually Resin will use its XML parsers and fast XSLT transformer.  Sometimesplacement of certain jars in the classpath causes problems.<var>system-property</var> can be used to explicitly set the Resin XML and XSLTimplementation classes.</p><example title="system-property for using Resin XML and XSLT">&lt;!-- xml --&gt;&lt;system-property javax.xml.parsers.DocumentBuilderFactory=                 "com.caucho.xml.parsers.XmlDocumentBuilderFactory"/&gt;&lt;system-property javax.xml.parsers.SAXParserFactory=                 "com.caucho.xml.parsers.XmlSAXParserFactory"/&gt;&lt;!--  xslt --&gt;&lt;system-property javax.xml.transform.TransformerFactory=                 "com.caucho.xsl.Xsl"/&gt;</example></s1><s1 title="JDK 1.5 JAXP implementation"><p>The Sun JDK 1.5 includes the Xerces and Xalan JAXP implementations packaged under a different name.</p><example title="JDK 1.5 system-property for JAXP implementations">&lt;web-app&gt;  &lt;!-- xml --&gt;  &lt;system-property javax.xml.parsers.DocumentBuilderFactory=                   "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/&gt;  &lt;system-property javax.xml.parsers.SAXParserFactory=                   "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/&gt;  &lt;!--  xslt --&gt;  &lt;system-property javax.xml.transform.TransformerFactory=                   "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"/&gt;&lt;/web-app&gt;</example></s1><s1 title="Using alternative XML and XSLT implementations"><s2 title="system-property"><p>JAXP system properties are used to specify the XML and XSLT implementationsthat are used.  Resin defaults to using it's own XML parsers and fast XSLTtransformer.  Other implementations are used with the specification of theappropriate system properties and values.</p><p>Examples of using <a config-tag="system-property"/> for commonly usedalternative XML parsers and XSLT transformers are in separate sections below.  The system property configuration tags can be placed at the <a config-tag="web-app"/> or the <a config-tag="server"/> level.</p><example title="system-property to specify xml parser for web-app">&lt;web-app&gt;  &lt;!-- xml --&gt;  &lt;system-property javax.xml.parsers.DocumentBuilderFactory=               "..."/&gt;  &lt;system-property javax.xml.parsers.SAXParserFactory=               "..."/&gt;  &lt;!--  xslt --&gt;  &lt;system-property javax.xml.transform.TransformerFactory=               "..."/&gt;&lt;/web-app&gt;</example><example title="system-property to specify xml parser for server">&lt;server&gt;  &lt;!-- xml --&gt;  &lt;system-property javax.xml.parsers.DocumentBuilderFactory=               "..."/&gt;  &lt;system-property javax.xml.parsers.SAXParserFactory=               "..."/&gt;  &lt;!-- xslt --&gt;  &lt;system-property javax.xml.transform.TransformerFactory=               "..."/&gt;&lt;/server&gt;</example></s2><s2 title="jar file placement"><p>Setting system properties for alternative libraries requires that theimplementation classes, usually in a .jar file, are available in the classpath.</p><p>The implementation classes are available for a single web application when thejar file(s) are placed in <code>WEB-INF/lib</code>.  Since other web-apps do not seethese libraries,  this allows you to isolate a particular version of aparticular implementation for use by the web-app.  It is not uncommon for a newversion of these jar files to introduce problems with existing code.  </p><p>If the <code>system-property</code> is being set at the server level, then the jarfiles containing the implementation classes need to be placed in<code>$RESIN_HOME/lib</code>.   This is also a convenient location for placement ifyou want to avoid putting the libraries in <code>WEB-INF/lib</code> for everyweb application.  Any jars placed in <code>$RESIN_HOME/lib</code> areavaialable for all web applications.</p></s2></s1><s1 name="xerces" title="Using Xalan and Xerces"><example title="system-property for using Xalan and Xerces">&lt;!-- xml --&gt;&lt;system-property javax.xml.parsers.DocumentBuilderFactory=             "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/&gt;&lt;system-property javax.xml.parsers.SAXParserFactory=             "org.apache.xerces.jaxp.SAXParserFactoryImpl"/&gt;&lt;!--  xslt --&gt;&lt;system-property javax.xml.transform.TransformerFactory=             "org.apache.xalan.processor.TransformerFactoryImpl"/&gt;</example><p>Cocoon users may need the following:</p><example title="system-property for cocoon users using Xalan and Xerces">&lt;system-property org.xml.sax.driver=             "org.apache.xerces.parsers.SAXParser"/&gt;</example><p>Put your xerces and xalan jar files in <code>WEB-INF/lib</code>, or to have themavailable to all of your applications put them in <code>$RESIN_HOME/lib</code>.</p></s1><s1 name="crimson" title="Using Crimson"><p>Crimson is the xml parser that is included with JDK 1.4.</p><example title="system-property for using Crimson">&lt;!-- xml --&gt;&lt;system-property javax.xml.parsers.DocumentBuilderFactory=             "org.apache.crimson.jaxp.DocumentBuilderFactoryImpl"/&gt;&lt;system-property javax.xml.parsers.SAXParserFactory=             "org.apache.crimson.jaxp.SAXParserFactoryImpl"/&gt;</example></s1></body></document>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -