Radu,
No – that’s not the idea.
All I was trying to do was use a simple
piece of well-formed XML without any namespace prefixes in it!!!
This appears to be one of those situations
where the Java implementation stack (Saxon, ‘Beans, et al) default
behaviour is not 100% aligned with the W3C specifications.
First off XMLBeans complained about the
well-formed XML unless there was a default namespace declaration – even though
technically – one should not be needed (there’s no namespace
prefixes used).
Upon deeper inspection I found that this
was being triggered by what was defined in the schema used to do the XMLBeans
generation.
It appears that XMLBeans locks the default
namespace declaration into what it generates to be explicitly that URL from the
schema.
Again this is not 100% kosher –
since the well-formed XML should be allowed to define the namespace without the
URL for the declaration having any special significance.
I can understand WHY the XMLBeans is doing
this – its using it as an unofficial “version” marker –
but I’m asking if there is a way to turn this behaviour off?
Reason is that I fully expect people that
start working with our well-formed XML to want to REPLACE the URL in that
default namespace declaration with their own URL – not ours. And
technically by the W3C – they should be able to.
Thanks, DW
From: Radu
Preotiuc-Pietro [mailto:radup@xxxxxxx]
Sent: Friday, November 17, 2006 9:46 PM
To: user@xxxxxxxxxxxxxxxxxxx
Subject: RE: Accepting any URL on
the default namespace declaration
Let me see if I got this straight. You
want that regardless of the namespace in the document, XmlBeans to consider it
as having no namespace at all. If this is correct, I have to say I find it
pretty strange. You can do two things:
1. Try using .setLoadUseXMLReader() and
pass in a Reader that doesn't use namespaces
2. Write a SAX filter that strips the
namespace before passing the events to XMLBeans; this is not as difficult as it
may sound.
I suppose that we could always add an
option for XMLBeans to do this automatically; but first, is this a good
characterization of what you had in mind?
Radu
From: Webber,
David (NIH/OD) [C] [mailto:webberd@xxxxxxxxxx]
Sent: Thursday, November 16, 2006
9:01 AM
To: user@xxxxxxxxxxxxxxxxxxx
Subject: Accepting any URL on the
default namespace declaration
Just trying to puzzle out the XmlOptions for the
Factory.parse – the FAQ and the Javadoc gives some parameters – but
no guide to their usage / purpose. Not always clear from the name of the
parameter.
What I’m attempting to do is to have the namespace
declaration URL be ##any – instead of enforced to be a specific URL
value.
E.g.
<myxml
xmlns=”foobar.com/mustbe/this/that”>
<test/>
</myxml>
Where the namespace URL is forced to match the value put in
targetNamesSpace in the XSD that was used to generate the XMLBeans.
I want to relax that check and allow any URL to be used for
the default namespace.
Thanks,
David Webber
http://drrw.net