The options need to be:
HashMap ns = new HashMap();
ns.put("http://www.starstandards.org/STAR", "s");
ns.put("http://www.gm.com/2006/GWM", "gwm");
xmlOptions.setSaveSuggestedPrefixes(ns);
processRepairDoc.save(new File("C:\\work\\test.xml"), xmlOptions);
Radu
On Wed, 2009-04-22 at 06:30 -0700, sg0210 wrote:
> Actually I am generating jar our of this XSD and also using the following
> options
> HashMap ns = new HashMap();
> ns.put("http://www.starstandards.org/STAR", "xmlns:s");
> ns.put("http://www.gm.com/2006/GWM", "xmlns:gwm");
>
> ns.put("http://www.gm.com/2006/GWMv1.01\\GWM_TI_ProcessRepairOrder.xsd",
> "xsi:schemaLocation");
> private ProcessRepairOrderDocument processRepairDoc;
> processRepairDoc.save(new File("C:\\work\\test.xml"), xmlOptions);
>
> What I need a s namespace instead of star. Please help asap.
>
> Thanks
> Sharad
>
>
> sg0210 wrote:
> >
> > Internally in our xml generation logic we are using apache xmlbeans to
> > create or build ProcessRepairOrder XML(s), however when I use xsd2inst
> > command it is adding star namespace by default but we would like to add
> > <s> namespace instead of <star> (refer attached XSD schemas and sample xml
> > file).
> > It looks like it is XSD design issue, so please let me know if you have
> > any suggestions or can help us to sort out this problem.
> >
> > My Schema
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!-- edited with XMLSpy v2006 sp2 U (http://www.altova.com) by Robert
> > Loesch (IBM) -->
> > <xs:schema xmlns:gwm="http://www.gm.com/2006/GWM"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://www.gm.com/2006/GWM"
> > xmlns:s="http://www.starstandards.org/STAR"
> > elementFormDefault="qualified" attributeFormDefault="unqualified">
> > <xs:import namespace="http://www.starstandards.org/STAR"
> > schemaLocation="ProcessRepairOrder.xsd "/>
> > <xs:complexType name="DataAreaExtended">
> > <xs:complexContent>
> > <xs:extension base="s:ProcessRepairOrderDataArea">
> > <xs:sequence>
> > <xs:element name="RepairOrderCount"
> > type="xs:integer" minOccurs="0"/>
> > </xs:sequence>
> > </xs:extension>
> > </xs:complexContent>
> > </xs:complexType>
> > .....
> > ProcessRepairOrder.xsd (Schema)
> >
> > <xs:schema attributeFormDefault="unqualified"
> > elementFormDefault="qualified"
> > targetNamespace="http://www.starstandards.org/STAR"
> > xmlns="http://www.starstandards.org/STAR"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:complexType name="ProcessRepairOrderDataArea">
> >
> >
> > xsd2inst schemafile.xsd -name globalElementName
> > xsd2inst GWM_TI_ProcessRepairOrder.xsd -name ProcessRepairOrder | more
> > Output
> > <star:ProcessRepairOrder revision="3.0" release="8.1-Lite"
> > environment="Product
> > on" lang="so-SO" xmlns:star="http://www.starstandards.org/STAR">
> > <star:ApplicationArea>
> > <star:Sender>
> > <!--Optional:-->
> > <star:LogicalId>string</star:LogicalId>
> > <star:Component>string</star:Component>
> > <star:Task>string</star:Task>
> > <!--Optional:-->
> > <star:ReferenceId>string</star:ReferenceId>
> > <!--Optional:-->
> > <star:AuthorizationId>string</star:AuthorizationId>
> > <star:CreatorNameCode>string</star:CreatorNameCode>
> > <star:SenderNameCode>string</star:SenderNameCode>
> > <!--Optional:-->
> > <star:SenderURI>http://www.company.org/sonoras/aeoliam</star:SenderURI>
> > <!--Optional:-->
> > <star:DealerNumber>string</star:DealerNumber>
> > http://xmlbeans.apache.org/docs/2.0.0/guide/tools.html#scomp
> >
> > Refer files
> >
> > http://www.nabble.com/file/p23139344/GWM_TI_ProcessRepairOrder.xsd
> > GWM_TI_ProcessRepairOrder.xsd
> > http://www.nabble.com/file/p23139344/ProcessRepairOrder.xsd
> > ProcessRepairOrder.xsd
> > http://www.nabble.com/file/p23139344/star_repairorder.xml
> > star_repairorder.xml (Output getting)
> > http://www.nabble.com/file/p23139344/srepairOrder.xml srepairOrder.xml
> > (Output Desired)
> >
> >
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]