[jdom-interest] XPath XMLOutputter Context Results in HTML

Andrew Rapp alrapp at yahoo.com
Thu Apr 20 12:11:17 PDT 2006


I'm interested in building a simple webapp to that will evaluate xpath expressions and return the results in HTML.  The tricky part is that I'd like to highlight the result nodes in context of the source document.  For example, if I have an XML document that looks like

<?xml version="1.0" encoding="UTF-8"?>
<a>
    <b>
        <c>
            <d/>
        </c>
    </b>
</a>

and I execute the xpath expression "//d/ancestor::*", I would like to display the results in HTML as follows:

<strong>&lt; a &gt; </strong>
    <strong>&lt; b &gt; </strong>
        <strong>&lt; c &gt; </strong>
           &lt; d &gt;
        <strong>&lt; /c &gt; </strong>
    <strong>&lt; /b &gt; </strong>
<strong>&lt; /a &gt; </strong>

I started writing my own JDOM XMLOutputter to highlight the result nodes but I'd rather avoid this effort, especially if someone else has already solved this problem.  I'd appreciate any insight on this.  Thanks.

-Andrew

  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20060420/5595db19/attachment.htm


More information about the jdom-interest mailing list