Re: the default namespace when write a xml

2009-05-28 Thread Jacob Danner
Wasn't this message already posted and answered on the 25th?
The link works for me. Here are the contents of the relevant FAQ
"""
How can I influence the namespace prefix used when saving/printing out my XML?

XMLBeans does not keep the prefixes when the original XML is loaded
into the underlying XML store. If you need/want a specific prefix to
be associated with a namespace you can use the
setSaveSuggestedPrefixes(...) XmlOption.

Here is a code example from this helpful post, [WWW]
http://nagoya.apache.org/eyebrowse/readmsg?listname=xmlbeans-u...@xml.apache.org&msgNo=33
:

HashMap suggestedPrefixes = new HashMap();
suggestedPrefixes.put("http://foo.com/";, "foo");
XmlOptions opts = new XmlOptions();
opts.setSaveSuggestedPrefixes(suggestedPrefixes);

String output = document.xmlText(opts);


-jacobd

On Wed, May 27, 2009 at 11:44 PM, apachemaven  wrote:
> With the xmlbeans I made a xml file,however the namespace is "n1 n2" and so
> on,
> http://www.swe.com/ow>
> http://www.swe.net";>org
> 
>  
>   http://www.swe.net";>inder
> inner
>   http://www.swe.net";>title
>  
> 
> 
> how to specify them? they should look like this:
>  xmlns:com=http://www.swe.com/ow>
> http://www.swe.net";>org
> 
>  
>   http://www.swe.net";>inder
> inner
>   http://www.swe.net";>title
>  
> 
> 
>
> PS:
> what is the difference between the add and set method?
> take the above for example:
> Execute.addNewInstance(IdentifierType id)
> Execute.setIdentifier(CodeType id)
>
> 
> Some one have given a reply:
> http://wiki.apache.org/xmlbeans/XmlBeansFaq#suggestedPrefixes
> but I found the link is no longer available
>
> ==
> apachemaven
> 2009-05-28

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



the default namespace when write a xml

2009-05-27 Thread apachemaven
With the xmlbeans I made a xml file,however the namespace is "n1 n2" and so on,
http://www.swe.com/ow>
http://www.swe.net";>org

 
  http://www.swe.net";>inder 
inner
  http://www.swe.net";>title
 


how to specify them? they should look like this:
http://www.swe.com/ow>
http://www.swe.net";>org

 
  http://www.swe.net";>inder 
inner
  http://www.swe.net";>title
 



PS:
what is the difference between the add and set method?
take the above for example:
Execute.addNewInstance(IdentifierType id)
Execute.setIdentifier(CodeType id)


Some one have given a reply:
http://wiki.apache.org/xmlbeans/XmlBeansFaq#suggestedPrefixes
but I found the link is no longer available

==
apachemaven 
2009-05-28