You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Kichline, Don (EM, PTL)" <Do...@penske.com> on 2003/11/10 15:02:15 UTC

System Id of Document

We are moving over from the Sun XML package.  We were using the
com.sun.xml.tree.XmlDocument.getSystemId() to retrieve the URI of the
document we are working on.  I can not find a similar function in the
org.w3c.doc.Document interface or any of the implementors.

I have the following code to now parse our XML documents.

public org.w3c.dom.Document getDocument(String fileName) {
	//          instantiate parser
	DOMParser parser = new DOMParser();

	//          installing error handler
	parser.setErrorHandler(new CPUTErrorHandler ());

	//          parsing document from URI string
	parser.parse(new File(fileName).toURL().toString());

	//          querying document after parse
	return parser.getDocument();
}

The concrete type of the Document is
"org.apache.xerces.dom.DeferredDocumentImpl".  



This really is the only thing holding us up from using Xerces in our Web
App.

Thanks!

Donald R. Kichline
Senior Programmer/Analyst
 
Penske Truck Leasing 
Rt. 10 Green Hills / P.O. Box 563 
Reading, PA 19603-0563 
610.796.4190 / Fax: 610.603.8402
E-MAIL: Don.Kichline@penske.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: System Id of Document

Posted by Venu <K....@Sun.COM>.
Hi ,

DOMLevel3 Core spec defines documentURI method in the Document 
interface. Does that help you.

Thanks,
Venu


Kichline, Don (EM, PTL) wrote:
> We are moving over from the Sun XML package.  We were using the
> com.sun.xml.tree.XmlDocument.getSystemId() to retrieve the URI of the
> document we are working on.  I can not find a similar function in the
> org.w3c.doc.Document interface or any of the implementors.
> 
> I have the following code to now parse our XML documents.
> 
> public org.w3c.dom.Document getDocument(String fileName) {
> 	//          instantiate parser
> 	DOMParser parser = new DOMParser();
> 
> 	//          installing error handler
> 	parser.setErrorHandler(new CPUTErrorHandler ());
> 
> 	//          parsing document from URI string
> 	parser.parse(new File(fileName).toURL().toString());
> 
> 	//          querying document after parse
> 	return parser.getDocument();
> }
> 
> The concrete type of the Document is
> "org.apache.xerces.dom.DeferredDocumentImpl".  
> 
> 
> 
> This really is the only thing holding us up from using Xerces in our Web
> App.
> 
> Thanks!
> 
> Donald R. Kichline
> Senior Programmer/Analyst
>  
> Penske Truck Leasing 
> Rt. 10 Green Hills / P.O. Box 563 
> Reading, PA 19603-0563 
> 610.796.4190 / Fax: 610.603.8402
> E-MAIL: Don.Kichline@penske.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org