XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] [Summary] How can the content of a leaf element bemultiple text nodes?

Hi all,
    Inspired by this thread, I've modified the online XML schema validation service at https://www.softwarebytes.org/xmlvalidation/.

I've provided a new option, where user can select whether to have comments an PIs present within the XSD 1.1 <assert> evaluation trees.

On Wed, Feb 16, 2022 at 7:22 PM Mukul Gandhi <mukulg@softwarebytes.org> wrote:
Hi Roger,
    Interestingly, your topic has XSD 1.1 related implications (as tested with Apache Xerces).

Please consider following XSD 1.1 validation example.

XML instance document:
<?xml version="1.0"?>
<Test>abc<!-- blah -->def</Test>

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

    <xs:element name="Test">
       <xs:complexType>
          <xs:simpleContent>
             <xs:extension base="xs:string">
                <xs:assert test="count(text()) = 1"/>
                <xs:assert test="text() = 'abcdef'"/>
             </xs:extension>
          </xs:simpleContent>
       </xs:complexType>
    </xs:element>

</xs:schema>

The above mentioned XSD document, results in valid outcome for the mentioned XML instance document with default options.

But when we provide, the option -acp (i.e, the xs:assert tree shall retain comments and PIs. or, set the feature http://apache.org/xml/features/validation/assert-comments-and-pi-checking to true manually during JAXP driven validation) to Xerces sample jaxp.SourceValidator, the above validation results in invalid outcome. Instead, the following XSD 1.1 document results in valid outcome with the same XML instance document (with the -acp option),

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

    <xs:element name="Test">
       <xs:complexType>
          <xs:simpleContent>
             <xs:extension base="xs:string">
                <xs:assert test="count(text()) = 2"/>
                <xs:assert test="text()[1] = 'abc'"/>
                <xs:assert test="text()[2] = 'def'"/>
                <xs:assert test="comment() = ' blah '"/>
             </xs:extension>
          </xs:simpleContent>
       </xs:complexType>
    </xs:element>

</xs:schema> 


--
Regards,
Mukul Gandhi


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS