[jboss-dev-forums] [JBoss Web Development] New message: "Strange behaviour of org.xml.sax.EntityResolver.resolveEntity method on JBOSS"
Shivey Upadhyay
do-not-reply at jboss.com
Tue Feb 2 01:10:00 EST 2010
JBoss development,
A new message was posted in the thread "Strange behaviour of org.xml.sax.EntityResolver.resolveEntity method on JBOSS":
http://community.jboss.org/message/523542#523542
Author : Shivey Upadhyay
Profile : http://community.jboss.org/people/Shivey
Message:
--------------------------------------------------------------
Hi,
The peice of code that i want to discuss, parses a custom XML using SAXParser. The main class contains following code:
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setValidating(false);
SAXParser parser=parserFactory.newSAXParser();
XMLReader reader = parser.getXMLReader();
reader.setEntityResolver(new CustomEntityResolver());
reader.setContentHandler(new MyContentHandler());
InputSource is = new InputSource(this.getClass().getResourceAsStream("my.xml"));
reader.parse(is);
The class CustomEntityResolver implements org.xml.sax.EntityResolver and gives definition for method
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
InputStream iStream = this.getClass().getResourceAsStream(systemId);
InputSource iSource = new InputSource(is);
return iSource;
}
and my.xml starts with
<? xml ver...?>
<!DOCTYPE SYSTEM "shivey.dtd">
the ARGUMENT systemId comes as "shivey.dtd" on weblogic-- as defined in XML, BUT when the same application is executed on JBOSS 4.0.2, the value for systemId comes as "" and hence I GET A http://java.sun.com/javase/6/docs/api/java/net/MalformedURLException.html.
Observation: The iStream(InputStream) object created on Weblogic is of java.io.BufferedStream, but same object is of type sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream if systemId is hardcoded(shivey.dtd) on Jboss.
I appreciate any help in advance.
Thanks again,
Shivey Upadhyay
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/523542#523542
More information about the jboss-dev-forums
mailing list