88
99This package offers fast data structures for reading and writing XML files with a consistent interface:
1010
11- #### Interface Core :
11+ #### ` Node ` / ` LazyNode ` Interface :
1212
13- - ` nodetype(node) --> XML.NodeType ` (See ` ?XML.NodeType ` for details).
14- - ` tag(node) --> String or Nothing `
15- - ` attributes(node) --> OrderedDict{String,String} or Nothing `
16- - ` value(node) --> String or Nothing `
17- - ` children(node) --> Vector{typeof(node)} `
18- - ` depth(node) --> Int `
13+ - ` nodetype(node) → XML.NodeType ` (See ` ?XML.NodeType ` for details).
14+ - ` tag(node) → String or Nothing `
15+ - ` attributes(node) → Dict{String,String} or Nothing `
16+ - ` value(node) → String or Nothing `
17+ - ` children(node) → Vector{typeof(node)} `
1918
20- #### Interface for Lazy Data Structures:
21- - ` next(node) --> typeof(node) `
22- - ` prev(node) --> typeof(node) `
23- - ` parent(node) --> typeof(node) `
19+ #### Extended Interface for ` LazyNode `
20+
21+ - ` depth(node) → Int `
22+ - ` next(node) → typeof(node) `
23+ - ` prev(node) → typeof(node) `
24+ - ` parent(node) → typeof(node) `
2425
2526## Quickstart
2627
@@ -29,11 +30,11 @@ using XML
2930
3031filename = joinpath (dirname (pathof (XML)), " .." , " test" , " books.xml" )
3132
32- doc = XML . Node (filename)
33+ doc = Node (filename)
3334
3435children (doc)
3536# 2-element Vector{Node}:
36- # Node DECLARATION <?xml version="1.0">
37+ # Node DECLARATION <?xml version="1.0"? >
3738# Node ELEMENT <catalog> (12 children)
3839
3940doc[end ] # The root node
@@ -43,11 +44,12 @@ doc[end][2] # Second child of root
4344# Node ELEMENT <book id="bk102"> (6 children)
4445```
4546
46- ## Data Structures
47+ ## Node Types
4748
4849### ` XML.Node `
50+
4951- An eager data structure that loads the entire XML DOM in memory.
50- - ** This is what you should use to build an XML document programmatically.**
52+ - ** This is what you would use to build an XML document programmatically.**
5153- ` Node ` s have some additional methods that aid in construction/mutation:
5254
5355``` julia
@@ -56,15 +58,6 @@ push!(parent::Node, child::Node)
5658
5759# Replace a child:
5860parent[2 ] = child
59-
60- # Create a new node with an edited field. `kw...` can be one or more of:
61- # - nodetype::NodeType
62- # - tag (String or Nothing)
63- # - attributes (OrderedDict{String,String} or Nothing)
64- # - value (String or Nothing)
65- # - children (Vector{Node} or nothing),
66- # - depth::Int (this will be automatically set if not provided)
67- Node (node; kw... )
6861```
6962
7063- Bring convenience functions into your namespace with ` using XML.NodeConstructors ` :
0 commit comments