If you look at the wiki page documenting the "sax" XML-parser addon -
http://www.jsoftware.com/jwiki/Addons/xml/sax - you'll see that the first
example defines a global "L" which tracks how many levels deep you are.

On 9/10/08, Raul Miller <[EMAIL PROTECTED]> wrote:
>
> On Wed, Sep 10, 2008 at 2:38 PM, Chito Jovellanos <[EMAIL PROTECTED]>
> wrote:
> > Does anyone have the elements for a utility that measures the 'depth' of
> a
> > field tag eg, given an XML doc sample?
>
>
> Assuming you have well formed xml, you could do something like this:
>
> tag0=: I.'<' = xml
> tag1=: I.'>'= xml
> end0=: ('!'=xml{~1+tag0) +. '/'=xml{~_1+tag1
> end1=: '/'=xml{~1+tag0
> adj=: 1 - end0 + 2*end1
>
> level=: +/\adj
>
> --
>
> Raul
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to