xmlsbeans 2.5 does not check sequence order ?
[email protected] Wed, 4 May 2011 18:19:07 +0000 (UTC)
| Newsgroups | gmane.text.xml.xmlbeans.user |
|---|---|
| Message-ID | <OFF34D6E6A.233CF4F1-ONC1257886.0063BE22-C1257886.00649490@telintrans.fr> |
Hello,
I parse a xml string, but wmlsbeans does not see that the version element
is not present ! I am expecting an exception like I have one when there is
a syntax error in the xml string.
So my problems with xmlsbeans 2.5 are :
- xmlsbeans does not throw an exception when an element of a sequence is
not here ?
- xmlsbeans does not throw an exception when an element of a sequence is
not at the right position ?
- xmlsbeans does not throw an exception when an element of a sequence is
not declared in the XSD ?
My java code is :
DeclareParcelsAndCustomsResponseDocument ansDoc =
DeclareParcelsAndCustomsResponseDocument.Factory.parse(answer);
DeclareParcelsAndCustomsResponseDocument.DeclareParcelsAndCustomsResponse
ans = ansDoc.getDeclareParcelsAndCustomsResponse() ;
XSD Source
===========
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.colis-logistique.com/i-net/wsapi"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="DeclareParcelsAndCustomsResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Version" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Timestamp" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="AckCode" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="HMacBase64Code" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
XML String
=========
<wsap:DeclareParcelsAndCustomsResponse
xmlns:wsap="http://www.colis-logistique.com/i-net/wsapi">
<wsap:Timestamp>2011-05-02T16:57:33.136Z</wsap:Timestamp>
<wsap:AckCode>SUCCESS</wsap:AckCode>
<wsap:HMacBase64Code>ZjY5MDdlYWI4MGQxMGQ3MjM5OTExZmVmNjQ1NjY3ZDY3NTVkYmQ5MGQ4YTViM2JlOTE1OWU3ODFjZGJlYjIxNg==</wsap:HMacBase64Code>
</wsap:DeclareParcelsAndCustomsResponse>
validate xsd .xml => OK : There is no VERSION : I agree with this.
But, I do not have the same behavior in my own java code ?
Any idea ?
Thanks,
PHL
_______________________________________________________
Philippe LEGAY
TELINTRANS
Direction Production
Département Intégration des Projets
E-Mail : [email protected]
Tel : (+33) 01 56 30 74 24
P Afin de contribuer au respect de l'environnement, merci de n'imprimer ce
courriel que si nécessaire.