On Mon, 10 Dec 2001, Jon Baer wrote:

> Hi,
> 
> Im trying to "reapply" Jaxen to a current research project and Im trying
> to figure out if XPath can accomplish this to begin with.  What Im
> trying to do is apply a DOM to a sentence structure with a 10mb XML file
> as such:
> 
> <p>I LIKE CARS</p>
> <p>I HATE CARS</p>
> <p>I LIKE *</p>
> 
> Id liken the path to something like /root/I/LIKE/CARS or such but is
> there an easy way to treat the contents of the element as path nodes?  I
> hope Im not sounding confusing.  Maybe Im just looking for the right
> XPath formula to use here?

You know...

You could always create your own object-model for representation of these
(HashMaps might work), and then a Navigator to walk them with XPaths.

You'd only have to implement the axes you really care about, in this case,
only the child:: axis.

Your OM might be something as simple as

        Map i = new HashMap();

        Map like = new HashMap();
        Map hate = new HashMap();

        i.put( "like", like );
        i.put( "hate", hate );

        like.put ( "cars", Boolean.TRUE );
        like.put ( "*", Boolean.TRUE );
        hate.put ( "cars", Boolean.TRUE );

Of course, just use a StringTokenizer to construct the trail of
Maps, possibly.

Your navigator would implement getChildAxisIterator(Object obj)
basically as

        return ((Map)obj).values().iterator();

Just a thought...

        -bob


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to