Thursday, July 7, 2011

Bugfix to the xpath generator.

A user was kind enough to point out that when generating xpath for list items the xpath was generated wrong. It started at index 0 instead of 1. This is fixed.

Before when generating xpaths for this xml


<root>
  <list>
    <listitem>1</listitem>
    <listitem>2</listitem>
  </list>
</root>


The first item would result in this xpath.

/root/list/listitem[0]/text()

But now it is like this.

/root/list//listitem[1]/text()

As it should be. =)

Automatic xpath generation

Another feature xmltoolbox has is the ability to automaticly generate xpaths. The tool can be found here xmltoolbox.appspot.com/index.html

If you have an xml that looks like this.


<root>
  <firstchild>content</firstchild>
  <list>
    <listitem>first list item</listitem>
    <listitem>second list item</listitem>
  </list>
</root>

Then you click on the element, attribute or text you want the xpath generated for. For instance if you click on content you will get this xpath.

/root/firstchild/text()

If you click on the first and second list item you will get theese values.
/root/list/listitem[1]/text()
/root/list/listitem[2]/text()

XmlToolBox - Formatting xml.

Hi.

The most used feature for XmlToolBox is the format xml.

To use it go to xmltoolbox.appspot.com/index.html and in the big text area add the xml you need formattet. If you for example add

<rootelement><firstchild>content</firstchild></rootelement>

And press format xml.

It will be formattet like this.

<rootelement>
  <firstchild>content</firstchild>
</rootelement>

It makes it a bit more readable.

Kind regards.
Ole Bille