Saturday, June 21, 2008

XML tools for Eclipse

I was searching for some freeware tools for authoring XML and XSD documents. But my bad search inputs didn't return any good results.

So I planned out to create this tooling myself. I decided to use Eclipse as the platform for this, as it is quite robust and very popular.

After few days of effort, I ended up with a very basic prototype. The details are available at, http://gandhimukul.tripod.com/xml/xmleclipse.html. But still lot of work needs to be done on this code base to make it really useful for XML developers, particularly the content assist functionality which is presently missing.

I posted my thoughts about this on xml-dev list.

Dave Carver on xml-dev list suggested to me that there already exists such a tooling. It's the "Web Tools Platform (WTP)" for Eclipse.

I gave WTP a try. Personally speaking, I found it very good. It already has lot's of things that I need in XML GUI tools. Moreover, it's free and open source.

I have now kept WTP in my toolset to author XML, XSD and DTD documents. If required, I might try to tweak it's source code to do something new.

Tuesday, June 10, 2008

self axis vs .

Andrew Welch started a nice discussion about comparison of XPath's self axis vs ., on xsl-list.

Andrew wrote that he has seen people writing self::elem//whatever instead of .//whatever.

I looked at the XPath 2.0 spec to find the relevant definitions. Below are the definitions from the XPath 2.0 spec.

<quote>
the self axis contains just the context node itself

. is known as, "context item expression".
A context item expression evaluates to the context item, which may be either a node (as in the expression fn:doc("bib.xml")/books/book[fn:count(./author)>1]) or an atomic value (as in the expression (1 to 100)[. mod 5 eq 0]).

The context item is the item currently being processed. An item is either an atomic value or a node. When the context item is a node, it can also be referred to as the context node.
</quote>

Wendell Piez wrote,

It also works to test whether the current node is actually an 'elem' when you process it or traverse from it.

Mukul: I personally prefer the style, .//whatever as it is shorter. But I think, there are important use cases for using the self:: axis.

Like for e.g.,

<xsl:template match="*[not(self::elem)]">
<!-- do something -->
</xsl:template>


<xsl:template match="*">
<xsl:if test="not(self::elem)">
<!-- do something -->
</xsl:if>
</xsl:template>


Vyacheslav Sedov wrote,

In XSLT 2.0 I prefer to use "* except elem".