1 | 2

1 - 5   [6]

XML Resume Test Drive

Also relates to Web Standards 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


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>

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.*"/>

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]

XML Parsing Snippets

Also relates to Web Standards

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)
public void endElement(
  String namespaceURI,
  String localName,
  String qName)
	throws SAXException {

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", 
Document doc = builder.build();

XMLOutputter outp =
  new XMLOutputter("  ", true);
	new FileOutputStream(fileID));	

Posted on Nov 08, 2003 at 03:19:49. [Comments for XML Parsing Snippets- 0]

The J-Bay Of J-Editors

Also relates to IDEs

Ok, have played around with Eclipse this weekend, and I am totally converted. All the IDEs I had tried up till now have been removed from my system, and Eclipse has become my only Java editor. It is superb! The features are just too many to list right now, but with realtime tool tips from the JavaDoc and source file, error checking, advanced file compare and rollback and auto-compile on save (to name a few) my personal Java development is coming along rapidly. And that is in only 36 hours! The interface is crisp, the icons are visually pleasing and instructive and the well documented start-up tutorial got me up and running in no time with workspaces, perspectives and views. Creating custom classpaths to the Open Office API and MySQL Bridge was a breeze. And if all this wasn't enough to get me excited, the quick fix feature put the icing on the cake.

Massive respect to the team that dedicate their time to develop this Open Source project. Maybe once I have a real feel for the system, I will have a look at a few of the plugins for PHP, Perl, XML and SQL. Even try and get involved when I can find the time. The Point Break of non-commercial/low-budget Java IDEs!

Posted on Sep 14, 2003 at 17:45:13. [Comments for The J-Bay Of J-Editors- 0]

Java Editors

Also relates to IDEs

I seem to have been through a multitude of IDEs the last couple of years, with each one bringing benefits that the one before may have lacked. For quite a while my preferred environment was HTML-Kit with my emphasis on HTML, CSS and Javascript development.

When I started working professionally with PHP, I went for PHPEd which wasn't without its quirks, the worst being a repetitive run time error when debugging, which I (and NuSphere tech support) still haven't resolved now.

I found Style Master a beneficial tool when I was advancing my CSS knowledge, although it had a bad habit of draining my GDI resources considerably allowing me enough room to run only one browser concurrently - actually the latest release of Top Style looks pretty exciting, with added support for accessibility testing.

XML Spy was an absolute godsend, especially for learning XSD. However, once the trial expired I was reluctant to invest in a peculiar support system that expired on the same date regardless of when the product was purchased. Fortunately this has been changed with the latest release, XMLSpy 2004, and this IDE is high on my wishlist.

The last six months or so I have actually found myself doing most coding in UltraEdit, which I have found to be an efficient lightweight IDE with enough features to support my requirements and not overburdened (as my copy of HTML-Kit rapidly became) with superfluous extensions. I generally find myself using this for all XML, HTML, CSS, Javascript and PHP development. Some of the other languages, which I have really only trodden the surface with, Python, TCL/TK, Curl come with very useful IDEs as part of the development kit, or Vim/Emacs (a totally new world!) with regard to shell scripting within Cygwin..

However the one language I had never really quite found the right tool for at a low budget and lightweight was Java. Lack of quality autocomplete and class management in the IDEs I used elsewhere always let them down for Java development. Since I have being doing a few projects on the side recently with Apache Xerces and generally developing my Swing knowledge, I decided a few months ago a good Java IDE was essential. Well, I have tried a few. For a while I thought that JCreator was a good enough solution, however SitePad has edged past it with better class/package management and a more customisable interface through its inbuilt adoption of Javascript scripting tools. SitePad has a slightly steeper learning curve but I havent found this to be too much of a disadvantage. Also, the creator, Chet Murphy, was very prompt to reply and helpful when I contacted him with a few queries.

So, have I found my environment of choice? It appears not yet, since the other day I stumbled across the Eclipse Open Source project. Why I never found this earlier, I don't know, but this looks like it could be a different solution all together. Being a strong advocate of Open Source Software, and appreciating the advantage of not having to fork out the same expense everytime an upgrade occurs (or lose out), I therefore have an excuse to put the feet up tonight, catch up on fourty winks and wait for the colossal 66 megabytes of the SDK to ween their way down my phone line. Will report back with a verdict…

Posted on Sep 12, 2003 at 23:35:44. [Comments for Java Editors- 0]

Java/PHP Bridge

Also relates to PHP

This months PHP|Architect sample article gives a quick guide to Installing Java for PHP. The PHP manual suggest the method applied, of integrating Java into PHP, is not as stable as reversing the roles, and integrating PHP into a Java Servlet. All the same, finally get to use that Java DLL in the PHP extensions folder. Note the article does fail to emphasise that java.class.path must be quoted when including the path to custom classes, which did lead to a few minutes of hair tearing!

Posted on Sep 12, 2003 at 23:31:36. [Comments for Java/PHP Bridge- 2]

Breadcrumbs Trail

[ Home ] -> TW Blog -> Java
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