Newsgroups: comp.lang.awk
From: "Jan Weber" <ja...@web.de>
Date: Tue, 19 Jul 2005 11:08:57 +0200
Local: Tues, Jul 19 2005 5:08 am
Subject: Re: XML parsing with awk - getXML.awk
I'm also thinking about a function putXML(), but i am not sure with the interface. I thought about something like this: function putXML( file, xtype_or_xnode, xitem, xattr ) { } or (currently my favorite): function putXML( file, xnode ) { } or even function putXML( file, flagUseXNODE ) { } with the last two versions it would be possible to write code like this: # Example: increment the attribute named "bar" in all elements named "foo" } And this would finally be "XML processing with AWK" instead of just parsing ;-) Comments are welcome. Regards, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.awk
From: "Jan Weber" <ja...@web.de>
Date: Tue, 19 Jul 2005 11:20:36 +0200
Local: Tues, Jul 19 2005 5:20 am
Subject: Re: XML parsing with awk - getXML.awk
Example corrected: # Example: increment the attribute named "bar" in all elements named "foo" You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.awk
From: Jürgen Kahrs <Juergen.Kahrs_DELETET...@vr-web.de>
Date: Sat, 23 Jul 2005 20:48:31 +0200
Local: Sat, Jul 23 2005 2:48 pm
Subject: Re: XML parsing with awk - getXML.awk
Jan Weber wrote: Good idea. Last year, Manuel Collado and Stefan Tramm > I'm also thinking about a function putXML(), but i am not sure with the > interface. told me that there is an interesting Perl solution for this problem. > And this would finally be "XML processing with AWK" instead of just Indeed. Keep us posted about your advances. > parsing ;-) And be prepared to write a chapter about it in our manual. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.awk
From: "Jan Weber" <ja...@web.de>
Date: Sun, 24 Jul 2005 16:58:59 +0200
Local: Sun, Jul 24 2005 10:58 am
Subject: Re: XML parsing with awk - getXML.awk
On Sat, 23 Jul 2005 20:48:31 +0200, Jürgen Kahrs <Juergen.Kahrs_DELETET...@vr-web.de> wrote: Can you give more information about the "interesting" part of this > Jan Weber wrote: >> I'm also thinking about a function putXML(), but i am not sure with the > Good idea. Last year, Manuel Collado and Stefan Tramm solution, maybe a link or a short explanation? >> And this would finally be "XML processing with AWK" instead of just I will do, but maybe it will take a while, as I currently have >> parsing ;-) > Indeed. Keep us posted about your advances. no need for such script. > And be prepared to write a chapter about it I think about it. > in our manual. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.awk
From: Jürgen Kahrs <Juergen.Kahrs_DELETET...@vr-web.de>
Date: Sun, 24 Jul 2005 22:10:37 +0200
Local: Sun, Jul 24 2005 4:10 pm
Subject: Re: XML parsing with awk - getXML.awk
Jan Weber wrote: The interesting part of it was some functions >> Good idea. Last year, Manuel Collado and Stefan Tramm >> told me that there is an interesting Perl solution for >> this problem. > Can you give more information about the "interesting" part of this for assembling the textual output. For example one function surrounded the text to be printed with markup tags and attributes. I'm sorry thet I cant remember the name of the Perl module. Maybe someone else (Manuel, Stefan, Andrew) can help with details ? You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.awk
From: Manuel Collado <m.coll...@lml.ls.fi.upm.es>
Date: Tue, 26 Jul 2005 12:27:37 +0200
Local: Tues, Jul 26 2005 6:27 am
Subject: Re: XML parsing with awk - getXML.awk
Jürgen Kahrs escribió:
Here is the code I wrote for this purpose: -----X--------------------------- # generate the string for a XML attribute, with a leading space: } # generate the string for starting element tags # - several ">" delimited tags may be specified # - every tag can include attributes # example: 'one att="val">two>three' # generates: '<one att="val"><two><three>' function xse( tags, n, t, k, s ) { n = split( tags, t, ">" ) s = "" for (k=1; k<=n; k++) { s = s "<" t[k] ">" } return s } # generate the string for ending element tags, like xse, but # - in reverse order # - trimm attributes function xee( tags, n, t, k, s ) { #print "---" tags n = split( tags, t, ">" ) s = "" for (k=n; k>=1; k--) { #print k "--" t[k] if (index(t[k], " ")) { s = s "</" substr(t[k], 1, index(t[k], " ")-1) ">" } else { s = s "</" t[k] ">" } } return s } # generate the string for a full xml element, combine xse and xee function xml( tags, content ) { return xse(tags) content xee(tags) } # generate the string for a processing instruction function xpi( pi ) { return "<?" pi "?>" } # generate the string for a simple DOCTYPE declaration function doctype( root, public, url ) { if (public) { return "<!DOCTYPE " root " PUBLIC " public " " url " >" } else { return "<!DOCTYPE " root " SYSTEM " url " >" } } # generate the string for a stylesheet processing instruction # (type = css/xsl) function xss( type, url ) { return xpi( "xsl-stylesheet" attr("type", "text/" type) attr("href", url) ) } # generate the string for a XML comment function xcomment( comment ) { return "<!-- " comment " -->" } -----X--------------------------- Regards, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.awk
From: "Jan Weber" <ja...@web.de>
Date: Wed, 27 Jul 2005 00:52:04 +0200
Local: Tues, Jul 26 2005 6:52 pm
Subject: Re: XML parsing with awk - getXML.awk
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2009 Google |