Skip to main content

Getting rid of repetitive namespace URI prefixes

1 reply [Last post]
Joined: 2005-05-18


I'm not an expert on XML, so this questions might be a bit confused. When marshalling a List containing String and Float object, the resulting XML looks as follows:

<br />
<?xml version="1.0" encoding="UTF-8" standalone="yes"?></p>

(I put an extra space above between ':' and 'x' to supress stupid smileys appearing otherwise)

Is there any way to get rid of the repetitive namespace URI prefixes (xmlns: xsi="" xmlns: xs="")? I intend to use XML files as manually editable configuration files, so maximum simplicity is important.

Thanks for any suggestions,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-09

You can use NamespacePrefixMapper to put those two namespaces at the root element.

Another way to avoid having xsi:type altogether is to annotate your List

as: [code] @XmlElements({ @XmlElement(type=String.class,name="string"), @XmlElement(type=Float.class,name="float") }) List data; [/code] This makes your XML somethling like: [code] text 3.141 [/code]