You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Branko Peteh <br...@sidestep.com> on 2005/04/14 03:53:31 UTC
Namespace Prefix question
Hi,
I'm trying to change the prefix for the namespace, but nothing seems to work!
I always get ns as the namespace prefix:
I tried:
1) Cursor:
XmlCursor cur = doc.newCursor();
cur.toStartDoc();
cur.toFirstContentToken();
cur.insertNamespace("myprefix","http://www.xyz.com/XYZ");
cur.prefixForNamespace("http://www.xyz.com/XYZ");
cur.namespaceForPrefix("myprefix"); --> gives 'ns'
2)XmlOptions
XmlOptions opts = new XmlOptions();
Map map = new HashMap();
map.put("http://www.xyz.com/XYZ", "myprefix");
opts.setLoadAdditionalNamespaces(map);
opts.setSaveImplicitNamespaces(map);
opts.setSaveSuggestedPrefixes(map);
doc.xmlText(opts);
I always get 'ns' instead of 'myprefix' when I do doc.toString().
Please help, as I really don't know what to do next.
Many thanks,
Branko
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org