This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes How to change XML Beans Namespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to change XML Beans Namespace" Watch "How to change XML Beans Namespace" New topic
Author

How to change XML Beans Namespace

Brad Ko
Greenhorn

Joined: Jul 27, 2007
Posts: 10
Does anyone know what methods I can use to remove and redefine the default namespace? I'm using xmlbeans(v2.2.0).

For our project, I want to redefine the namespace on the orignal xml to look like the target xml (see XML examples below).

=====Orignal XML=====
<ClientData xmlns="http://www.company.com">
<customerInformation>
<accessCard>
<accessCardNumber>45xxxxxxxxxx99</accessCardNumber>
</accessCard>
</customerInformation>
<w3:Info xmlns="http://company.org/schemas" xmlns:w3="http://www.company.com">
<w3:Count>6</w3:Count>
<w3:AddDataFlag>N</w3:AddDataFlag>
<w3:VendorList>
<w3:PayeeID>00001</w3:PayeeID>
<w3:PayeeTkn>###123456</w3:PayeeTkn>
<w3:PayeeName>AAAAAAA</w3:PayeeName>
<w3:CustPayeeID>00000</w3:CustPayeeID>
<w3:PayeeDataType/>
<w3:PayeeData/>
</w3:VendorList>
</w3:Info>
</ClientData>

====Target XML=====
<ClientData xmlns="http://www.company.com">
<customerInformation>
<accessCard>
<accessCardNumber>45xxxxxxxxxx99</accessCardNumber>
</accessCard>
</customerInformation>
<Info>
<Count>6</Count>
<AddDataFlag>N</AddDataFlag>
<VendorList>
<PayeeID>00001</PayeeID>
<PayeeTkn>###123456</PayeeTkn>
<PayeeName>AAAAAAA</PayeeName>
<CustPayeeID>00000</CustPayeeID>
<PayeeDataType/>
<PayeeData/>
</VendorList>
</Info>
</ClientData>

Thanks in advance.
Brad Ko
Greenhorn

Joined: Jul 27, 2007
Posts: 10
Nobody can answer for this question?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

If I wanted to transform your original XML into your target XML, I would just use XSLT to do that. Should be pretty simple. But you said you were using XML Beans, and I know nothing about that, so I didn't answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to change XML Beans Namespace
 
Similar Threads
JAXB and XML default namespace issue.
xmlbeans namespace issue
Differences between targetNamespace and default namespace
DOM String output is not the same as original XML
XML name space problem