Warning: Cannot modify header information - headers already sent by (output started at /var/www/ramskovsressourcer.dk/public_html/it/xml/index.php:1) in /var/www/ramskovsressourcer.dk/public_html/struktur.php on line 28
Ramskov's Resources - XML tools
Saturn
Ramskov's Resources
Information Teaching Software Math. history

Software for XML tools

This page consists of links to (free) sofware to handle XML tools (XML documents, XML Schema, DTD, XPath, etc) in a quick and easy way. Newer tools may have appeared during the last 5 years, which have not been considered below.

XML documents (editing and well-formedness)

Any text editor will work for editing XML documents and many have syntax highlighting and/or automatical formatting by indentation.

  • Editing XML documents is very easy in the free Visual Studio Express Edition, because it has syntax highlighting and intellisense, which will automatically add the end element, when the start element has been entered. Simultaneously with your entering it also checks if the XML document is well-formed (it is also able to validate the document, see the section on DTD and XML Schema below).
  • Well-formedness can be checked by opening the file in any modern browser. If the document is well-formed, then the content will be displayed, and else an error message will appear.
    W3Schools has an online syntax checker, which checks if the document is well-formed XML.

DTD and XML Schema

My favourite program is again Visual Studio Express Edition because

  • it has syntax highlighting, syntax checking and intellisense, when the schema-element with the correct namespace is entered. Intellisense shows the possible elements or attributes which are legal to enter.
  • it can check if a XML document is valid according to a XML Schema if both are opened and the XML document contains a reference to the XML Schema, i.e. the root element is like:
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schemafile.xsd">
    or
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="targetnamespace schemafile.xsd">
    where schemafile.xsd is the XML Schema and targetnamespace is the targetnamespace in the XML Schema if it is not empty.
  • it can check if a XML document is valid according to a Document Type Definition (DTD) if both are opened and the XML document contains a reference to the DTD, i.e. if the DTD is the file doctype.dtd:
    <!DOCTYPE root SYSTEM "doctype.dtd">
  • it can produce a XML Schema from the XML document.

NetBeans is able to do the same things, and furthermore it can from a XML document produce a DTD so the XML document is valid according to the DTD.

A very useful online service for validating a XML document against a XML Schema is the CoreFiling website, where you can upload a XML document and a XML Schema and the site will check if the XML is well-formed and whether it is valid according to the XML Schema.

XPath and XQuery

I do not know about an editor or tool which are able to syntax check XPath or XQuery expressions. XPath 2.0 is a subset of XQuery 1.0, so it is enough to have a tool for the latter. I recommend the following tool:

  • Evaluating XPath and XQuery expressions can be done with the Saxon package. The Home Edition (HE) is open source. It is available in Java and .NET. If you are using it as an command line tool, then the .NET tools are straight forward, if you have installed .NET version 2.0 or later. Unzip the package and go the bin subfolder. From the command prompt the executable Query.exe evaluates the XQuery expression in the file xquery.xq on the XML document xmldoc.xml and sends the output to the file output.xml by the command:
    Query.exe -q:xquery.xq -s:xmldoc.xml -o:output.xml
    Leaving out the output file will display the result in the command window.

XSL Transformation

XSLT exists in version 1.0 and 2.0, and it seems like version 2.0 is not so widespread yet (2009).

  • Performing a XSL Transformation in browsers. It is possible to do that in all modern browsers if you open the XML document and it contains a processing-instruction to the XSL Transformation. If the XSLT file is transf.xsl then the XML document have to include the following line in the top after the XML declaration:
    <?xml-stylesheet type="text/xsl" href="transf.xsl"?>
    However, Firefox 3.5 and Internet Explorer 8 only support XSLT 1.0.
  • Performing a XSL Transformation can be done with the Saxon package and it even supports XSLT 2.0. After installing it as described above in the section on XPath and XQuery a transformation transf.xsl can be applied to the XML document xmldoc.xml by the command:
    Transformation.exe -xsl:xquery.xq -s:xmldoc.xml -o:output.xml
    Leaving out the output file will display the result in the command window.
  • NetBeans is able to perfom a XSL transformation if you open the XSL file and XML document. However, it only supports XLST 1.0.
  • Editing a XSL file is recommended in Visual Studio Express Edition which has syntax highlighting, syntax check and intellisense (if the correct namespace is included), which is very helpful. However, it only supports XSLT version 1.0. The professional version of Visual Studio is also able to apply a XSLT on a XML file.
© Kurt Ramskov - the page was last revised at 10/31/2016