You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/06/22 17:51:04 UTC
cvs commit: xml-xerces/java/samples/dom/wrappers NonValidatingDOMParser.java
jeffreyr 00/06/22 08:51:03
Modified: java/samples/dom/wrappers NonValidatingDOMParser.java
Log:
added argopt like class, added switch to turn on/off validation, namespace, schema support, etc.
Revision Changes Path
1.2 +21 -0 xml-xerces/java/samples/dom/wrappers/NonValidatingDOMParser.java
Index: NonValidatingDOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/wrappers/NonValidatingDOMParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NonValidatingDOMParser.java 1999/11/09 01:14:04 1.1
+++ NonValidatingDOMParser.java 2000/06/22 15:50:59 1.2
@@ -58,6 +58,7 @@
package dom.wrappers;
import dom.DOMParserWrapper;
+import dom.Features;
import org.w3c.dom.Document;
@@ -77,6 +78,9 @@
// Data
//
+ Features feature = null;
+
+
/** Parser. */
org.apache.xerces.parsers.DOMParser parser =
new org.apache.xerces.parsers.DOMParser();
@@ -99,10 +103,27 @@
/** Parses the specified URI and returns the document. */
public Document parse(String uri) throws Exception {
+ try {
+ parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion",
+ feature.isDeferredDOMSet() );
+ parser.setFeature( "http://xml.org/sax/features/validation",
+ feature.isValidationSet());
+ parser.setFeature( "http://xml.org/sax/features/namespaces",
+ feature.isNamespaceSet() );
+ parser.setFeature( "http://apache.org/xml/features/validation/schema",
+ feature.isSchemasupportSet() );
+ } catch (SAXException e) {
+ System.out.println("error in setting up parser feature");
+ }
+
parser.parse(uri);
return parser.getDocument();
} // parse(String):Document
+
+ public void setFeatures(Features fea ) {
+ feature = fea;
+ }
//
// ErrorHandler methods