Skip to content

Julia module that makes working with XML feel like you are working with JSON (inspired by xmltodict)

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md
Notifications You must be signed in to change notification settings

elcritch/XmlToDict.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xmltodict.jl

Julia module that makes working with XML feel like you are working with JSON (inspired by the Python module xmltodict).

Usage

xmltest = """
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="COOKING" tag="first">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
  </book>
  <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
  </book>
  <newspaper category="news">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
  </newspaper>
</bookstore>
"""

xdict = xmlparse_string(xmltest)
xt1["bookstore"]["book"][1] 

Results in:

OrderedDict{String,Any} with 6 entries: "@category" => "COOKING" "@tag" => "first" "title" => ["@lang"=>"en","#text"=>"Everyday Italian"] "author" => ["#text"=>"Giada De Laurentiis"] "year" => ["#text"=>"2005"] "price" => ["#text"=>"30.00"]

Macro Extensions

xt1["bookstore"][x2d"book"] 
xt1["bookstore"][x2d"newspaper"] => {"@category" => "news", "title" => { ... }, ... }
xt1["bookstore"][x2d"newspaper+"] => [ {"@category" => "news", "title" => { ... }, ... }, ]
xt1["bookstore"][x2d"magazine"] => key error
xt1["bookstore"][x2d"newspaper*"] => [ ] 

About

Julia module that makes working with XML feel like you are working with JSON (inspired by xmltodict)

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages