Hi Siddhath,
please try this:
XmlOptions opts = new XmlOptions();
opts.setUseDefaultNamespace();
opts.setSavePrettyPrint();
Map ns = new Hashtable();
ns.put("urn:iso:std:iso:20022:tech:xsd:SCLSCTpacs.004.001.01",
"sw4");
ns.put("urn:iso:std:iso:20022:tech:xsd:SCLSCTpacs.008.001.01",
"sw8");
opts.setSaveSuggestedPrefixes(ns);
//standard output
System.out.println(doc.xmlText(opts));
// output to test.xml
doc.save(new File("test.xml"),opts);
I had the same problem and I solved it that way.
hope it will help you
best regards,
Alioum
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> Gesendet: 25.06.07 11:52:15
> An: <[email protected]>
> CC: "Siddharth Ranjan Patnaik" <[EMAIL PROTECTED]>
> Betreff: Schema 2 Instance Generation
>
>
> HI
> All,
>
>
> I am
> using Schema to Instance generation functionality of XMLBeans.While doing so ,
> the prefix used in the instance is decided by the framework.(it picks the
> first
> 3 or 4 letters of the last token from the URL).
>
>
> Example
> :
>
>
>
>
>
> "<schema
> xmlns=\"http://www.w3.org/2001/XMLSchema\"
> targetNamespace=\"http://mycomp/city\">" +
>
>
>
> "<element name=\"city\">" +
>
>
>
> "<complexType>" +
>
>
> "<all>"
> +
>
>
>
> "<element name=\"name\"/>" +
>
>
>
> "<element name=\"population\"/>" +
>
>
> "</all>"
> +
>
>
>
> "</complexType>" +
>
>
>
> "</element>" +
>
>
> "</schema>
>
>
>
>
>
> The
> instance generated for this Schema is as below :
>
>
>
>
>
> <city:city xmlns:city="http://mycomp/city">
>
>
> <name>anyType</name>
>
>
> <population>anyType</population>
>
>
> </city:city>
>
>
>
>
>
>
>
>
> My question
> is Is it possible to specify the prefix while generating the
> instance from the schema ? For example as a user I want mycity to be
> used as the prefix iso city .
>
>
>
>
>
>
>
>
> Regards,
>
>
> Siddhath
>
>
>
>
>
>
>
>
> ***********************************************************************
> The information in this message is confidential and may be legally
> privileged. It is intended solely for the addressee. Access to this
> message by anyone else is unauthorized. If you are not the
> intended recipient, any disclosure, copying, or distribution of the
> message, or any action or omission taken by you in reliance on
> it is prohibited and may be unlawful. Please immediately contact
>
>
> the sender if you have received this message in error. This email
> does not constitute any commitment from Cordys Holding BV or
> any of its subsidiaries except when expressly agreed in a written
> agreement between the intended recipient and
> Cordys Holding BV or its subsidiaries.
> ***********************************************************************
>
>
>
>
>
>
>
>
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]