[Xml-compile] unqualified troubles :)

Mark Overmeer mark at overmeer.net
Fri Feb 6 21:05:32 GMT 2009


* Jozef Kutej (jozef at kutej.net) [090206 16:19]:
> I had some problems with wsdl-s generated from java.
> 'elementFormDefault="unqualified"'

Unqualified is out of fashion: has no future.  But probably you have
no choice.

> $ echo '<note><text>huh?</text></note>' | xmllint --schema note.xsd --noout -
> -:1: element note: Schemas validity error : Element 'note': No matching global
> declaration available for the validation root.
> 
> The xml that passes xmllint looks like this (note.xml):
> <ns1:note xmlns:ns1="http://justns/"><text>huh?</text></ns1:note>

Maybe someone can find the rule which describes this behavior in detail.
The Schema spec is unreadable for me.  Maybe more accessible for native
speakers.

> The problem that should be fixed here is that the XML::Compile doesn't
> throw any exception and just returns nothing when parsing (READER) the
> second XML. Either it's valid and should result in a Perl data structure
> or not valid and should die.

Well, yes and no.  For one, XML::Compile does not pretend to be a perfect
validator.  It does validate a lot, but not everything.

In my experience, either people do understand name-spaces and use them
correctly.  Or they don't, use unqualified, and make a mess of things.
So, the current behavior is intentional: in unqualified more all
name-space info is simply ignored and only the local name is used.
I don't know whether that should stay that way.

> Probably the "elements_qualified => 'TOP'" should be made default for
> unqualified XSD-s as without it the generated XML-s are not valid.

The problem is that the compile() can also be used to produce only a
part of the message.  For instance in <any> blocks... (but to be honest,
also in those cases we usually have a ns-qualified top)

Other people's opinion?
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list