[Home] [By Thread] [By Date] [Recent Entries]

  • From: Mukul Gandhi <mukulg@s...>
  • To: XML Developers List <xml-dev@l...>
  • Date: Wed, 15 Dec 2021 18:46:06 +0530

Hi all,
   I've following XML instance document,

<?xml version="1.0"?>
<X>
  <a>
hello
world
  </a>
</X>

And the following XML Schema 1.1 document,

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="X">
       <xs:complexType>
          <xs:sequence>
             <xs:element name="a" type="xs:string"/>
          </xs:sequence>
          <xs:assert test="matches(a, '^(hello|world)$', 'm')"/>                                          
       </xs:complexType>
    </xs:element>

</xs:schema>

When I validate the, XML instance document that's provided with the provided XSD 1.1 document, I get a valid outcome. Shouldn't the XSD validity outcome be invalid? It think so, because the string content of element "a" after 'world' (within XML instance document) is not either hello or world (as specified by regex within the XSD document).

Any thoughts would be helpful.


--
Regards,
Mukul Gandhi


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member