printing entire tree with xgawk

This is a discussion on printing entire tree with xgawk within the awk forums in Programming Languages category; I seem to think that xgawk would be a good use for this, but I can't seem to get my brain around what I need to do. I have thousands of XML files that look like: <tag1 attrb="1"> <tag2 attrb2="1"/> <tag3 decision="Y"/> </tag1> I want to use xgawk to print the entire tree iff decision="y". I know how to find decision="Y" -- I just don't know how to back-track to print out the entire document at "tag1". Any ideas? -- mhostetl@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org...

Go Back   Application Development Forum > Programming Languages > awk

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-11-2008, 12:53 PM
Mike Hostetler
Guest
 
Default printing entire tree with xgawk

I seem to think that xgawk would be a good use for this, but I can't seem to get my brain around what I need to do.

I have thousands of XML files that look like:

<tag1 attrb="1">
<tag2 attrb2="1"/>
<tag3 decision="Y"/>
</tag1>

I want to use xgawk to print the entire tree iff decision="y". I know how to find decision="Y" -- I just don't know how to back-track to print out the entire document at "tag1".

Any ideas?

--
mhostetl@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Reply With Quote
  #2  
Old 08-11-2008, 02:03 PM
Manel Collado
Guest
 
Default Re: printing entire tree with xgawk

Mike Hostetler escribió:
> I seem to think that xgawk would be a good use for this, but I can't seem to get my brain around what I need to do.
>
> I have thousands of XML files that look like:
>
> <tag1 attrb="1">
> <tag2 attrb2="1"/>
> <tag3 decision="Y"/>
> </tag1>
>
> I want to use xgawk to print the entire tree iff decision="y". I know how to find decision="Y" -- I just don't know how to back-track to print out the entire document at "tag1".
>
> Any ideas?
>


Please try the xmltree library included in the xgawk distribution. It
automatically stores the whole XML tree and allows to do the desired
processing in the END rule. To print the whole tree just invoke:

XmlPrintNodeTree(1)

Regards.
Reply With Quote
  #3  
Old 08-11-2008, 02:37 PM
Mike Hostetler
Guest
 
Default Re: printing entire tree with xgawk

Manel Collado <m.collado@fi.upm.es> wrote:
> Please try the xmltree library included in the xgawk distribution. It
> automatically stores the whole XML tree and allows to do the desired
> processing in the END rule. To print the whole tree just invoke:
>
> XmlPrintNodeTree(1)


Yep, that did it.

Funny, I had your xgawk page open when I read this.

Thanks for the help.

--
mhostetl@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:28 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.