XSD indicators e.g. <all> or <choice> having no

Having trouble installing Oxygen? Got a bug to report? Post it all here.
TE
Posts: 6
Joined: Thu Nov 13, 2003 5:42 pm

XSD indicators e.g. <all> or <choice> having no

Post by TE »

hi,

I have the following XML schema using the <all> indicator but
the xml validation is always succesful even i don't have a
REQID element. The <all> indicator has no effect in this case.

Anyone who can solve this problem?
Thank you very much.

<?xml version="1.0"?>
<xs:schema targetNamespace="dp24" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="SET">
<xs:complexType>
<xs:all>
<!--Request ID, unique and constant for each file-->
<xs:element name="REQID">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
<xs:pattern value="[0-9]{10}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

If I remove the REQID element and try to validate:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<SET xmlns="dp24"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="dp24 all.xsd">

</SET>

I get one error:

Code: Select all


E cvc-complex-type.2.4.b: The content of element 'SET' is not complete. One of '{"":REQID}' is expected.
Make sure you use the validate action and not the well-formed check.

Best Regards,
George
TE
Posts: 6
Joined: Thu Nov 13, 2003 5:42 pm

Post by TE »

Hi George,

I'm sure I'using the right buttons ;-)

This my XML file:

It is valid anyway, with:

<?xml version="1.0" ?>
<SOAP:Envelope bpoheader:dp="24" bpoheader:tacode="0077" bpoheader:version="1.0"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bpoheader="bpoheader"
xmlns:dp24="dp24"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="dp24 file:///d:/xmlpilot/dp24.xsd
http://schemas.xmlsoap.org/soap/envelope/ file:///d:/xmlpilot/soaplocal.xsd
bpoheader file:///d:/xmlpilot/bpoheader.xsd">
<SOAP:Body>
<!--Tag Name: rfc:_-BI0_-QI6A[InfoSource]_RFC
xmlns:rfc attribute: urn:sap-com:document:sap:rfc:functions
DATASOURCE tag: 6A[InfoSource]-->
<rfc:_-BI0_-QI6ADUXMLPILOT_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<DATASOURCE>6ADUXMLPILOT</DATASOURCE>
<DATA>
<item>
<SET>
<!--Request ID, unique and constant for each file-->
<dp24:REQID>0000000001</dp24:REQID>
</SET>
</item>
</DATA>
</rfc:_-BI0_-QI6ADUXMLPILOT_RFC>
</SOAP:Body>
</SOAP:Envelope>


or without:


<?xml version="1.0" ?>
<SOAP:Envelope bpoheader:dp="24" bpoheader:tacode="0077" bpoheader:version="1.0"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bpoheader="bpoheader"
xmlns:dp24="dp24"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="dp24 file:///d:/xmlpilot/dp24.xsd
http://schemas.xmlsoap.org/soap/envelope/ file:///d:/xmlpilot/soaplocal.xsd
bpoheader file:///d:/xmlpilot/bpoheader.xsd">
<SOAP:Body>
<!--Tag Name: rfc:_-BI0_-QI6A[InfoSource]_RFC
xmlns:rfc attribute: urn:sap-com:document:sap:rfc:functions
DATASOURCE tag: 6A[InfoSource]-->
<rfc:_-BI0_-QI6ADUXMLPILOT_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<DATASOURCE>6ADUXMLPILOT</DATASOURCE>
<DATA>
<item>
<SET>
</SET>

</item>
</DATA>
</rfc:_-BI0_-QI6ADUXMLPILOT_RFC>
</SOAP:Body>
</SOAP:Envelope>
TE
Posts: 6
Joined: Thu Nov 13, 2003 5:42 pm

Post by TE »

hi, sorry i found the bug.
it's a missing namespace....

thanks anyway, george
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

The problem in this case is that the SOAP:Body content is defined to allow elements from any namespace and the content processing is set to "lax", that means the validation will be enforced if a schema is specified for those elements, otherwise no validation will be performed. In your case the rfc:_-BI0_-QI6ADUXMLPILOT_RFC element has no schema associated.

Best Regards,
George
Post Reply