Out of the crooked timber of humanity no straight thing can ever be madeImmanuel Kant
1 - 2 
This post does not relate to any other topics
The second edition of XML Schema has becoma a candidate recommendation, with corrections from the first edition. For anyone taking their first steps into XML Schema, Roger Costello's excellent Powerpoint tutorial and collection of resources on XFront are a great place to start.
The Sourceforge project XML Resume is an excellent tool for compiling a resume quickly in different formats (although I find the current document type definition slightly limited). It is well packaged and quick, and easy, to configure and run the examples with the Make utility, also offering some convenient filtering features. Unfortunately however, my personal resume was reluctant to build, with Xalan returning an ArrayIndexOutOfBounds exception.
Once I broke the XML instance apart, the error was soon tracked down. Using
XML Spy to create the instance, I had inadvertantly left empty values
in a couple of the
level attributes for
skill content. Since the attribute-list declaration in the DTD
<!ATTLIST skill level CDATA #IMPLIED>
the instance still validated, so I missed the error.
One resolution is to wrap the contents of the XSLT template for
skill/@level within another conditional statement
that tests the length of the attribute value.
<xsl:template match="skill/@level"> <strong><xsl:if test="string-length() > 0"></strong> […] <strong></xsl:if></strong> </xsl:template>
However, this burden shouldn't fall to the transformation file, since it is the role of the Schema/DTD to define the contract for the instance. DTD syntax has no means to prevent this error, while in XML Schema it is simply a matter of defining a custom simple type.
<xsd:simpleType name="nonZeroString"> <xsd:restriction base="xsd:string"> <xsd:pattern value="\w.*"/> </xsd:restriction> </xsd:simpleType>
In this example the pattern facet requires the attribute value to be at least one word character. The facet
<xsd:minLength value="1"/> serves the same
purpose sans regular expressions. An XML Schema shell has recently been posted in the project's forum.
[ Back To Top ]
Copyright © 2002-2017 Severn Solutions.