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 <apachemav...@gmail.com> wrote: > With the xmlbeans I made a xml file,however the namespace is "n1 n2" and so > on, > <ns:Execute language="en_US" version="1.0.0" xmlns:ns=http://www.swe.com/ow> > <ns1:Identifier xmlns:ns1="http://www.swe.net">org</ns1:Identifier> > <ns:DataInputs> > <ns:Input> > <ns1:Identifier xmlns:ns1="http://www.swe.net">inder > inner</ns1:Identifier> > <ns1:Title xmlns:ns1="http://www.swe.net">title</ns1:Title> > </ns:Input> > </ns:DataInputs> > </ns:Execute> > how to specify them? they should look like this: > <com:Executelanguage="en_US" version="1.0.0" > xmlns:com=http://www.swe.com/ow> > <net:Identifier xmlns:net="http://www.swe.net">org</net:Identifier> > <com:DataInputs> > <com:Input> > <net:Identifier xmlns:net="http://www.swe.net">inder > inner</net:Identifier> > <net:Title xmlns:net="http://www.swe.net">title</net:Title> > </com:Input> > </com:DataInputs> > </com:Execute> > > 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