You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `Text` | the `text` part of `<tag>text</tag>` | `Text(text)`
66
+
67
+
68
+
## `Node`: Probably What You're Looking For
69
+
70
+
-`read`-ing a `Node` loads the entire XML DOM in memory.
60
71
-**This is what you would use to build an XML document programmatically.**
72
+
- See the table above for convenience constructors.
61
73
-`Node`s have some additional methods that aid in construction/mutation:
62
74
63
75
```julia
64
76
# Add a child:
65
77
push!(parent::Node, child::Node)
66
78
67
-
68
79
# Replace a child:
69
80
parent[2] = child
70
81
71
-
72
82
# Add/change an attribute:
73
83
node["key"] = value
74
-
```
75
-
76
-
-**XML** defines `(::NodeType)(args...; kw...)` for more convenient syntax in creating `Node`s, e.g.:
77
84
78
-
```julia
79
-
CData(value)
80
-
Comment(value)
81
-
Declaration(; attributes...)
82
-
Document(children...)
83
-
DTD(; attributes...)
84
-
Element(tag, children...; attributes...)
85
-
ProcessingInstruction(tag; attributes...)
86
-
Text(value)
85
+
node["key"]
87
86
```
88
87
89
-
### `XML.LazyNode`
88
+
89
+
## `XML.LazyNode`: For Fast Iteration through an XML File
90
90
91
91
A lazy data structure that just keeps track of the position in the raw data (`Vector{UInt8}`) to read from.
92
92
@@ -134,6 +134,7 @@ XML.write(node) # String
134
134
135
135
## Performance
136
136
137
+
- XML.jl performs comparatively to [EzXML.jl](https://github.com/JuliaIO/EzXML.jl), which wraps the C library [libxml2](https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home).
137
138
- See the `benchmarks/suite.jl` for the code to produce these results.
138
139
- The following output was generated in a Julia session with the following `versioninfo`:
0 commit comments