Documention for: xml-dom.r
Created by: chrisrg
on: 16-Dec-2008
Last updated by: chrisrg on: 29-Mar-2009
Format: text/editable
Downloaded on: 30-Apr-2025
XML/DOM
===Introduction
An XML/DOM interface designed for intuitive access to XML values.
:Features - utilizes REBOL datatypes to represent XML structure;
DOM methods for extraction; self-contained and works with /Base;
prettified block structure.
:Caveats - destructive - discards whitespace and comments; does not
preserve empty tags vs. matching tags with no content; NOT an
implementation of W3 DOM, only a loosely inspired subset.
:To Do - saving.
===Usage
An example session:
>> test: {Text}
== {Text}
>> load-xml test
== [
[
[
[
/id "d"
# "Text"
]
[
...
>> doc: load-xml/dom test
>> length? doc/get-by-tag
== 2
>> c: doc/get-by-id "d"
>> c/text
== "Text"
>> doc/tree//
== [
[
/id "d"
# "Text"
]
[
/id "e"
]
]
>> e: c/sibling/after
>> e/text
== none
>> e/get /id
== "e"
>> c/sibling/before
== none