[Xml-compile] unqualified troubles :)

Jozef Kutej jozef at kutej.net
Fri Feb 6 16:19:59 GMT 2009


Hi,

I had some problems with wsdl-s generated from java. After a long fight I f=
ound
out that the problem is caused by 'elementFormDefault=3D"unqualified"', whi=
ch if
the default mode if the attribute elementFormDefault is not set in the XSD
schema. In my case it wasn't.

With "unqualified" XML::Compile generated following xml string:
"<note><text>huh?</text></note>". When it's run through the xmllint:

$ echo '<note><text>huh?</text></note>' | xmllint --schema note.xsd --noout=
 -
-:1: element note: Schemas validity error : Element 'note': No matching glo=
bal
declaration available for the validation root.
- fails to validate

The xml that passes xmllint looks like this (note.xml):
<ns1:note xmlns:ns1=3D"http://justns/"><text>huh?</text></ns1:note>

And this is exactly what Java generated XML-s looked like.

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

Run `./note-test.pl`

I found "elements_qualified =3D> 'TOP'" option for the compiler in which ca=
se
XML::Compile generated the second XML. XML::Compile was able to parse back
(READER) both "versions" in this case.

Run `./note-test.pl -t`

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

Attached is note-test.pl and note.xsd and note.xml that I used to try things
out. My version of XML::Compile is 1.00.

Cheers,
Jozef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: note-test.pl
Type: application/x-perl
Size: 1228 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20090206/0=
090eef5/note-test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: note.xsd
Type: application/xml
Size: 423 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20090206/0=
090eef5/note.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: note.xml
Type: text/xml
Size: 66 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20090206/0=
090eef5/note.bin


More information about the Xml-compile mailing list