XMLParser.jl

A lightweight XML parser which is purely written in Julia.

For extensive use of XML features, consider using one of the following XML-libraries: LightXML.jl, EzXML.jl.

Install

import Pkg
Pkg.add("XMLParser")

Unsupported features

  • It is not allowed to use one of the following characters in XML content: <,>

There are probably many more XML features that are not supported at the moment.

Types

Missing docstring.

Missing docstring for XMLEmptyTag. Check Documenter's build log for details.

XMLParser.XMLElementType

XMLElement <: AbstractXMLElement

Creates a XML element

XMLElement(tag::XMLTag, content::Vector{Any})

source

Functions

Utils

XMLParser.getElements!Function

getElements!(ret::Vector{XMLElement},xmlel::XMLElement,tagname::String)

Pushes all XMLElements that match the tagname to ret.

source
XMLParser.getElementsFunction

getElements(xmlel::XMLElement,tagname::String)

Gets all XMLElements that match the tagname and returns a Vector{XMLElement}.

source
XMLParser.getChildrenbyTagName!Function

getChildrenbyTagName!(ret::Vector{XMLElement},xmlel::XMLElement,tagname::String)

Pushes all XMLElements that are direct children of xmlel and match the tagname to ret.

source
XMLParser.getChildrenbyTagNameFunction

getChildrenbyTagName(xmlel::XMLElement,tagname::String)

Gets all XMLElements that are direct children of xmlel and match the tagname. Return a Vector{XMLElement}.

source
XMLParser.hasAttributekeyFunction

hasAttributekey(el::XMLElement,key::String))

Return true if el has a attribute with keyname key. Returns false otherwise.

source
XMLParser.getAttributeFunction

getAttribute(el::XMLElement,key::String)

Return attribute value if el has a attribute with keyname key. Returns emptystring otherwise.

source
XMLParser.setAttributeFunction

setAttribute(el::XMLElement,key::String,val)

Sets attribute value val to XML attribute key of XMLElement el. Returns an error("Attribute not found") if key is not found. Returns nothing otherwise.

source

IO-Functions

Base.readMethod

Base.read(::Type{XMLElement}, file::String)

Reads a XML file in location file. Returns a XMLElement.

source
XMLParser.writeXMLElementFunction

writeXMLElement(f::IOStream, el::XMLElement)

Writes a XMLElement to an IOStream.

source

writeXMLElement(f::IOStream, el::XMLElement)

Writes a XMLElement to an IOStream.

source