You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Jimisola Laursen (JIRA)" <xm...@xml.apache.org> on 2006/02/09 15:19:57 UTC
[jira] Commented: (XMLBEANS-245) Make use of the EntityResolver set
in XmlOptions throughout the whole library
[ http://issues.apache.org/jira/browse/XMLBEANS-245?page=comments#action_12365739 ]
Jimisola Laursen commented on XMLBEANS-245:
-------------------------------------------
Manage to work around the problem using Xerces-J and XmlOptions.setLoadUseXMLReader(...);
// SAXParser Xerces-J
SAXParser parser = new SAXParser();
XMLReader reader = parser;
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
reader.setEntityResolver(new MyClassPathEntityResolver());
XmlOptions xmlOpts = new XmlOptions();
xmlOpts.setLoadUseDefaultResolver();
xmlOpts.setLoadUseXMLReader(reader);
// parse() does not use setEntityResolver (yet)
//xmlOpts.setEntityResolver(new MyEntityResolver());
xmlObject = XmlObject.Factory.parse(in, xmlOpts);
> Make use of the EntityResolver set in XmlOptions throughout the whole library
> -----------------------------------------------------------------------------
>
> Key: XMLBEANS-245
> URL: http://issues.apache.org/jira/browse/XMLBEANS-245
> Project: XMLBeans
> Type: Improvement
> Versions: Version 2.1
> Reporter: Jimisola Laursen
> Fix For: Version 2.1
>
> Appearently, XmlObject.Factory.parse(... XmlOptions) method to use the value set by XmlOptions.setEntityResolver in order to replace the default EntityResolver used (http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/XmlOptions.html#setEntityResolver(org.xml.sax.EntityResolver)):
> "If this option is set when compiling a schema, then the given EntityResolver will be consulted in order to resolve any URIs while downloading imported schemas. EntityResolvers are currently only used by compileXsd; they are not consulted by other functions, for example, parse. This will likely change in the future."
> I am in need of this change to replace the EntitiyResolver used with one that uses getClass().getResourceAsStream() to load the schema from class path.
> Hopefully, it should be too much work :) IoC also helps out when doing JUnit tests etc.
> There might be a temporary work around using XmlOptions.setLoadUseXMLReader and the default JDK's SAX parser. I'll get back on that one.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org