You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by mr...@apache.org on 2006/11/19 05:55:18 UTC
svn commit: r476708 - in /xml/commons/trunk/java/external/src/javax/xml:
validation/package.html xpath/package.html
Author: mrglavas
Date: Sat Nov 18 20:55:17 2006
New Revision: 476708
URL: http://svn.apache.org/viewvc?view=rev&rev=476708
Log:
Fixing a couple errors in the usage examples. A DOM supplied as input to the
Validation API or XPath API must be constructed from a namespace-aware parser.
Modified:
xml/commons/trunk/java/external/src/javax/xml/validation/package.html
xml/commons/trunk/java/external/src/javax/xml/xpath/package.html
Modified: xml/commons/trunk/java/external/src/javax/xml/validation/package.html
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/javax/xml/validation/package.html?view=diff&rev=476708&r1=476707&r2=476708
==============================================================================
--- xml/commons/trunk/java/external/src/javax/xml/validation/package.html (original)
+++ xml/commons/trunk/java/external/src/javax/xml/validation/package.html Sat Nov 18 20:55:17 2006
@@ -54,7 +54,9 @@
<pre>
// parse an XML document into a DOM tree
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance();
+ parserFactory.setNamespaceAware(true);
+ DocumentBuilder parser = parserFactory.newDocumentBuilder();
Document document = parser.parse(new File("instance.xml"));
// create a SchemaFactory capable of understanding WXS schemas
Modified: xml/commons/trunk/java/external/src/javax/xml/xpath/package.html
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/javax/xml/xpath/package.html?view=diff&rev=476708&r1=476707&r2=476708
==============================================================================
--- xml/commons/trunk/java/external/src/javax/xml/xpath/package.html (original)
+++ xml/commons/trunk/java/external/src/javax/xml/xpath/package.html Sat Nov 18 20:55:17 2006
@@ -230,7 +230,9 @@
<pre>
// parse the XML as a W3C Document
-DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+builderFactory.setNamespaceAware(true);
+DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document document = builder.parse(new File("/widgets.xml"));
XPath xpath = XPathFactory.newInstance().newXPath();