Hello,

I'm sorry if this is already documented, if so please indicate me where
because I haven't found it. (or I wasn't looking in the right place)

I have problems using xsds with dom4j (I'm using version 1.5.2)

the only way I found to include my xsd is the following:
xmldoc.getRootElement().addNamespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance";);
xmldoc.getRootElement().addAttribute("xsi:noNamespaceSchemaLocation",
"http://myxsd.xsd";);
but this doesn't seem very optimal to me.


A bigger problem is that when I save this generated xml to disk, and try to
reread it afterwards, it doesn't use the parsing rules defined in the
document.

I found a way to verify it. But it obliges me to know the link to the xsd.
it is the following

SAXReader reader = new SAXReader(true);
// specify the schema to use
reader.setProperty
("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation";,

"http://myxsd.xsd";);
// add an error handler which turns any errors into XML
XMLErrorHandler errorHandler = new XMLErrorHandler();
reader.setErrorHandler( errorHandler );

Is there a way to tell the parser to use the xsd that is specified in the
document?


thanks for the excellent product
Hans



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to