Jump to content

forthekill

Members
  • Content Count

    3
  • Joined

  • Last visited

Everything posted by forthekill

  1. Does anyone know of a place where the pattern restriction is explained in a manner that makes sense? Everything I've seen so far talks about real simple patterns, but doesn't really explain how to use the expressions.
  2. Your XML file should validate against this schema. You may need to change the minOccurs and maxOccurs of the Answer element, depending on if that's how many times that element appears in every XML file. <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <!-- Simple types --> <xs:simpleType name="nameType"> <xs:restriction base="xs:string"/> </xs:simpleType> <!-- Complex types --> <xs:complexType name="tocNodeType"> <xs:sequence> <xs:element name="PackageName" type="xs:string"/> <xs:element name="NodeName" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="textType"> <xs:sequence> <xs:element name="name" type="nameType"/> <xs:element name="TextData" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="answerType"> <xs:sequence> <xs:element name="Text" type="textType"/> </xs:sequence> <xs:attribute name="correct" type="xs:boolean"/> </xs:complexType> <xs:complexType name="questionType"> <xs:sequence> <xs:element name="Text" type="textType" maxOccurs="2"/> <xs:element name="Answer" type="answerType" minOccurs="2" maxOccurs="2"/> </xs:sequence> </xs:complexType> <xs:complexType name="quizType"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="Question" type="questionType"/> </xs:sequence> </xs:complexType> <!-- Main complex type --> <xs:complexType name="assetType"> <xs:sequence> <xs:element name="TOCNode" type="tocNodeType"/> <xs:element name="Text" type="textType"/> <xs:element name="Quiz" type="quizType"/> </xs:sequence> </xs:complexType> <!-- Root element --> <xs:element name="Assets" type="assetType"/></xs:schema>
  3. I want to specify a type as being an array of values, all comma seperated.The first number x in the array is the number of pairs of points.Then, there will be x number of pairs (the numbers in each pair cannot exceed 10000), with a maximum of 500 pairs.For example, the array might read:4,100,100,25,100,30,30,254,200I am having trouble figuring out the correct pattern for validation.So far I have:pattern value ="[0-10000]{1}(,[1-10000],[1-10000]{1,500})?"but that doesn't seem to work. I know it isn't quite right but I can't quite decipher the specification explanation of the pattern restriction to make it work.Also, if the tag was blank, it must also be a valid value.Can anyone help?
×
×
  • Create New...