1

1 - 2   [2]

XML Schema 2nd Edition

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.

Posted on Oct 30, 2004 at 15:43:10. [Comments for XML Schema 2nd Edition- 0]

XML Resume Test Drive

Also relates to Web Standards and Java

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 is

<!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.

Posted on Mar 01, 2004 at 05:15:57. [Comments for XML Resume Test Drive- 0]

Breadcrumbs Trail

[ Home ] -> TW Blog -> XML Schema
Site Map

The Severn Solutions website achieves the following standards:

[ XHTML 1.0 ] [ CSS 2 ] [ WAI AA ] [ Bobby AA ]

Page compiled in 0.005 seconds