You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Radu Preotiuc-Pietro <ra...@bea.com> on 2005/02/11 06:00:39 UTC

RE: Prefix problem

I don't think you ever got any answer to this question, if you did, I apologise for the noise.
The two documents are actually different, because the <quantity> and <price> elements are in the no-namespace in the first case and in the "urn:productContent" namespace in the second case.
XmlBeans will output whatever document you created. I suggest you look at the XmlSchema that this document is based on. If you see something like "elementFormDefault="qualified"" at the top, then the document MUST look like in the second case, otherwise it would be incorrect. If you need it to look like the first example, you need to change your Schema.

Radu

-----Original Message-----
From: Erol Ozcan [mailto:erol.ozcan@gmail.com]
Sent: Thursday, January 20, 2005 4:58 PM
To: user@xmlbeans.apache.org
Subject: Prefix problem


Hi,


   I am trying to create xml document using XmlBeans 1.0.3 for a
project.   I would like to add a "x" prefix to only root node. Here is
a simple xml example that i want

<x:product id="123"  xmlns:x="urn:productContent">
   <quantity>4</quantity>
   <price>100</price>
</x:product>

 If i use the following code

        HashMap suggestedPrefixes = new HashMap();
        suggestedPrefixes.put( "urn:productContent", "x" );
        XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setSaveSuggestedPrefixes( suggestedPrefixes );

 then i have got 

<x:product id="123"  xmlns:x="urn:productContent">
   <x:quantity>4</x:quantity>
   <x:price>100</x:price>
</x:product>


 Is there any way to put "x" prefix to only root node, in this case
"product" node ?

Thanks in your advance.
Erol,

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org