Custom, then, is the great guide of human lifeDavid Hume
Also relates to Java and XML Schema
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]
Also relates to Firefox and Co
Well it was once called Pheonix, but that feels like a distant ancestor of the newly released Firefox Browser this week. I decided to hold back the excitement a few days to let the server load ease off, and finally tried out Firefox yesterday.
Already much acclaim has been accredited to this, version 0.8 of the pre-release browser of the future, and I can only add further praise. The development team have clearly put a lot of preparation into this latest release, even down to the finer details like the slick new icons and advertising logos.
The benefits for development have already been raised on Stylish Scripting, suffice to say I am eternally grateful to finally see the DOM Inspector integral to the outfit.
For general browsing, the extensions just get better and better. A favourite of mine has always been the RSS Reader Panel, being very lightweight and quick and easy to get running. This is better than ever with a check for updates option, OPML import and export, stripping of HTML tags in the tooltip summary and the ability to load the feed in the content window with custom CSS. The RSS icon has even been dusted off to blend naturally with the other icons.
To be expected from a Mozilla based browser, Firefox has excellent support for Web Standards, and the inclusion of the Windows executable installer should make setup more accessible to the average user. I could probably ramble on indefinately about the finer features, but all I will say is if you are reading this blog and have not tried Firefox yet, you don't know what you are missing!
Posted on Feb 12, 2004 at 21:28:03. [Comments for Firefox Rises From The Ashes- 0]
Also relates to Java
Recently been testing the main XML parsing methods in Java a bit, giving me the chance to play around in Eclipse and broaden my Java and XML knowledge. Previously I have only really used the DOM parser in the Apache Xerces package, since this equates well to similar Javascript DOM coding for HTML documents.
While the DOM is an excellent choice for document manipulation, the event driven nature of SAX makes it an excellent choice for extracting particular information from a document.
This very simple code snippet shows the contents of a Class extending org.xml.sax.helpers.DefaultHandler to display the
level of nesting in an XML (or HTML) document, by utilising the Stack data structure.
private java.util.Stack stack = new java.util.Stack();
[.. snip ..]
public void startElement(
String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException {
if (stack.size() > 0)
{
short temp = (short)stack.size();
while (temp– > 0)
{
System.out.print("t");
}
}
System.out.println(localName);
stack.add(localName);
}
public void endElement(
String namespaceURI,
String localName,
String qName)
throws SAXException {
stack.pop();
}
JDOM also offers some interesting classes for XML
parsing with a more Java-centric approach. In particular the contributed
ResultSetBuilder Class in the org.jdom.contrib.input package offers a very concise API for
converting SQL data into an XML document.:
s = conn.createStatement();
rs = s.executeQuery(query);
ResultSetBuilder builder =
new ResultSetBuilder(rs,
"library", "book",
Namespace.getNamespace(namespace));
builder.setAsAttribute("isbn");
builder.setAsAttribute("format");
Document doc = builder.build();
XMLOutputter outp =
new XMLOutputter(" ", true);
outp.setTrimAllWhite(true);
outp.output(doc,
new FileOutputStream(fileID));
Posted on Nov 08, 2003 at 03:19:49. [Comments for XML Parsing Snippets- 0]
Also relates to XForms
XForm 1.0 and the accompanying XML Events have finally been released as W3C Recommendations.
XForms separate presentation and content, minimise round-trips to the server, offer device independence, and, using XML Events, reduce the need for scripting. Archive of W3C News in 2003
To get plenty of practice with this exciting technology, the latest version of Forms Player now claims to be fully conforming to the recommendation. This is an easy to install plug in for Internet Explorer, making it quick and lightweight relative to the X-Smiles Java Browser.
I have been working extensively on developing accessible web forms with standard XHTML, CSS, DOM and PHP recently. It will be interesting to see what hurdles, if any, this new offering creates.
Posted on Oct 15, 2003 at 04:43:49. [Comments for XForms Becomes A Recommendation- 0]
Also relates to Accessibility
In follow up to Andrew Sinclair's Accessibility Article I had a quick reccie of the Anglia Railways website, mentioned in the article for its recent receipt of the RNIB See It Right logo.
The W3C Validator failed the home page with 80 errors, many of which were associated with incorrect embedding of Flash objects in the page and entity errors in URL query strings, but also failure to close a few elements.
Bobby (an official part of the
RNIB audit) was equally less forgiving, picking up on absolute sizing at Level 2. Cynthia was equally unhappy with the use of the deprecated embed element. View the page in Mozilla and there is an immediate problem with the on and return labels. Blow
up the text 2 times and the page quickly become difficult to view.
So, what exactly does the RNIB See It Right campaign represent? Perhaps the Anglia Railways site passed the audit a week ago, but has changed since then. Or perhaps a few important accessibility issues are brushed under the table as not relevant to this specific audit - the errors are perhaps not relevant for screen readers and braille browsers? Well clearly, valid and well formed markup is of little importance, with the Audit guidelines page failing to supply a DOCTYPE!
Posted on Sep 19, 2003 at 13:31:52. [Comments for Does RNIB See It Right?- 1]