[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Newbie question : using XML to validate grammar (Schematron & XML Schema

  • To: xml-dev@l...
  • Subject: Newbie question : using XML to validate grammar (Schematron & XML Schema)
  • From: samy sayag <samuelsayag@y...>
  • Date: Thu, 8 Jun 2006 10:05:56 +0200 (CEST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=jIleyV497X0YSxZkWfCHtQUXCiJcTyisaGwVKlVBAH1njt3O568J8Cds/7Kd/c/EVxnzi9ON4XaJkDMQoXVJ7GXDFYqpOaxE1AVgtHh8TvwMfjin2jaRGt/AkdGMcRrQq8xLItz+T9uoHP01N1cHIi2JlVCiELlTo0raEaq/z9g= ;

xmlschemacache60
Hi everybody,

i've searched in the archive for an answer but couldn't find it so let me ask the following question :

I've learned how to embed basic Schematron patterns in W3C XML Schema but couldn't find how to validate it with MSXML (4.0 or 6.0) parser programmatically.

Dim objSchemaCache As New MSXML2.XMLSchemaCache60
Dim objXMLDoc As New MSXML2.DOMDocument60
objSchemaCache.Add "", nameOfSchemaFile
Set objXMLDoc.Schemas = objSchemaCache
objXMLDoc.async = False
objXMLDoc.Load nameOfXMLFile

' I raise the error if it exist with :
If objXMLDoc.parseError.errorCode <> 0

With a simple schema it works marvellously well but the problem is that the parser doesn't seem to "recognize" the Shematron pattern embedded in my Schema.

I used basic xml and xml schema to test it, here are the following files :

the xml file :

<?xml version="1.0" encoding="UTF-8"?>
<AAA xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Documents and Settings\samuel\Bureau\outil_statistiques\XML\ambiguite_shematron\ambigu1.xsd">
    <BBB>
        <CCC>0</CCC>
        <CCC>0</CCC>
        <CCC>0</CCC>
    </BBB>
</AAA>

the schematron+w3c xml schema file :

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:simpleType name="CCCType">
        <xs:restriction base="xs:byte">
            <xs:enumeration value="0"/>
            <xs:enumeration value="-1"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:element name="BBB">
        <xs:annotation>
            <xs:appinfo>
                <sch:pattern name="Sum inf -1">
                    <sch:rule context="//BBB">
                        <sch:assert test="sum(//CCC) = 0">0 result</sch:assert>
                        <sch:assert test="sum(//CCC) &lt; 0">under 0 result </sch:assert>
                    </sch:rule>
                </sch:pattern>
            </xs:appinfo>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="CCC" type="CCCType" maxOccurs="3"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="AAA">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="BBB"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

I'd like to raise the fact that the sum is equal to 0 but cannot catch it.
If you can help...

thanks

sam

__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.