xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cezar Andrei" <ce...@bea.com>
Subject RE: Problem with XmlBeans.loadXsd
Date Thu, 22 Jul 2004 20:02:16 GMT
I think the LoadAdditionalNamespaces option is used only when parsing from text.
I'm not sure this will work but I suggest you replace: 
	> XmlObject schemaObj = XmlObject.Factory.parse(elem);
with
	> XmlObject schemaObj = org.w3.x2001.xmlSchema.SchemaDocument.Factory.parse(elem);

A better way of doing this would be to parse the WSDL from the beginning with XmlBeans in
the context of WSLD schema and S4S. This way the XmlObjects that represent the schema elements
will have the type assigned to SchemaDocument.

Cezar

> -----Original Message-----
> From: Jeffrey Crump [mailto:jcrump@sonicsoftware.com]
> Sent: Thursday, July 22, 2004 2:01 PM
> To: xmlbeans-user@xml.apache.org
> Subject: 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(JavaQNam
> eHolder.ja
> va:133)
>   at
> org.apache.xmlbeans.impl.values.JavaQNameHolder.set_text(JavaQ
> NameHolder
> .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/
> 
> 

- ---------------------------------------------------------------------
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/


Mime
View raw message