There is a method on XmlOptions (I think setSaveSuggestedPrefix() ) that you
can populate with a map of the prefix and namespace you want. If you search
the mailing list others have posted similar.
You may also want to look at XmlOptions.setSaveAggressiveNamespace()
-jacobd

On 11/1/07, Psoroulas John <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> is there any way to remove the undesirable "urn:" prefix when a message
> with namespaces, is constructed using the methods of the respective bean
> object?
>
> For example, I construct an xmlbean object , considering the code and the
> xsd below:
>
>
> --CODE--
> RootDocument root = RootDocument.Factory.newInstance();
> Mytype1 type1 = root.addNewRoot();
> Mytype2 type2 = type1.addNewHeader();
> type2.setId("MYID");
>
> XmlOptions opts = new XmlOptions();
> opts.setSavePrettyPrint();
> String msg = root.xmlText(opts);
>
> System.out.println("msg: \n" + msg);
>
>
> --XSD—
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xmlns="urn:iso:foo1"
>                                                 targetNamespace="urn:iso:foo1"
> elementFormDefault="qualified">
>         <xs:element name="root" type="mytype1"/>
>         <xs:complexType name="mytype2">
>                 <xs:sequence>
>                         <xs:element name="Id" type="xs:string"/>
>                 </xs:sequence>
>         </xs:complexType>
>         <xs:complexType name="mytype1">
>                 <xs:sequence>
>                         <xs:element name="Header" type="mytype2"/>
>                 </xs:sequence>
>         </xs:complexType>
> </xs:schema>
>
>
>
>
>
> The result message is:
>
> --MESSAGE--
> <urn:root xmlns:urn="urn:iso:foo1">
>   <urn:Header>
>     <urn:Id>MYID</urn:Id>
>   </urn:Header>
> </urn:root>
>
>
> How can I remove the "urn:" (using with some way the xmlbeans API)?
> (without using regular expression on the message or parsing it)
>
> I really appreciate any help,
>
>
> John
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to