Main

XML Archives

February 17, 2003

Why is XML Authoring so hard?

Here is a brief account of my XML authoring adventure:

Last week I wanted to author a document that looked like a W3C specification, and which separated the content (a XML file) from the presentation (an XSL file). As I usually do, I started with an existing W3C document, http://www.w3.org/TR/2003/WD-wsdl12-20030124/wsdl12.xml and existing stylesheet http://www.w3.org/TR/2003/WD-wsdl12-20030124/xmlspec-wsdl.xsl and made the appropriate modifications using my favorite text editor TextPad. I used MS IE6.0 to view the transformed document, after every paragraph. This would not only show the transformed HTML document with intended look and feel but would also catch silly mistakes (like omission of </p> tag).

This worked okay for a while but soon I got weary of switching between TextPad and IE. Kept wondering that there got to be a better way to create such documents. May be there are XML authoring tools out there.

Search for such tools led me to two promising products: an open source XML edior called Xopus and a commercial product called Authentic from Altova, makers of XMLSPY.

Xopus, a JavaScript based browser based product, appeared quite promising, to start with. However, I ran into problems pretty soon. The demo at their web-site ran fine but it won't work from my filesystem. After digging a bit, I found out that the demo files have to be served over an HTTP connection. Arranged for this by setting up a Tomcat server and moving Xopus files in the document directory. But now, the modified documents won't get saved. Found out that the backend (Tomcat server in this case) has to accept the modified XML document. No information on how to do this. Tried to modify the configuration the Tomcat servlet responsible for serving files to making read-only parameter as false. No luck. Also learn't that the original authors are pulling out from open source version. Enough for me to move away from Xopus !!

Authentic (part of XMLSPY product family) looked more promising, partly because it had a $100.00 plus price tag and partly due to snazzy looking screen shots. Installed an eval copy on my local machine and started playing around. However, my excitement was short-lived. Pretty soon I learn't that it worked okay for pre-packaged stylesheets, compiled into some internal format known as .sps format. Use of an external stylesheet required used of a Stylesheet Designer. My attempts to find this, either within Authentic or at Altova's (company that sells Authentic) web site, produced no results !!

I had spent more than 6 hours and no luck !!

Perhaps I should make the switch to emacs and Ovidiu's xslt-process !! However, given my multiple (failed) attempts to switch to emacs, that will have to wait for another day.

For the time being, I am back to where I had started -- TextPad and IE. They work just fine and don't put artificial restrictions on what I can do.

June 11, 2003

XML Editing -- Rescued by TextPad

My travails with XML editing are not new. So, this time when I had to convert a fairly good size MS-WORD document into an XML document as per the DTD used by W3C specifications, I did another Google search for an appropriate tool.

Came across XEE from XMLMind. Looked promising at the high level, but failed miserably at what I wanted to do. Apparently it works only with CSS and not with XSL styles documents. And my document used an XSL stylesheet to transform the input document into XHTML.

What I was really looking for was the ability to select a piece of text and then place this text within a specified start and end element tag -- all with minimum number of key-strokes. Assuming a tag word of 8 characters, an explicit typing was taking (1+8+1+2+8+1=)21 keystrokes. With cut-n-paste, I was able to reduce it to 4 plus signficant mouse movements. This was okay but not what I was looking for.

I started looking at the help topics of my favourite editor TextPad and found that it has the capability of maintaining user defined book clippings. This capability allows defining short cuts to place any kind of scaffolding around a selected text. This is what I was looking for.

I created a clippings book for my commonly used tags and now can place a pair of tags with just 2 key-strokes! Not only this, I have the complete list of tags in front of my eyes.

June 12, 2003

Using SAXON to apply XSL transform

Everytime I need this functionality, I endup spending atleast 10 minutes fumbling with the SAXON documentation to get the right command. I guess, I would do myself a service by having it as a weblog entry.

Assume that you have an XML file with appropriate xml-stylesheet PI and stylesheet to convert it into an XHTML document. The input document would look like:
inpfile.xml
=======

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification V2.2//EN" "xmlspec.dtd">
<?xml-stylesheet type='text/xsl' href='ws-spec.xsl' ?>
... Rest of the document ...

You can get the transofrmed document by issuing the command:

c:\>java -jar %SAXONDIR%\saxon.jar -a inpfile.xml > outfile.html

Here env. var. SAXONDIR points to the installation directory of SAXON (ex: c:\saxon-6.5.2)

January 14, 2004

Pretty Good Tutorial on XPath ...

Came across this presentation while searching for info on xpath expressions. Found it pretty good. It covers details on handling xpath expressions for document with namespaces -- something that is missing from this tutorial (first entry in Google search for "xpath tutorial").

About XML

This page contains an archive of all entries posted to Pankaj Kumar's Weblog in the XML category. They are listed from oldest to newest.

Windows is the previous category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33