Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ doc[end][2] # Second child of root
| `Declaration` | `<?xml attributes... ?>` | `Declaration(; attrs...)`
| `ProcessingInstruction` | `<?tag attributes... ?>` | `ProcessingInstruction(tag; attrs...)`
| `Comment` | `<!-- text -->` | `Comment(text)`
| `CData` | `<![CData[text]]>` | `CData(text)`
| `CData` | `<![CDATA[text]]>` | `CData(text)`
| `Element` | `<tag attributes... > children... </NAME>` | `Element(tag, children...; attrs...)`
| `Text` | the `text` part of `<tag>text</tag>` | `Text(text)`

Expand Down
6 changes: 3 additions & 3 deletions src/XML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end
- Declaration # <?xml attributes... ?>
- ProcessingInstruction # <?NAME attributes... ?>
- Comment # <!-- ... -->
- CData # <![CData[...]]>
- CData # <![CDATA[...]]>
- Element # <NAME attributes... > children... </NAME>
- Text # text

Expand Down Expand Up @@ -324,7 +324,7 @@ function _show_node(io::IO, o)
printstyled(io, value(o), color=:light_black)
printstyled(io, "-->", color=:light_cyan)
elseif o.nodetype === CData
printstyled(io, " <![CData[", color=:light_cyan)
printstyled(io, " <![CDATA[", color=:light_cyan)
printstyled(io, value(o), color=:light_black)
printstyled(io, "]]>", color=:light_cyan)
elseif o.nodetype === Document
Expand Down Expand Up @@ -408,7 +408,7 @@ function write(io::IO, x, ctx::Vector{Bool}=[false]; indentsize::Int=2, depth::I
print(io, "<!--", value, "-->")

elseif nodetype === CData
print(io, "<![CData[", value, "]]>")
print(io, "<![CDATA[", value, "]]>")

elseif nodetype === Document
foreach(children) do child
Expand Down
8 changes: 4 additions & 4 deletions src/raw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RawType:
- RawText # text
- RawComment # <!-- ... -->
- RawCData # <![CData[...]]>
- RawCData # <![CDATA[...]]>
- RawDeclaration # <?xml attributes... ?>
- RawProcessingInstruction # <?NAME attributes... ?>
- RawDTD # <!DOCTYPE ...>
Expand Down Expand Up @@ -37,7 +37,7 @@ Create an iterator over raw chunks of data in an XML file. Each chunk of data r
- RawDocument # Only used to initialize the iterator state.
- RawText # text
- RawComment # <!-- ... -->
- RawCData # <![CData[...]]>
- RawCData # <![CDATA[...]]>
- RawDeclaration # <?xml attributes... ?>
- RawProcessingInstruction # <?NAME attributes... ?>
- RawDTD # <!DOCTYPE ...>
Expand Down Expand Up @@ -271,7 +271,7 @@ function value(o::Raw)
if o.type === RawText
String(o)
elseif o.type === RawCData
String(view(o.data, o.pos+length("<![CData["):o.pos+o.len-3))
String(view(o.data, o.pos+length("<![CDATA["):o.pos+o.len-3))
elseif o.type === RawComment
String(view(o.data, o.pos+length("<!--"):o.pos+o.len-3))
elseif o.type === RawDTD
Expand Down Expand Up @@ -534,7 +534,7 @@ function prev_no_xml_space(o::Raw) # same as v0.3.5
i = findprev(Vector{UInt8}("<--"), data, j)[1]
elseif c2 === ']'
type = RawCData
i = findprev(Vector{UInt8}("<![CData["), data, j)[1]
i = findprev(Vector{UInt8}("<![CDATA["), data, j)[1]
elseif c2 === '?'
i = findprev(Vector{UInt8}("<?"), data, j)[1]
if get_name(data, i + 2)[1] == "xml"
Expand Down
8 changes: 4 additions & 4 deletions test/data/example.kml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Example KML file</name>
<description><![CData[Example KML file]]></description>
<description><![CDATA[Example KML file]]></description>
<!-- here is a comment -->
<Style id="style1">
<IconStyle>
Expand Down Expand Up @@ -31,15 +31,15 @@
</Style>
<Placemark>
<name>Time Square</name>
<description><![CData[Times Square is a major commercial intersection and neighborhood in Midtown Manhattan, New York City.]]></description>
<description><![CDATA[Times Square is a major commercial intersection and neighborhood in Midtown Manhattan, New York City.]]></description>
<styleUrl>#style1</styleUrl>
<Point>
<coordinates>-73.984939,40.758874,0.000000</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Central Park</name>
<description><![CData[Central Park is an urban park in middle-upper Manhattan, within New York City.]]></description>
<description><![CDATA[Central Park is an urban park in middle-upper Manhattan, within New York City.]]></description>
<styleUrl>#style2</styleUrl>
<Polygon>
<outerBoundaryIs>
Expand All @@ -57,7 +57,7 @@
</Placemark>
<Placemark>
<name>Lincoln Tunnel</name>
<description><![CData[Traffic(under 10 minutes)]]></description>
<description><![CDATA[Traffic(under 10 minutes)]]></description>
<styleUrl>#style3</styleUrl>
<LineString>
<tessellate>1</tessellate>
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ end
tag=nothing,
attributes=nothing,
value=" comment "),
(xml = "<![CData[cdata test]]>",
(xml = "<![CDATA[cdata test]]>",
nodetype = CData,
tag=nothing,
attributes=nothing,
Expand Down
Loading