You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/12/06 20:56:19 UTC
cvs commit: xml-xalan/java/samples/DOM2DOM DOM2DOM.java
dleslie 00/12/06 11:56:18
Modified: java/samples/DOM2DOM DOM2DOM.java
Log:
Set system id for the DOMSource.
Revision Changes Path
1.2 +8 -1 xml-xalan/java/samples/DOM2DOM/DOM2DOM.java
Index: DOM2DOM.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/samples/DOM2DOM/DOM2DOM.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOM2DOM.java 2000/12/05 13:33:25 1.1
+++ DOM2DOM.java 2000/12/06 19:56:17 1.2
@@ -114,11 +114,18 @@
//Use the DocumentBuilder to parse the XML input.
Document doc = dBuilder.parse("birds.xml");
+ // Use the DOM Document to define a DOMSource object.
+ DOMSource domSource = new DOMSource(doc);
+
+ // Set the base URI for the DOMSource so any relative URIs it contains can
+ // be resolved.
+ domSource.setSystemId("birds.xml");
+
// Create an empty DOMResult for the Result.
DOMResult domResult = new DOMResult();
// Perform the transformation, placing the output in the DOMResult.
- transformer.transform(new DOMSource(doc), domResult);
+ transformer.transform(domSource, domResult);
//Instantiate an XML serializer and use it to serialize the output DOM to System.out
// using a default output format.