Retrieve content by string parameter in XML DOM



I wonder if there is an already existing system out there that does the following:


Consider a well-formed XML document:



<?xml version="1.0" encoding="UTF-8"?>


<root>
<test>
<name>Test</name>
<complex>
<value>Hello</value>
</complex>
</test>
</root>


Now what I want to do is retrieve "Hello" for example like this:



aSuitableClass.getString("test.complex.value");


I have made a small library that does this for JSON but I want to know if there is something like this for XML already out there. I know of XPath but that's not what I want because it uses "/" and so on.


If I had to make this myself I would assume DOM is the easiest for this as it is already in a tree structure. I would just have to create a string mapping.


No comments:

Post a Comment