I'm using DecisionSoft to validate my XML & schema files. I've been able to sort through all the errors & figure out what they mean except for these three:
Validation 8, 24 cvc-pattern-valid: Value '' is not facet-valid with respect to pattern '[A-Z]' for type 'MiddleInitialType'.
Validation 8, 24 cvc-type.3.1.3: The value '' of element 'middle' is not valid.
Validation 27, 12 cvc-complex-type.2.4.a: Invalid content was found starting with element 'author'. One of '{publishedDate}' is expected.
Any sort of help would be greatly appreciated!
4 replies to this topic
#1
Posted 17 April 2011 - 10:38 AM
|
|
|
#2
Posted 17 April 2011 - 11:05 AM
Without seeing what you actually have, it's hard to say. You may have middle initial defined as char(1), which means you CANNOT have an empty string, for example.
#3
Posted 17 April 2011 - 11:15 AM
I have it defined as string. Here's what I have:
<xsd:complexType name="AuthorType">
<xsd:sequence>
<xsd:element name="first" type="xsd:string"/>
<xsd:element name="middle" type="MiddleInitialType" minOccurs="0"/>
<xsd:element name="last" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="MiddleInitialType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z]"/>
<xsd:length value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="AuthorType">
<xsd:sequence>
<xsd:element name="first" type="xsd:string"/>
<xsd:element name="middle" type="MiddleInitialType" minOccurs="0"/>
<xsd:element name="last" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="MiddleInitialType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z]"/>
<xsd:length value="1"/>
</xsd:restriction>
</xsd:simpleType>
#4
Posted 17 April 2011 - 12:07 PM
You haven't posted everything. I don't see "author" or {publishedDate}
#5
Posted 17 April 2011 - 12:20 PM
I removed the pattern from middleInitial because it wasn't necessary which solved the middleInitial problem & changed Author to maxOccurs="unbounded" which solved the publishedDate problem. I think it was only expecting one author per book which made it confused when there was more than one author to a book instead of the publishedDate immediately after the first author. But the problems are solved now. Validation came back valid once I made those changes.
<xsd:complexType name="BookType">
<xsd:sequence>
<xsd:element name="title" type="TitleType"/>
<xsd:element name="edition" type="xsd:byte" minOccurs="0"/>
<xsd:element name="author" type="AuthorType" minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="publishedDate" type="PublishedDateType"/>
<xsd:element name="type" type="TypeType"/>
<xsd:element name="price" type="PriceType"/>
</xsd:sequence>
<xsd:attribute name="isbn" type="xsd:ID" use="required"/>
</xsd:complexType>
<xsd:complexType name="AuthorType">
<xsd:sequence>
<xsd:element name="first" type="xsd:string"/>
<xsd:element name="middle" type="MiddleInitialType" minOccurs="0"/>
<xsd:element name="last" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PublishedDateType">
<xsd:sequence>
<xsd:element name="month">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedByte">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="12"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="day">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedByte">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="31"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="year" type="xsd:gYear"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="MiddleInitialType">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="BookType">
<xsd:sequence>
<xsd:element name="title" type="TitleType"/>
<xsd:element name="edition" type="xsd:byte" minOccurs="0"/>
<xsd:element name="author" type="AuthorType" minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="publishedDate" type="PublishedDateType"/>
<xsd:element name="type" type="TypeType"/>
<xsd:element name="price" type="PriceType"/>
</xsd:sequence>
<xsd:attribute name="isbn" type="xsd:ID" use="required"/>
</xsd:complexType>
<xsd:complexType name="AuthorType">
<xsd:sequence>
<xsd:element name="first" type="xsd:string"/>
<xsd:element name="middle" type="MiddleInitialType" minOccurs="0"/>
<xsd:element name="last" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PublishedDateType">
<xsd:sequence>
<xsd:element name="month">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedByte">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="12"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="day">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedByte">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="31"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="year" type="xsd:gYear"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="MiddleInitialType">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









