Rao,
I don't know why the second version works and the first one
doesn't. The difference between them is that in this second version you set the
"features" on the XMLReader yourself, while in the first version, by passing the
XMLReader into XMLBeans, XMLBeans sets its own features in addition to the ones
you already have.
This is what XMLBeans sets, from
Locale.java:
try
{ _xr.setFeature( "http://xml.org/sax/features/namespace-prefixes", true); _xr.setFeature("http://xml.org/sax/features/namespaces", true); _xr.setFeature("http://xml.org/sax/features/validation", false); _xr.setProperty( "http://xml.org/sax/properties/lexical-handler", this); _xr.setContentHandler(this); _xr.setProperty("http://xml.org/sax/properties/declaration-handler", this); _xr.setDTDHandler(this); _xr.setErrorHandler(this); } [...]
_xr.setEntityResolver(er);
Maybe one of these features is incompatible with xinclude
and causes it to be unset, I'm guessing.
Radu From: Rama Mohan Rao Peruri [mailto:[EMAIL PROTECTED] Sent: Sunday, October 15, 2006 2:55 AM To: user@xmlbeans.apache.org Subject: RE: Xmlbeans and Xinclude Hi
Radu, While the sample I
provided earlier didn’t work, the following modified version works fine.
Do you see any obvious difference in the two because of which First
version doesn’t work and the Second version does? XmlSaxHandler sh =
XmlObject.Factory.newXmlSaxHandler(); InputStream
parReader = new
FileInputStream(“IwfConfig.xml"); InputSource is = new
InputSource(parReader); XMLReader reader =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); reader.setFeature("http://apache.org/xml/features/xinclude",
true); reader.setContentHandler(
sh.getContentHandler()
); reader.parse(is);
IwfDocument iwf =
(IwfDocument)sh.getObject(); Best
Regards Rao (Peruri Rama Mohan
Rao) T&O-ES-Imaging
& Workflow Tel: 65- 6878
2071 From: Radu
Preotiuc-Pietro [mailto:[EMAIL PROTECTED] Well, it looks to me
that this is a little beyond XMLBeans. Can you try just using Xerces without
XMLBeans to parse the same document? If you have the same error, then you'll
obviously have to fix that before you can expect that it will work with
XMLBeans, if not, then we have to figure out how do you set up Xerces that's
different than how XMLBeans does it. Radu From: Rama
Mohan Rao Peruri [mailto:[EMAIL PROTECTED] Hi There are a few people who raised
this topic but no solutions were given. After some digging around, I found
the following solution. However when tested it fails at the xinclude line
in the xml file. Could somebody point me to my
mistake? ClassLoader cl =
Thread.currentThread().getContextClassLoader(); URL url = ""> XMLReader reader =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); reader.setFeature("http://apache.org/xml/features/xinclude",
true);
XmlOptions xopt = new
XmlOptions(); xopt.setLoadUseXMLReader(reader); IwfDocument idoc =
IwfDocument.Factory.parse(url, xopt); /* fails with a Xerces fatal error
at the xinclude line in the xml file */ Best Regards
Rao (Peruri Rama Mohan
Rao) T&O-ES-Imaging &
Workflow Tel: 65- 6878
2071 CONFIDENTIAL NOTE: The information contained in this
email is intended only for the use of the individual or entity named above and
may contain information that is privileged, confidential and exempt from
disclosure under applicable law. If the reader of this message is not the
intended recipient, you are hereby notified that any dissemination, distribution
or copying of this communication is strictly prohibited. If you have received
this message in error, please immediately notify the sender and delete the mail.
Thank you. CONFIDENTIAL NOTE: The information contained in this email is intended only for the use of the individual or entity named above and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete the mail. Thank you. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. |
- Xmlbeans and Xinclude Rama Mohan Rao Peruri
- Factory.parse() takes more time kathiresan jeyapandian
- RE: Factory.parse() takes more time Radu Preotiuc-Pietro
- RE: Xmlbeans and Xinclude Radu Preotiuc-Pietro
- [ANN] VTD-XML 2.0 Jimmy Zhang
- RE: Xmlbeans and Xinclude Rama Mohan Rao Peruri
- RE: Xmlbeans and Xinclude Radu Preotiuc-Pietro