[XML-SIG] XSV string length checking

Andrew Maclean andyjmaclean at hotmail.com
Tue Feb 10 08:01:15 EST 2004


Dear All,

I've come across an error running XSV and I was wondering if I could have an 
opinion.  Basically, it doesn't seem to enforce restrictions on the length 
of string values.

The output tells me that it's being "strict", but I put supply a zero-length 
string in the test xml file.

Below are the source XSD, XML and output files:

////////////////////////////////////////////////////////////////////////////////
XSD

<?xml version='1.0'?>
<xsd:schema
        targetNamespace     ='file:///C:/IntercalibrationSchema/ZopeServer'
                  xmlns     ='file:///C:/IntercalibrationSchema/ZopeServer'
                  xmlns:xsd ='http://www.w3.org/2001/XMLSchema'
  elementFormDefault="qualified" attributeFormDefault="unqualified">


  <xsd:element name="IntercalibrationSite" type="IntercalibrationSiteType"/>

  <xsd:complexType name="IntercalibrationSiteType">
    <xsd:sequence>
      <xsd:element name="ClassificationCriteria" 
type="ClassificationCriteriaType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ClassificationCriteriaType">
    <xsd:sequence>
      <xsd:element name="QualityStatus"        type="QualityStatusType"/>
      <xsd:element name="WFDAssessment"        type="YesNoType"/>
      <xsd:element name="ClassificationMethod" 
type="PopulatedString250Type"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:simpleType name="QualityStatusType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="HG"/>
      <xsd:enumeration value="GM"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="YesNoType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="y"/>
      <xsd:enumeration value="n"/>
      <xsd:enumeration value="Y"/>
      <xsd:enumeration value="N"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="PopulatedString250Type">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="200"/>
      <xsd:maxLength value="250"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>

//////////////////////////////////////////////////////////////////////////////////
XML

<?xml version='1.0'?>
<IntercalibrationSite
  xmlns="file:///C:/IntercalibrationSchema/ZopeServer"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="file:///C:/IntercalibrationSchema/ZopeServer
                      
file:///C:/IntercalibrationSchema/ZopeServer/demo.xsd">
  <ClassificationCriteria>
    <QualityStatus>HG</QualityStatus>
    
<WFDAssessment>Y</WFDAssessment><ClassificationMethod></ClassificationMethod></ClassificationCriteria>
</IntercalibrationSite>


//////////////////////////////////////////////////////////////////////////////////////////
OUTPUT

<xsv xmlns="http://www.w3.org/2000/05/xsv" 
docElt="{file:///C:/IntercalibrationSchema/ZopeServer}IntercalibrationSite" 
instanceAssessed="true" instanceErrors="0" 
rootType="{file:///C:/IntercalibrationSchema/ZopeServer}:IntercalibrationSiteType" 
schemaDocs="file:///C:/IntercalibrationSchema/ZopeServer/demo.xsd" 
schemaErrors="0" schemaLocs="file:///C:/IntercalibrationSchema/ZopeServer -> 
file:///C:/IntercalibrationSchema/ZopeServer/demo.xsd" 
target="file:///C:/IntercalibrationSchema/ZopeServer/demo.xml" 
validation="strict" version="XSV 2.5-2 of 2003/07/09 
13:08:04"><schemaDocAttempt 
URI="file:///C:/IntercalibrationSchema/ZopeServer/demo.xsd" 
outcome="success" source="command line"/><schemaDocAttempt 
URI="file:///C:/IntercalibrationSchema/ZopeServer/demo.xsd" 
namespace="file:///C:/IntercalibrationSchema/ZopeServer" outcome="redundant" 
source="schemaLoc"/></xsv>

////////////////////////////////////////////////////////////////////////

Other checks work, and I get the "element content failed type check..." if I 
try and put something strange into the <WFDAssessment> tag.  String lengths 
aren't being checked though.
Thank you,

Mr Andrew Maclean

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger




More information about the XML-SIG mailing list