[REBOL] Re: Rebol & XML
From: bry:itnisk at: 11-Aug-2003 11:56
>A real-live XPath implementation in REBOL would be useful, though
>*waayyy* non-trivial to build.
I think difficulty however can be lessened by how the object is
structured. I've been thinking that it needs to be one more level of
abstraction, that is to say that each step in the object tells you what
elements, attributes, namespaces, element name ,defaultNamespace, and
textnodes are contained at that step. With textnodes referenced inside
the elements block so that one can maintain their position.
Child1: make object![
Name: "h:p"
Elements: [t1 "h:p" "a" t2 "n:p"]
Attributes: ["class" "style"]
Namespaces: ["xmlns:h='http://www.w3.org/1999/xhtml'"]
defaultNamespace: "http://www.w3.org/1999/xhtml"
att1: "ParaStyle1"
att2: "position:relative;"
t1: "here's some text"
t2: "hi"
Child1: make object![
Name: "h:p"
.... and so on and so on
]
]
It is definitely not as elegant as just using Rebol path to navigate to
/p/p
but I think the abstraction offered here is necessary in order to handle
all the possible weird textnode, namespaceing issues.