I am trying to find out how to write XML search algorithm.
Following is the my File
<DUMMYROOT>
<root>Job Started</root>
<root>Job Running</root>
</DUMMYROOT>
and I want search string as <root>Job Started</root>
I should be able to supply inner level of nodes as a search string like
<DUMMYROOT><root1><root2><root3>STRINGTOSEARCH</root3></root2></root1></DUMMYROOT>
and my file may not the complete XML when I am applying my Search Algorithm.
Here’s something I wrote a few years ago that seems to fit reasonably well with what you’re looking for (though make no mistake, it is kind of ugly, and if the XML is really badly formed, it might run into a problem).
Normal use would be something like:
The “whole” parameter governs whether you’ve specified the “whole” tag, or whether it’s allowed to have attributes in addition to what you’ve specified (e.g.,
<tag>vs.<tag attribute = "value">).