[REBOL] Re: XML-Parsing?!?
From: pscheller:atos:ch at: 26-Oct-2000 10:59
Hi Joel
Joel Neely wrote:
> Hi, Patrick,
>
> Errrmmm... your sample isn't legal XML!!
It isn't?? Damn I'm learning XML the same time as Rebol. So much to
learn so little time... I have to construct a webclient for our server
process, which can show the state of the running (or dead) processes and
the transactions we've proceeded. And all this in a complete new
environment with a dead line of next week!!
I chose Rebol for this job, because I thought its features are cool and
it would save me time. Yet it doesn't save me time au contraire :-( I
know Rebol is surely as good as I hoped it would be, but I still can't
figure out its basic concepts.
The "Official Rebol Guide" from Rebol-Press is no big help in getting a
clean overview. In fact I found it pretty useless if one doesn't know
Rebol yet.
[snip]
> > All I need is the possibility to simply read an external XML-File and
> > extract values from certain tags like this:
> > Pseudo: print the value of Prozesse/cre
> > ------------------------BEGIN XML----------------------------------
> > <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
> > <!-- Diese Datei enthält die Stati der xxx relevanten Prozesse -->
> > <!-- 0=OK, 1=Fehler/fehlend, 2=Unbekannt -->
> >
> > <test1 name = "Patrick" />
> > <test2 name = "Scheller" />
> > <Prozesse>
> > <xxx = "1" />
> > <cre = "2" />
> > <ora = "3" />
> > <xxxrec = "4" />
> > <db_ppb = "5" />
> > </Prozesse>
> >
> > <!-- Ende der Datei -->
> > -------------------------END XML-----------------------------------
> An XML document must have exactly one top-level XML element. You
> have three (<test1 ...>, <test2 ...>, and <Prozesse ...>). In addition,
> you have what appear (by intent) to be five content elements under
> <Prozesse ...> which are not valid. If elements, they would have to
> be written something like:
I see. Thanx.
> For the sake of furthering the discussion, I will guess what you meant as:
[snip]
Yes indeed that's what I need.
> (that is, assuming that you wanted attributes). With that assumption,
> we can use something like the following:
[snip]
> to do this:
> >> foo: parse-xml read %sample3.xml
> XML Version: 1.0
> == [document none [["datei" none ["^/" ["test1" ["name" "Patrick"] ...
> >> prozesse/select-element-attribute foo "Prozesse" "cre"
> == ["2"]
> Hope this helps!
A bit yes. You take me a step further every eMail :-)
Sadly I must turn away from Rebol for this task onto PHP. But I will try
to stay in touch with Rebol and with some time (who knows? :-) I will
understand it. Thanx Joel
Hreets to all, pat le sad