Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Removing namespace prefixes from attributes

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there!

I need to export data using JAXB into XML. A 3rd party application, that needs to import the file can't handle namespace prefixes, no idea why but they keep insisting that there's no workaround possible on their side.

My question is now, is there any way to remove them prefixes from, most important, the root element, and if possible from the attributes of the subelements? See example below



Any suggestions are highly appreciated.

Thank you in advance.
 
Sheriff
Posts: 26966
84
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you considered the possibility that they can't process your document because it is not well-formed? It has namespace prefixes without a corresponding namespace declaration.

If the answer is that you posted an incomplete version of the document and your real document is well-formed, then I would suggest doing an XSL transformation to produce a similar document without namespaces.
 
Martin Fiskare
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, what i did in the first place was to run a namespace-filter, that removed the namepace attribute from the root element, resulting in every attibute of the sub-elements having a prefix 'ns1'.... and it's not well-formed anymore of course... DARN!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic