World: r3wp
[XML] xml related conversations
older newer | first last |
Gabriele 29-Jun-2009 [814x2] | why not either in o 'value? ? |
you can add value? to /local and then do either value?: in o 'value? [ ... get value?] | |
Graham 29-Jun-2009 [816x3] | I think I tried either 'value? = next first o but I couldn't figure out why that didn't work ... |
Your suggestion looks good :) | |
I did want to make sure that value? was the first member of the object | |
Gabriele 29-Jun-2009 [819] | i see, your problem was that next first o is a block. if you also want to make sure there's nothing else in the object (but then... why is it an object?), you could check [value?] = next first o or [self value?] = first o |
Graham 29-Jun-2009 [820] | It's an object because xml-to-object creates them that way :( |
Graham 5-Jul-2009 [821x2] | If xml-to-object meets a xml file with a number of elements with the same name, it creates a block of objects. |
so, this is an attempt to remedy this fix-object: func [obj [object!] /local o value? ] [ foreach element next first obj [ if object? o: get in obj element [ ; is object, so check to see if has value? either value?: in o 'value? [ set in obj element trim/head/tail get value? ] [ fix-object o ] ] if block? o [ foreach ob o [ fix-object ob ] ] ] ] | |
CharlesW 1-Aug-2009 [823x3] | Folks, I have gone through this forum with the hopes that I woul''nt bother you with a newb style question. I have been trying all sorts of different xml libraries (rebelxml.r, xml-parse.r, xml-object.r) as well as a few others I found. No matter what I do, I can't seem to pull the values I need. |
Here is the snipped of XMl: <?xml version="1.0"?> <xts:sports-content-set xmlns:xts="http://www.xmlteam.com"query-date-time="20090724T011802-0400" query-string="http://fod.xmlteam.com/api-trial/getDocuments?doc-ids=xt.9140271-box" hostname="fod.xmlteam.com" result-count="1" error-count="0" elapsed-time="64.2ms"><sports-content xmlns:str="java.lang.String" xmlns:dt="http://xsltsl.org/date-time" xmlns:xts="http://www.xmlteam.com"xmlns:exsl="http://exslt.org/common" path-id="baseball/l.mlb.com/event-summary/xt.9140271-box" xts:systemid="MLB_Boxscore_XML" xts:tsnid="9140271"> <sports-metadata xmlns:fs="java.io.File" date-time="20090323T193000-0400" doc-id="xt.9140271-box" xts:tsnslug="AAX%BOX-LOS-ANA" language="en-US" revision-id="l.mlb.com-2009-e.26882-event-stats-sportsnetwork.com" fixture-key="event-stats" document-class="event-summary" fixture-name="Box Score"> <sports-title>Boxscore: LA Angels vs. Los Angeles</sports-title> <sports-content-codes> <sports-content-code code-name="The Sports Network" code-key="sportsnetwork.com" code-type="publisher"/> <sports-content-code code-name="XML Team Solutions, Inc." code-key="xmlteam.com" code-type="distributor"/> <sports-content-code code-type="sport" code-key="15007000" code-name="Baseball"/> <sports-content-code code-type="league" code-key="l.mlb.com" code-name="Major League Baseball"/> <sports-content-code code-type="season-type" code-key="pre-season"/> <sports-content-code code-type="season" code-key="2009"/> <sports-content-code code-type="priority" code-key="normal"/> <sports-content-code code-type="conference" code-key="c.national" code-name="National"/> <sports-content-code code-type="conference" code-key="c.american" code-name="American"/> <sports-content-code code-type="team" code-key="l.mlb.com-t.11" code-name="Los Angeles Angels"/> <sports-content-code code-type="team" code-key="l.mlb.com-t.28" code-name="Los Angeles Dodgers"/> <sports-content-code code-type="action-listing" code-key="complete"/> </sports-content-codes> </sports-metadata> <sports-event xmlns:fs="java.io.File"> <event-metadata xmlns:xte="www.xmlteam.com/xte" date-coverage-type="event" event-key="l.mlb.com-2009-e.26882" date-coverage-value="l.mlb.com-2009-e.26882" event-status="post-event" duration="2:58" start-date-time="20090323T160500-0400" xts:game-of-day="1"> <sports-content-codes/> <event-metadata-baseball/> <site> <site-metadata> <home-location/> </site-metadata> <site-stats attendance="8704"/> </site> </event-metadata> <team> <team-metadata team-key="l.mlb.com-t.28" alignment="away"> <name first="Los Angeles" last="Dodgers"/> </team-metadata> <team-stats score="4" score-opposing="10" event-outcome="loss"> <sub-score period-value="1" score="1"/> <sub-score period-value="2" score="0"/> <sub-score period-value="3" score="0"/> <sub-score period-value="4" score="3"/> <sub-score period-value="5" score="0"/> <sub-score period-value="6" score="0"/> <sub-score period-value="7" score="0"/> <sub-score period-value="8" score="0"/> <sub-score period-value="9" score="0"/> <team-stats-baseball> <stats-baseball-offensive runs-scored="4" at-bats="36" hits="9" rbi="4" bases-on-balls="2" strikeouts="4" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="1" stolen-bases="1" stolen-bases-caught="1" hit-by-pitch="0" left-on-base="7"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> <stats-baseball-pitching runs-allowed="10" hits="13" earned-runs="10" bases-on-balls="6" strikeouts="8" era="10.000" balks="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" shutouts="0" games-complete="0" wins="0" losses="1"/> </team-stats-baseball> </team-stats> <player id="b.11965"> <player-metadata position-event="8" player-key="l.mlb.com-p.11965" status="starter"> <name first="Matt" last="Kemp"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="4" hits="1" rbi="2" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="1" hit-by-pitch="0" average=".271"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> | |
Using rebelxml.r I have tried: get-xml-data/content/with-attribute 'xts:sports-content-set/sports-content/sports-metadata/sports-content-codes '/sports-content-code/code-type "sport" and many variations of this statement. Using: obj-xml I have tried variations of obj-xml/document/xts-sports-content-set/sports-content/sports-metadata/sports-content-codes/sports-content-code/value? As an example I tried to pull out the league information but could not, However I was able to pull out the TITLE using obj-xml/document/xts-sports-content-set/sports-content/sports-metadata/ sports-title/value? Obviously, I am clueless, so if anyone can point me in the right direction for a well document library (Hopefully with examples) that would be great. Otherwise if there is something glaring that I am doing wrong, please let me know. Thanks, Charlie | |
Graham 1-Aug-2009 [826] | Rebol's open source xml parsers are not fully complete. Where is the full XML file that the fragment comes from? |
CharlesW 1-Aug-2009 [827x2] | I<?xml version="1.0"?> <xts:sports-content-set xmlns:xts="http://www.xmlteam.com"query-date-time="20090724T011802-0400" query-string="http://fod.xmlteam.com/api-trial/getDocuments?doc-ids=xt.9140271-box" hostname="fod.xmlteam.com" result-count="1" error-count="0" elapsed-time="64.2ms"><sports-content xmlns:str="java.lang.String" xmlns:dt="http://xsltsl.org/date-time" xmlns:xts="http://www.xmlteam.com"xmlns:exsl="http://exslt.org/common" path-id="baseball/l.mlb.com/event-summary/xt.9140271-box" xts:systemid="MLB_Boxscore_XML" xts:tsnid="9140271"> <sports-metadata xmlns:fs="java.io.File" date-time="20090323T193000-0400" doc-id="xt.9140271-box" xts:tsnslug="AAX%BOX-LOS-ANA" language="en-US" revision-id="l.mlb.com-2009-e.26882-event-stats-sportsnetwork.com" fixture-key="event-stats" document-class="event-summary" fixture-name="Box Score"> <sports-title>Boxscore: LA Angels vs. Los Angeles</sports-title> <sports-content-codes> <sports-content-code code-name="The Sports Network" code-key="sportsnetwork.com" code-type="publisher"/> <sports-content-code code-name="XML Team Solutions, Inc." code-key="xmlteam.com" code-type="distributor"/> <sports-content-code code-type="sport" code-key="15007000" code-name="Baseball"/> <sports-content-code code-type="league" code-key="l.mlb.com" code-name="Major League Baseball"/> <sports-content-code code-type="season-type" code-key="pre-season"/> <sports-content-code code-type="season" code-key="2009"/> <sports-content-code code-type="priority" code-key="normal"/> <sports-content-code code-type="conference" code-key="c.national" code-name="National"/> <sports-content-code code-type="conference" code-key="c.american" code-name="American"/> <sports-content-code code-type="team" code-key="l.mlb.com-t.11" code-name="Los Angeles Angels"/> <sports-content-code code-type="team" code-key="l.mlb.com-t.28" code-name="Los Angeles Dodgers"/> <sports-content-code code-type="action-listing" code-key="complete"/> </sports-content-codes> </sports-metadata> <sports-event xmlns:fs="java.io.File"> <event-metadata xmlns:xte="www.xmlteam.com/xte" date-coverage-type="event" event-key="l.mlb.com-2009-e.26882" date-coverage-value="l.mlb.com-2009-e.26882" event-status="post-event" duration="2:58" start-date-time="20090323T160500-0400" xts:game-of-day="1"> <sports-content-codes/> <event-metadata-baseball/> <site> <site-metadata> <home-location/> </site-metadata> <site-stats attendance="8704"/> </site> </event-metadata> <team> <team-metadata team-key="l.mlb.com-t.28" alignment="away"> <name first="Los Angeles" last="Dodgers"/> </team-metadata> <team-stats score="4" score-opposing="10" event-outcome="loss"> <sub-score period-value="1" score="1"/> <sub-score period-value="2" score="0"/> <sub-score period-value="3" score="0"/> <sub-score period-value="4" score="3"/> <sub-score period-value="5" score="0"/> <sub-score period-value="6" score="0"/> <sub-score period-value="7" score="0"/> <sub-score period-value="8" score="0"/> <sub-score period-value="9" score="0"/> <team-stats-baseball> <stats-baseball-offensive runs-scored="4" at-bats="36" hits="9" rbi="4" bases-on-balls="2" strikeouts="4" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="1" stolen-bases="1" stolen-bases-caught="1" hit-by-pitch="0" left-on-base="7"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> <stats-baseball-pitching runs-allowed="10" hits="13" earned-runs="10" bases-on-balls="6" strikeouts="8" era="10.000" balks="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" shutouts="0" games-complete="0" wins="0" losses="1"/> </team-stats-baseball> </team-stats> <player id="b.11965"> <player-metadata position-event="8" player-key="l.mlb.com-p.11965" status="starter"> <name first="Matt" last="Kemp"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="4" hits="1" rbi="2" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="1" hit-by-pitch="0" average=".271"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.7103"> <player-metadata position-event="8" player-key="l.mlb.com-p.7103" status="bench"> <name first="Jason" last="Repko"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".219"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.9917"> <player-metadata position-event="9" player-key="l.mlb.com-p.9917" status="starter"> <name first="Andre" last="Ethier"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="3" hits="2" rbi="0" bases-on-balls="1" strikeouts="0" singles="2" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".204"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.6892"> <player-metadata position-event="pr,7" player-key="l.mlb.com-p.6892" status="bench"> <name first="John-Ford" last="Griffin"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="0" rbi="0" bases-on-balls="0" strikeouts="1" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".000"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.3810"> <player-metadata position-event="dh" player-key="l.mlb.com-p.3810" status="starter"> <name first="Manny" last="Ramirez"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="3" hits="0" rbi="0" bases-on-balls="0" strikeouts="2" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="1" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".200"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.9776"> <player-metadata position-event="ph,dh" player-key="l.mlb.com-p.9776" status="bench"> <name first="A.J." last="Ellis"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="1" rbi="0" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".320"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.6773"> <player-metadata position-event="3" player-key="l.mlb.com-p.6773" status="starter"> <name first="James" last="Loney"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="4" hits="1" rbi="0" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".241"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.5664"> <player-metadata position-event="3" player-key="l.mlb.com-p.5664" status="bench"> <name first="Doug" last="Mientkiewicz"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="0" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".238"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.13237"> <player-metadata position-event="2" player-key="l.mlb.com-p.13237" status="starter"> <name first="Russell" last="Martin"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="3" hits="2" rbi="1" bases-on-balls="0" strikeouts="0" singles="2" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="1" stolen-bases-caught="0" hit-by-pitch="0" average=".394"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.7897"> <player-metadata position-event="2" player-key="l.mlb.com-p.7897" status="bench"> <name first="Danny" last="Ardoin"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".375"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.2687"> <player-metadata position-event="5" player-key="l.mlb.com-p.2687" status="starter"> <name first="Mark" last="Loretta"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".250"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.14163"> <player-metadata position-event="5" player-key="l.mlb.com-p.14163" status="bench"> <name first="Luis" last="Maza"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="1" rbi="0" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".100"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.17507"> <player-metadata position-event="4" player-key="l.mlb.com-p.17507" status="starter"> <name first="Blake" last="DeWitt"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="0" rbi="0" bases-on-balls="0" strikeouts="1" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".288"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.1347"> <player-metadata position-event="4" player-key="l.mlb.com-p.1347" status="bench"> <name first="Juan" last="Castro"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".436"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.14313"> <player-metadata position-event="7,9" player-key="l.mlb.com-p.14313" status="starter"> <name first="Xavier" last="Paul"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="3" hits="0" rbi="0" bases-on-balls="1" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".383"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.18742"> <player-metadata position-event="6" player-key="l.mlb.com-p.18742" status="starter"> <name first="Chin-Lung" last="Hu"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="4" hits="1" rbi="1" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".316"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.8512"> <player-metadata position-event="1" player-key="l.mlb.com-p.8512" status="starter"> <name first="Chad" last="Billingsley"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="4" innings-pitched="2" hits="4" earned-runs="4" bases-on-balls="3" strikeouts="2" era="6.35" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="1" xts:losses-season="1" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.5381"> <player-metadata position-event="1" player-key="l.mlb.com-p.5381" status="bench"> <name first="Jeff" last="Weaver"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="2" innings-pitched="2" hits="3" earned-runs="2" bases-on-balls="0" strikeouts="2" era="7.88" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="1" saves-blown="0" saves="0" event-credit="loss" xts:wins-season="0" xts:losses-season="1" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.18258"> <player-metadata position-event="1" player-key="l.mlb.com-p.18258" status="bench"> <name first="Scott" last="Elbert"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="0" innings-pitched="1" hits="1" earned-runs="0" bases-on-balls="0" strikeouts="1" era="6.14" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="1" xts:losses-season="0" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.7482"> <player-metadata position-event="1" player-key="l.mlb.com-p.7482" status="bench"> <name first="Erick" last="Threets"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="2" innings-pitched="1" hits="1" earned-runs="2" bases-on-balls="1" strikeouts="2" era="5.40" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="0" xts:losses-season="0" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.19392"> <player-metadata position-event="1" player-key="l.mlb.com-p.19392" status="bench"> <name first="Ramon" last="Troncoso"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="2" innings-pitched="1" hits="3" earned-runs="2" bases-on-balls="1" strikeouts="0" era="7.88" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="0" xts:losses-season="1" xts:saves-season="1" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.14165"> <player-metadata position-event="1" player-key="l.mlb.com-p.14165" status="finished"> <name first="Brian" last="Mazone"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="0" innings-pitched="1" hits="1" earned-runs="0" bases-on-balls="1" strikeouts="1" era="0.00" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="0" xts:losses-season="0" xts:saves-season="1" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> </team> <team> <team-metadata team-key="l.mlb.com-t.11" alignment="home"> <name first="Los Angeles" last="Angels"/> </team-metadata> <team-stats score="10" score-opposing="4" event-outcome="win"> <sub-score period-value="1" score="2"/> <sub-score period-value="2" score="2"/> <sub-score period-value="3" score="0"/> <sub-score period-value="4" score="2"/> <sub-score period-value="5" score="0"/> <sub-score period-value="6" score="2"/> <sub-score period-value="7" score="2"/> <sub-score period-value="8" score="0"/> <sub-score period-value="9"/> <team-stats-baseball> <stats-baseball-offensive runs-scored="10" at-bats="34" hits="13" rbi="10" bases-on-balls="6" strikeouts="8" doubles="2" triples="1" home-runs="3" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="1" stolen-bases="0" stolen-bases-caught="2" hit-by-pitch="0" left-on-base="6"/> <stats-baseball-defensive errors="3" errors-passed-ball="0"/> <stats-baseball-pitching runs-allowed="4" hits="9" earned-runs="3" bases-on-balls="2" strikeouts="4" era="3.000" balks="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" shutouts="0" games-complete="0" wins="1" losses="0"/> </team-stats-baseball> </team-stats> <player id="b.6445"> <player-metadata position-event="5" player-key="l.mlb.com-p.6445" status="starter"> <name first="Chone" last="Figgins"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="1" rbi="1" bases-on-balls="1" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="2" hit-by-pitch="0" average=".325"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.20376"> <player-metadata position-event="ph,8" player-key="l.mlb.com-p.20376" status="bench"> <name first="Coby" last="Smith"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="1" rbi="0" bases-on-balls="0" strikeouts="1" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".667"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.11967"> <player-metadata position-event="4" player-key="l.mlb.com-p.11967" status="starter"> <name first="Howie" last="Kendrick"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="0" rbi="0" bases-on-balls="1" strikeouts="2" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".344"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.7011"> <player-metadata position-event="ph,2" player-key="l.mlb.com-p.7011" status="bench"> <name first="Ryan" last="Budde"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="0" rbi="0" bases-on-balls="1" strikeouts="1" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".412"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.5533"> <player-metadata position-event="7" player-key="l.mlb.com-p.5533" status="starter"> <name first="Bobby" last="Abreu"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="2" hits="0" rbi="0" bases-on-balls="1" strikeouts="2" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".263"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.11570"> <player-metadata position-event="5" player-key="l.mlb.com-p.11570" status="bench"> <name first="Brandon" last="Wood"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="2" hits="1" rbi="0" bases-on-balls="0" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="1" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".354"/> <stats-baseball-defensive errors="1" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.1946"> <player-metadata position-event="9" player-key="l.mlb.com-p.1946" status="starter"> <name first="Vladimir" last="Guerrero"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="3" hits="2" rbi="0" bases-on-balls="0" strikeouts="0" singles="2" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".250"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.19314"> <player-metadata position-event="9" player-key="l.mlb.com-p.19314" status="bench"> <name first="Chris" last="Pettit"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="2" hits="1" rbi="0" bases-on-balls="0" strikeouts="1" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".354"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.2062"> <player-metadata position-event="8" player-key="l.mlb.com-p.2062" status="starter"> <name first="Torii" last="Hunter"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="3" hits="1" rbi="2" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="1" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".182"/> <stats-baseball-defensive errors="1" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.15871"> <player-metadata position-event="4" player-key="l.mlb.com-p.15871" status="bench"> <name first="Sean" last="Rodriguez"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".282"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.18447"> <player-metadata position-event="3" player-key="l.mlb.com-p.18447" status="starter"> <name first="Kendry" last="Morales"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="3" hits="0" rbi="0" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".367"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.7262"> <player-metadata position-event="3" player-key="l.mlb.com-p.7262" status="bench"> <name first="Matthew" last="Brown"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="1" hits="0" rbi="1" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".550"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.6012"> <player-metadata position-event="dh" player-key="l.mlb.com-p.6012" status="starter"> <name first="Juan" last="Rivera"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="2" hits="1" rbi="0" bases-on-balls="0" strikeouts="1" singles="0" doubles="1" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".211"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.5647"> <player-metadata position-event="ph,dh" player-key="l.mlb.com-p.5647" status="bench"> <name first="Gary" last="Matthews"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="0" at-bats="1" hits="0" rbi="0" bases-on-balls="1" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".357"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.6928"> <player-metadata position-event="2" player-key="l.mlb.com-p.6928" status="starter"> <name first="Jeff" last="Mathis"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="2" hits="1" rbi="1" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="1" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".343"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.6814"> <player-metadata position-event="ph,6" player-key="l.mlb.com-p.6814" status="bench"> <name first="Maicer" last="Izturis"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="1" hits="1" rbi="1" bases-on-balls="1" strikeouts="0" singles="1" doubles="0" triples="0" home-runs="0" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".278"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.8016"> <player-metadata position-event="6" player-key="l.mlb.com-p.8016" status="starter"> <name first="Erick" last="Aybar"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="2" at-bats="2" hits="2" rbi="2" bases-on-balls="0" strikeouts="0" singles="0" doubles="1" triples="0" home-runs="1" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".310"/> <stats-baseball-defensive errors="1" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="b.6589"> <player-metadata position-event="ph,7" player-key="l.mlb.com-p.6589" status="bench"> <name first="Robb" last="Quinlan"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-offensive runs-scored="1" at-bats="2" hits="1" rbi="2" bases-on-balls="0" strikeouts="0" singles="0" doubles="0" triples="0" home-runs="1" grand-slams="0" sac-flies="0" sacrifices="0" grounded-into-double-play="0" stolen-bases="0" stolen-bases-caught="0" hit-by-pitch="0" average=".310"/> <stats-baseball-defensive errors="0" errors-passed-ball="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.7092"> <player-metadata position-event="1" player-key="l.mlb.com-p.7092" status="starter"> <name first="Dustin" last="Moseley"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="4" innings-pitched="6" hits="8" earned-runs="3" bases-on-balls="1" strikeouts="3" era="3.15" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="1" losses="0" saves-blown="0" saves="0" event-credit="win" xts:wins-season="3" xts:losses-season="0" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.20390"> <player-metadata position-event="1" player-key="l.mlb.com-p.20390" status="bench"> <name first="Trevor" last="Reckling"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="0" innings-pitched="2" hits="1" earned-runs="0" bases-on-balls="1" strikeouts="0" era="0.00" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="0" xts:losses-season="0" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> <player id="p.20370"> <player-metadata position-event="1" player-key="l.mlb.com-p.20370" status="finished"> <name first="Mason" last="Tobin"/> </player-metadata> <player-stats> <player-stats-baseball> <stats-baseball-pitching runs-allowed="0" innings-pitched="1" hits="0" earned-runs="0" bases-on-balls="0" strikeouts="1" era="0.00" balks="0" shutouts="0" errors-wild-pitch="0" number-of-pitches="0" number-of-strikes="0" wins="0" losses="0" saves-blown="0" saves="0" xts:wins-season="0" xts:losses-season="0" xts:saves-season="0" xts:saves-blown-season="0"/> </player-stats-baseball> </player-stats> </player> </team> <officials> <official> <official-metadata position="Home Plate Umpire"> <name full="Jim Wolf"/> </official-metadata> </official> <official> <official-metadata position="First Base Umpire"> <name full="Bob Davidson"/> </official-metadata> </official> <official> <official-metadata position="Second Base Umpire"> <name full="Mike Winters"/> </official-metadata> </official> <official> <official-metadata position="Third Base Umpire"> <name full="Mike Everitt"/> </official-metadata> </official> </officials> <event-actions> <event-actions-baseball/> </event-actions> <highlight class="double-plays"> <p>Los Angeles 2; LA Angels 1.</p> </highlight> </sports-event> </sports-content></xts:sports-content-set> |
Is there a more sutiable language for parsing the XML? | |
Graham 2-Aug-2009 [829] | parse-xml and xml-to-object seems to work okay on this file. |
CharlesW 2-Aug-2009 [830] | It reads and parses ok. I get the block object but my problem is trying to access the individual elements. When venturing into some of the nested attributes, I just can't seem to get it returning a result.. Can you post an example on how you would retrieve the "hits" for <player id="b.11965"> or get the league info from sports-content-code code-type="league" |
Graham 2-Aug-2009 [831x4] | >> do %xml-parse.r Script: "A more XML 1.0 compliant set of XML parsing tools." (4-Dec-2001) >> do %xml-object.r Script: {Convert an XML-derived block structure into objects.} (29-Sep-2001) >> obj: first reduce xml-to-object parse-xml+ read %test.xml >> data: second obj == [make object! [ xts:sports-content-set: make object! [ sports-content: make object! [ sports... >> type? data == block! >> probe data/2/sports-content/sports-event/team/1/player/1 make object! [ player-metadata: make object! [ name: make object! [ value?: "" first: "Matt" last: "Kemp" ] position-event: "8" player-key: "l.mlb.com-p.11965" status: "starter" ] player-stats: make object! [ player-stats-baseball: make object! [ stats-baseball-offensive: make object! [ value?: "" runs-scored: "0" at-bats: "4" hits: "1" rbi: "2" bases-on-balls: "0" strikeouts: "0" singles: "1" doubles: "0" triples: "0" home-runs: "0" grand-slams: "0" sac-flies: "0" sacrifices: "0" grounded-into-double-play: "0" stolen-bases: "0" stolen-bases-caught: "1" hit-by-pitch: "0" average: ".271" ] stats-baseball-defensive: make object! [ value?: "" errors: "0" errors-passed-ball: "0" ] ] ] id: "b.11965" ] |
if you download anamonitor300.r, then you can browse the object like this mon data mon obj won't work because of the ":" in the object name | |
It should be easy enough to write a recurseive function that descends thru the object looking for some text, and then to print out the full path for you as in the recursive examples I posted above. | |
make that "straight forward" vs "easy" | |
CharlesW 2-Aug-2009 [835] | Thank you so much Graham, I will give it a try as you have indicated and will alsodownload anamonitor300.r |
Graham 2-Aug-2009 [836] | Good luck with this stuff .. it's pretty tedious navigating thru large objects like this ... |
Chris 12-Aug-2009 [837] | >> do http://www.ross-gill.com/r/altxml.r connecting to: www.ross-gill.com Script: "AltXML" (7-Jun-2009) >> all-stats: load-xml/dom your-xml-data >> player: stats/get-by-id "b.11965" >> his-stats: first player/get-by-tag <stats-baseball-offensive> >> his-stats/get #hits == "1" >> remove-each code codes: all-stats/get-by-tag <sports-content-code> ["league" <> code/get #code-type] == [make object! [ name: <sports-content-code> space: none value: [ #code-type "league" ... >> foreach code codes [probe code/get #code-name] Major ^/ League Baseball == "Major ^/ League Baseball" |
Graham 12-Aug-2009 [838] | How is your parser getting on these days? |
Chris 13-Aug-2009 [839] | Still seems to work as advertised - good for extraction; still missing the 'flatten function. Not much time for development in the schema direction though : ( |
Graham 13-Aug-2009 [840] | I'm guessing that it should be "all-stats/get-by-id" and not "stats/get-by-id" |
Graham 14-Aug-2009 [841] | Chris, do you documentation yet for your parser? |
Chris 14-Aug-2009 [842] | Doesn't go into much detail, but: http://www.ross-gill.com/page/XML+and+REBOL |
Graham 14-Aug-2009 [843x2] | Given some xml like this which is a list of documents http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html#ListDocs how would your parser extract the <gd:resourceid> and text associated with these tags? |
again .. how would you use your parser to exxtract the <gd:resourceid> tags and associated text? | |
Chris 14-Aug-2009 [845x3] | >> google-xml: load-xml/dom clipboard:// ; copied from page >> entries: google-xml/get-by-tag <entry> == [make object! [ name: <entry> space: none value: [ #etag {"BxAUSh5RAyp7ImBq"} <... >> foreach entry entries [probe entry/get <resourceId>] spreadsheet:key == "spreadsheet:key" |
Note that while it appears namespaces have been stripped, they are in fact still there: | |
>> entry: first entries >> id: first entry/get-by-tag <resourceId> >> id/space == <gd> | |
Graham 14-Aug-2009 [848] | So, looks feasible to use your parser to create an api for googledocs ... |
Graham 15-Aug-2009 [849x2] | There's a rebzip script which has recently been updated on rebol.org which I guess can be used to open up docx |
Sounds like too much overhead ... unzip the docx, make changes to the xml portion and then rezip. | |
Janko 2-Jan-2010 [851] | I will need a xml parser .. I was thinkinf something fast and quick like sax style .. I found this one http://www.rebol.org/view-script.r?script=xml-parse.r but by looking of it it seems to offer a lot of things I don't need. Has anyone used it for "serrious" xml parsing with it. I am thinking of making my own simple minimal event based xml parser. |
Graham 2-Jan-2010 [852x2] | Yes, I have used it to parse large XML files |
You can turn the xml file into a rebol object with it | |
Janko 2-Jan-2010 [854] | I imagine that is too costly .. I preferr the callback model to just extract the relevant data out |
Graham 2-Jan-2010 [855] | Mine is a desktop application .. your needs for a web service differ .. |
Janko 2-Jan-2010 [856] | yes, I get a big xml made by "official" BLOATED standard for invoices .. I want to parse it as quick as possible and that's all |
Geomol 2-Jan-2010 [857] | Janko, http://www.fys.ku.dk/~niclasen/rebxml/rebxml-spec.html http://www.rebol.org/view-script.r?script=xml2rebxml.r http://www.rebol.org/view-script.r?script=rebxml2xml.r |
Janko 2-Jan-2010 [858] | thanks Geomol, I will study the links .. xml2rebxml seems short which is nice, but I haven't yet figured out what exactly rebxml is .. I am reading the first link you gave me |
Robert 2-Jan-2010 [859] | Wouldn't it make a lot more sense to use a C based XML parser, construct a Rebol data-structure/string and return that to Rebol? |
Geomol 2-Jan-2010 [860] | Janko, rebxml is a rebol version of xml. It can do the same things, but without the bad implementation, xml suffers from. The idea behind xml is ok, it's just not implemented well. Much of that is solved with the rebxml format. |
Gregg 2-Jan-2010 [861] | I believe Maarten has done a SAX style parser. I've used parse-xml in the past, sometimes post-processing the output to a different REBOL form, but my needs were simple. Janko, have you tested any of the existing soluitions, with test input on target hardware, and found them to be too slow? If so, what were the results, and how fast do you need it to be? |
BrianH 2-Jan-2010 [862] | SAX pull parsing would work well with the port model. |
Janko 3-Jan-2010 [863] | Robert: it's a good idea but not for my case. I don't want the data strucure from whole xml , I want to stream it through parser and collect out the data. Geomol: I will look at it but probably not what I want in this particular case for the reason above Gregg: I haven't tested any yet, I googled and found that xml-parse.r above , which has sax style of work but seems huge. I only care to support the simplified subset of xml, xml with all the variants is a total bloat so I believe it can be that complex (and it doesn't support 100% of it also). Thats why I am considering writing a simple sax liek parser, I wrote it in c once and it was small (but it parsed even smaller subset of xml) |
older newer | first last |