You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jeffrey Crump <jc...@sonicsoftware.com> on 2004/07/22 21:00:41 UTC

Problem with XmlBeans.loadXsd

I'm trying to load some a schema definition and I'm having problems
getting XML Beans to recognize my namespaces.

First of all, I have a parsed XML document (it's WSDL) and I've located
the schema element, i.e.,

XmlObject[] = new XmlObject[size];
Element elem = ... 
XmlObject schemaObj = XmlObject.Factory.parse(elem);
schemaArray[count++] = schemaObj;

Then I try to load the schema:

XmlOptions options = new XmlOptions();
options.setLoadAdditionalNamespaces(nsMap); //java.util.Map from prefix
to uri, obtained from the original document that elem came from
SchemaTypeLoader loader = XmlBeans.loadXsd(schemaArray, options);

But I get this exception:

org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Can't
resolve prefix: xsd
  at
org.apache.xmlbeans.impl.values.JavaQNameHolder.parse(JavaQNameHolder.ja
va:133)
  at
org.apache.xmlbeans.impl.values.JavaQNameHolder.set_text(JavaQNameHolder
.java:148)

The map I set into the options maps "xsd" to the appropriate URI. 

Am I missing something?  How can I get this to work, short of re-parsing
the entire document?

Thanks,
Jeff

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/