xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duane Zamrok <zam...@cubrc.org>
Subject RE: Wrong namespace prefix in generated documents?
Date Thu, 31 Jul 2014 14:50:07 GMT
The short answer is to use XmlOptions to configure the prefixes used in your XmlBeans output.
Something like the following will cause it to use xxx for yyy:aaa:bbb:ccc. XmlBeans output
is NOT tied to the prefixes you declare in your schema.

HashMap ns = new HashMap();
ns.put("yyy:aaa:bbb:ccc", "xxx");
// ns.put("http://ccc.bbb.aaa", "orig");
// ns.put("urn:some.other.namespace", "pfxUwnt");

A longer answer is provided here http://codebrane.com/blog/2005/12/12/xmlbeans-and-namespaces/

From: Michael Bishop [mailto:bishopmw@gmail.com]
Sent: Monday, July 28, 2014 2:28 PM
To: user@xmlbeans.apache.org
Subject: Wrong namespace prefix in generated documents?

Hello all. I've recently changed the namespace of my schema. Now I'm getting the wrong prefix
name and I'm not sure why.
Old namespace was:

New namespace is:

With the old namespace, the prefix for elements was xxx. Now with the new namespace, the prefix
fpr elements is yyy. It seems switching from URL form to URI form has caused the processor
to start using the first part of the URI as the prefix? This happens when I call the static
Factory.newInstance() on generated classes. Older documents with the correct prefix still
parse properly.
It's not a big deal since the namespace is intact and things work as they should, but I can't
figure out why this is happening. I don't declare xmlns:yyy anywhere in the schema or xsdconfig
Michael Bishop
View raw message