[jdom-interest] how to set xml files base uri

Roberval Aratame Ribeiro roberval.ribeiro at uol.com.br
Tue Dec 17 15:08:59 PST 2002


If your problem is linking the dtd from the xml file try using xml file 
like this:

<!DOCTYPE trang SYSTEM "file:///c:/dtd_files/trang.dtd">


Rob


At 22:13 17/12/2002 +0100, Norrman Per wrote:

>1) Which parser are you using? Try to explicitly name
>the parser class in the SAXBuilder constructor.
>
>2) Are you sure that you are using the same code in Jboss
>compared to your command line app?
>
>3) Are you sure that the System.err is not captured and swallowed by
>JBoss?
>
>/pmn
>
>
>-----Original Message-----
>From: Zhong, Kai
>To: ''jdom-interest at jdom.org' '
>Cc: 'Norrman Per'
>Sent: 2002-12-17 18:11
>Subject: RE: [jdom-interest] how to set xml files base uri
>
>Thanks,
>But it the resolver is not invoked in my JBOSS/EJB.
>I put the same resovler in my command line application and it works.
>Confused.
>
>Here is my code:
>class ER implements EntityResolver {
>     public InputSource resolveEntity (String publicId, String systemId)
>{
>         System.err.println("\n-------------------------------------
>pid=" +
>publicId + "\n-------------------------------- sysid=" + systemId);
>         return null;
>     }
>}
>
>
>and
>         SAXBuilder builder = new SAXBuilder();
>         builder.setEntityResolver(new ER());
>
>in my command line application, it printed out the sysid. But not in my
>message driven bean. What could it be?
>
>Thanks,
>
>-----Original Message-----
>From: Norrman Per [mailto:per.norrman at canovia.se]
>Sent: Tuesday, December 17, 2002 3:18 AM
>To: 'Zhong, Kai '; ''jdom-interest at jdom.org' '
>Subject: RE: [jdom-interest] how to set xml files base uri
>
>
>
>Have a look at builder#setEntityResolver
>
>/pmn
>
>
>-----Original Message-----
>From: Zhong, Kai
>To: 'jdom-interest at jdom.org'
>Sent: 2002-12-17 01:47
>Subject: [jdom-interest] how to set xml files base uri
>
>Hi, I have an message driven bean and it will read an xml file from file
>system.
>e.g.            Document doc = builder.build(new FileReader(docID
>".xml"));
>However, inside the docid.xml, there is a a dtd reference:
><!DOCTYPE trang SYSTEM "/dtd_files/trang.dtd">
>which is a relative path. It is physically located under c:/dtd_files
>
>When the EJB runs, it raises an exception:
>[STDERR] Error on line 2: Relative URI "/dtd_files/trang.dtd; can not be
>resolved without a document URI.
>
>The problem is how to set the uri? I tried:
>Document doc = builder.build(new FileReader(docID ".xml"), "file:/c:/");
>
>But it doesn't work.
>
>Thanks for your help.
>
>Kai.
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
>rhost.com
>###########################################
>
>This message has been scanned by F-Secure Anti-Virus for Microsoft
>Exchange.
>For more information, connect to http://www.F-Secure.com/
>###########################################
>
>This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
>For more information, connect to http://www.F-Secure.com/
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com 
>




More information about the jdom-interest mailing list