xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeffrey Crump" <jcr...@sonicsoftware.com>
Subject RE: Problem with XmlBeans.loadXsd
Date Fri, 23 Jul 2004 16:02:55 GMT
Trying another tack, I'm attempting to load the schema definitions from
the WSDL directly through XMLBeans:

      File f = new File("mydoc.wsdl");
      SchemaTypeLoader loader = XmlBeans.getContextTypeLoader();
      XmlObject wsdldoc = loader.parse(f, null, options);
      SchemaTypeLoader newLoader = XmlBeans.loadXsd(new XmlObject[]
{wsdldoc});

but then I get this error:

org.apache.xmlbeans.XmlException: Thread main: The 0th supplied input is
not a schema or a config document: its type is
D=definitions@http://www.apache.org/internal/xmlbeans/wsdlsubst
	at
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.forSchemaXml(Schema
TypeSystemImpl.java:177)     

Am I missing something? Any help would be greatly appreciated.

-Jeff

> -----Original Message-----
> From: Jeffrey Crump [mailto:jcrump@sonicsoftware.com] 
> Sent: Thursday, July 22, 2004 4:12 PM
> To: xmlbeans-user@xml.apache.org
> Subject: RE: Problem with XmlBeans.loadXsd
> 
> Thanks, Cezar. Alas, your suggestion didn't work.   I'm doing the
> initial parse of the WSDL through WSDL4J;  I also need to 
> compile documents on-the-fly, so the command line tool isn't 
> an option.  And I really want to avoid parsing the document 
> twice, for obvious reasons.
> Any other ideas?  If you can't tell, I'm new to XML Beans ;-)
> 
> -Jeff
> 
> 
> > -----Original Message-----
> > From: Cezar Andrei [mailto:cezar@bea.com]
> > Sent: Thursday, July 22, 2004 4:02 PM
> > To: xmlbeans-user@xml.apache.org
> > Subject: RE: Problem with XmlBeans.loadXsd
> > 
> > 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/
> > 
> > 
> > 
> 
> - 
> ---------------------------------------------------------------------
> 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