Re: [WebDNA] Re: parsing xml
This WebDNA talk-list message is from 2010
It keeps the original formatting.
numero = 105101
interpreted = N
texte = --00032555b2a2f4f64204828f7491Content-Type: text/plain; charset=UTF-8Tana,Hi - you need to use TCPconnect to pull down the feed and then parse the XMLfile based on the format of the returned feed. Here's a snippet I use topull a list of a user's sets from Flickr - it should give you a startingpoint at least.- Tom[!][/!][table name=flickrfix&fields=from,to]& &< <> >" "[/table][!]------------------------------------### Connect to Flickr and pull down set listing ###[/!][TCPConnect host=www.flickr.com&port=80][!][/!][text]xmlresponse=[TCPSend skipheader=T]GET/services/rest/?method=flickr.photosets.getList&api_key=[user_apikey]&user_id=[user_id]HTTP/1.0[UnURL]%0D%0A%0D%0A[/UnURL][/TCPSend][/text][!][/!][/TCPConnect][!][/!][xmlparse var=xml_var1][xmlresponse][/xmlparse][!]------------------------------------### Parse the XML ###[/!][xmlnodes ref=xml_var1&path=named:rsp][xmlnodes][!][/!][replacedb=../../data/db_imageminder/flickrSets.db&eqIDdatarq=[xmlnodeattributes][showif[index]=1][value][/showif][/xmlnodeattributes]&append=T][xmlnodeattributes][name]=[value]&[/xmlnodeattributes][xmlnodes][grepsearch=<([^>]*)>([^<]*)[^>]*>&replace=\1][content][/grep]=[url][convertwordstable=flickrfix][grepsearch=<([^>]*)>([^<]*)[^>]*>&replace=\2][content][/grep][/convertwords][/url]&[/xmlnodes][/replace][!][/!][/xmlnodes][/xmlnodes]--00032555b2a2f4f64204828f7491Content-Type: text/html; charset=UTF-8Content-Transfer-Encoding: quoted-printableTana,
Hi - you need to use TCPconnect to pull down the f=eed and then parse the XML file based on the format of the returned feed. ==C2=A0 Here's a snippet I use to pull a list of a user's sets from =Flickr - it should give you a starting point at least.
- Tom
[!]
[/!][table name=3Dflickrfix&fields=3Dfro=m,to]
&amp;&
<<
>>
""
[/table][!]
----------------------------=--------
### =C2=A0Connect to Flickr and pull down set listing =C2=A0###
[/!][text]xmlresponse=3D[T=CPSend skipheader=3DT]GET /services/rest/?method=3Dflickr.photosets.getList=&api_key=3D[user_apikey]&user_id=3D[user_id] HTTP/1.0[UnURL]%0D%0A%=0D%0A[/UnURL][/TCPSend][/text][!]
[/!][/TCPConnect][!]
[/!][xmlparse var=3Dxml_=var1][xmlresponse][/xmlparse][!]
------------=------------------------
### ==C2=A0Parse the XML =C2=A0###
[/!][xmlnodes ref=3D=xml_var1&path=3Dnamed:rsp][xmlnodes][!]
[/!][r=eplace db=3D../../data/db_imageminder/flickrSets.db&eqIDdatarq=3D[xmlno=deattributes][showif [index]=3D1][value][/showif][/xmlnodeattributes]&a=ppend=3DT][xmlnodeattributes][name]=3D[value]&[/xmlnodeattributes][xmln=odes][grep search=3D<([^>]*)>([^<]*)</[^>]*>&repla=ce=3D\1][content][/grep]=3D[url][convertwords table=3Dflickrfix][grep searc=h=3D<([^>]*)>([^<]*)</[^>]*>&replace=3D\2][content=][/grep][/convertwords][/url]&[/xmlnodes][/replace][!]
[/!][/xmlnodes][/xmlnodes]
--00032555b2a2f4f64204828f7491--
Associated Messages, from the most recent to the oldest:
--00032555b2a2f4f64204828f7491Content-Type: text/plain; charset=UTF-8Tana,Hi - you need to use TCPconnect to pull down the feed and then parse the XMLfile based on the format of the returned feed. Here's a snippet I use topull a list of a user's sets from Flickr - it should give you a startingpoint at least.- Tom
[!][/!][table name=flickrfix&fields=from,to]& &< <> >" "[/table]
[!]------------------------------------### Connect to Flickr and pull down set listing ###[/!][TCPConnect host=www.flickr.com&port=80]
[!][/!]
[text]xmlresponse=[TCPSend skipheader=T]GET/services/rest/?method=flickr.photosets.getList&api_key=[user_apikey]&user_id=[user_id]HTTP/1.0
[unurl]%0D%0A%0D%0A[/UnURL][/TCPSend][/text]
[!][/!][/TCPConnect]
[!][/!][xmlparse var=xml_var1][xmlresponse][/xmlparse]
[!]------------------------------------### Parse the XML ###[/!][xmlnodes ref=xml_var1&path=named:rsp]
[xmlnodes][!][/!][replacedb=../../data/db_imageminder/flickrSets.db&eqIDdatarq=[xmlnodeattributes][showif[index]=1][value][/showif][/xmlnodeattributes]&append=T][xmlnodeattributes][name]=[value]&[/xmlnodeattributes]
[xmlnodes][grepsearch=<([^>]*)>([^<]*)[^>]*>&replace=\1][content][/grep]=
[url][convertwordstable=flickrfix][grepsearch=<([^>]*)>([^<]*)[^>]*>&replace=\2][content][/grep][/convertwords][/url]&[/xmlnodes][/replace]
[!][/!][/xmlnodes][/xmlnodes]--00032555b2a2f4f64204828f7491Content-Type: text/html; charset=UTF-8Content-Transfer-Encoding: quoted-printableTana,
Hi - you need to use TCPconnect to pull down the f=eed and then parse the XML file based on the format of the returned feed. ==C2=A0 Here's a snippet I use to pull a list of a user's sets from =Flickr - it should give you a starting point at least.
- Tom
[/!][table name=3Dflickrfix&fields=3Dfro=m,to]
&amp;&
<<
>>
""
----------------------------=--------
### =C2=A0Connect to Flickr and pull down set listing =C2=A0###
[/!]
[text]xmlresponse=3D[T=CPSend skipheader=3DT]GET /services/rest/?method=3Dflickr.photosets.getList=&api_key=3D[user_apikey]&user_id=3D[user_id] HTTP/1.0
[unurl]%0D%0A%=0D%0A[/UnURL][/TCPSend][/text]
[!]
[/!][xmlparse var=3Dxml_=var1][xmlresponse][/xmlparse]
[!]
------------=------------------------
### ==C2=A0Parse the XML =C2=A0###
[/!][r=eplace db=3D../../data/db_imageminder/flickrSets.db&eqIDdatarq=3D[xmlno=deattributes][showif [index]=3D1][value][/showif][/xmlnodeattributes]&a=ppend=3DT][xmlnodeattributes][name]=3D[value]&[/xmlnodeattributes][xmln=odes][grep search=3D<([^>]*)>([^<]*)</[^>]*>&repla=ce=3D\1][content][/grep]=3D
[url][convertwords table=3Dflickrfix][grep searc=h=3D<([^>]*)>([^<]*)</[^>]*>&replace=3D\2][content=][/grep][/convertwords][/url]&[/xmlnodes][/replace]
[!]
[/!][/xmlnodes][/xmlnodes]
--00032555b2a2f4f64204828f7491--
Tom Duke
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Too Much Rootbeer Free Offer (1997)
Limit on nested [ShowIf]'s? (1997)
Not really WebCat (1997)
Help formatting search results w/ table (1997)
PIXO support (1997)
Separate SSL Server (1997)
Exclamation point (1997)
calculate age (2003)
Truncated value after space - refresh my memory.... (1997)
writing cart to db (1998)
Color (1997)
Announcing general availabilty of WebDNA 4.5 release (2002)
Req for code: upload and append to DB (2002)
[WebDNA] error installing 6.2 on ubuntu (2011)
Template Not Found (1998)
Multiple catalog databases and showcart (1997)
[WebDNA] END processing (2014)
Separate SSL Server (1997)
more trouble with [showif] in [search] = busted [shownext] - SOLVED (2000)
Separate SSL Server (1997)