Thanks lot Cezar, this is what I am looking for. How did you do that ? I am using xmlbeans 2.6.0 and API Inst2Xsd.inst2xsd() , but I am not able to generate like this. Is there any specific option to generate like this ?
I tried xmloptions. setLoadAdditionalNamespaces() but it dint help. Also, I noticed that there are no import statements added in schema you sent , Is there a way to do that ? Thanks Narayan -----Original Message----- From: Cezar Andrei [mailto:cezar.and...@oracle.com] Sent: Monday, January 27, 2014 9:14 PM To: user@xmlbeans.apache.org Subject: Re: Handling namespaces in xsd Narayan, It seems correct to me. Each namespace is defined by a separate schema file. And there is a definition in the last schema for abc element: <element name="abc" type="abcType"/> Cezar Here are the generated schema files: <schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3schools.com/furniture" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="table" type="fur:tableType" xmlns:fur="http://www.w3schools.com/furniture"/> <complexType name="tableType"> <sequence> <element type="xs:string" name="name" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> <element type="xs:byte" name="width" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> <element type="xs:byte" name="length" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> </sequence> </complexType> </schema> ---------------------- <schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3.org/TR/html4/" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="table" type="htm:tableType" xmlns:htm="http://www.w3.org/TR/html4/"/> <complexType name="trType"> <sequence> <element name="td" maxOccurs="unbounded" minOccurs="0"> <simpleType> <restriction base="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <enumeration value="Apples"/> <enumeration value="Bananas"/> </restriction> </simpleType> </element> </sequence> </complexType> <complexType name="tableType"> <sequence> <element type="htm:trType" name="tr" xmlns:htm="http://www.w3.org/TR/html4/"/> </sequence> </complexType> </schema> ---------------------- <schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="abc" type="abcType"/> <complexType name="abcType"> <sequence> <element ref="fur:table" xmlns:fur="http://www.w3schools.com/furniture"/> <element ref="htm:table" xmlns:htm="http://www.w3.org/TR/html4/"/> </sequence> </complexType> </schema> Cezar On Mon, 2014-01-27 at 04:36 -0800, Parvatikar, Narayan wrote: > Hi > > > > I am trying to convert a xml sample which has multiple namespaces > using xmlbeans inst2xsd java API. > > The generated xsd does not look correct? > > Source XML : > > > > <?xml version="1.0" encoding="UTF-8"?> > > <abc xmlns:h="http://www.w3.org/TR/html4/" > xmlns:f="http://www.w3schools.com/furniture" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > > <f:table> > > <f:name>African Coffee Table</f:name> > > <f:width>80</f:width> > > <f:length>120</f:length> > > </f:table> > > <h:table> > > <h:tr> > > <h:td>Apples</h:td> > > <h:td>Bananas</h:td> > > </h:tr> > > </h:table> > > </abc> > > > > The generated XSD contains only f: table and does not produce element > definition for root element abc. > > Is there any way to handle the multiple namespaces in xmlbeans ? > > > > > > Thanks > > Narayan > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: user-h...@xmlbeans.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: user-h...@xmlbeans.apache.org