Skip to content

Commit 53d7ed3

Browse files
committed
cleanup
1 parent f0ef01f commit 53d7ed3

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/XML.jl

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ module XML
33
using Mmap
44

55
export
6-
Node, LazyNode, # Core Types
7-
children, parent, nodetype, tag, attributes, value, depth, next, prev, # interface
8-
NodeConstructors # convenience functions for creating Nodes
6+
# Core Types:
7+
Node, LazyNode,
8+
# Interface:
9+
children, nodetype, tag, attributes, value,
10+
# Extended Interface for LazyNode:
11+
parent, depth, next, prev
912

1013
#-----------------------------------------------------------------------------# escape/unescape
11-
# only used by Text nodes
14+
# only used by Text nodes during `XML.write`
1215
const escape_chars = ('&' => "&amp;", '<' => "&lt;", '>' => "&gt;", "'" => "&apos;", '"' => "&quot;")
1316
escape(x::AbstractString) = replace(x, escape_chars...)
1417
unescape(x::AbstractString) = replace(x, reverse.(escape_chars)...)
@@ -24,6 +27,17 @@ unescape(x::AbstractString) = replace(x, reverse.(escape_chars)...)
2427
- CData # <![CData[...]]>
2528
- Element # <NAME attributes... > children... </NAME>
2629
- Text # text
30+
31+
NodeTypes can be used to construct XML.Nodes:
32+
33+
Document(children...)
34+
DTD(value)
35+
Declaration(; attributes)
36+
ProcessingInstruction(tag, attributes)
37+
Comment(text)
38+
CData(text)
39+
Element(tag, children...; attributes)
40+
Text(text)
2741
"""
2842
@enum(NodeType, CData, Comment, Declaration, Document, DTD, Element, ProcessingInstruction, Text)
2943

@@ -95,7 +109,7 @@ end
95109
Node(node::Node; kw...) # copy node with keyword overrides
96110
Node(node::LazyNode) # un-lazy the LazyNode
97111
98-
A representation of an XML DOM node. For convenience constructors, see the `XML.NodeConstructors` module.
112+
A representation of an XML DOM node. For simpler construction, use `(::NodeType)(args...)`
99113
"""
100114
struct Node <: AbstractXMLNode
101115
nodetype::NodeType

0 commit comments

Comments
 (0)