Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
HaXml
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{infobox software | author = Malcolm Wallace | latest release version = v1.25.13<ref>{{cite web |url=https://github.com/HaXml/HaXml/releases/tag/v1.25.13 |title=Release v1.25.13 |website=[[GitHub]] |access-date=January 10, 2024}}</ref> | latest release date = {{Start date and age|2023|07|13}} | repo = https://github.com/HaXml/HaXml | programming language = [[Haskell]] | genre = [[Library (computing)|library]] | license = [[GNU Lesser General Public License|LGPL 2.1]] }} '''HaXml''' is a collection of utilities for [[parsing]], [[Filter (higher-order function)|filtering]], [[Transformation (function)|transforming]], and generating Extensible Markup Language ([[XML]]) documents using the [[programming language]] [[Haskell]].<ref name="zenodo">{{cite journal |first1=MichaΕ J. |last1=Gajda |first2=Dmitry |last2=Krylov |title=Fast XML/HTML tools for Haskell: XML TypeLift and improved Xeno |date=November 5, 2020 |arxiv=2011.03536v1 |doi=10.5281/zenodo.3929549 |s2cid=226282051 |journal=Zenodo}}</ref> == Overview == HaXml utilities include:<ref name="zenodo"/><ref>{{cite web |url=https://github.com/HaXml/HaXml/blob/main/README |title=Readme |website=[[GitHub]] |access-date=January 10, 2024}}</ref> * XML parser * XML validator * a separate [[error-correcting]] parser for [[HTML]] * pretty-printers for XML and HTML * stream parser for XML events * translator from [[Document type definition|DTD]] to Haskell * translator from [[XML Schema (W3C)|XML Schema definitions]] to Haskell data types HaXml provides a [[Fixed-point combinator|combinator]] library with a set of [[higher-order function]]s which process the XML documents after they are represented using the native Haskell [[data type]]s.<ref>{{cite report |last1=Mu |first1=Shin-Cheng |last2=Hu |first2=Zhenjiang |last3=Takeichi |first3=Masato |url=https://takeichi.ipl-lab.org/~scm/pub/icfp05.pdf |title=Bidirectionalising HaXML |access-date=January 10, 2024 |archive-url=https://web.archive.org/web/20240110233319/https://takeichi.ipl-lab.org/~scm/pub/icfp05.pdf |archive-date=January 10, 2024}}</ref> The basic data type is <code>Content</code> which represents the document subset of XML.<ref>{{cite book |last1=Ohlendorf |first1=Manuel |date=January 6, 2007 |url=https://www.fh-wedel.de/fileadmin/FHW-Files/Dokumente_FHW/Forschung/Abgeschlossene_Masterarbeiten/Manuel_Ohlendorf_-_A_Cookbook_for_the_Haskell_XML_Toolbox_with_Examples_for_Processing_RDF_Documents.pdf |title=A Cookbook for the Haskell XML Toolbox with Examples for Processing RDF Documents |publisher=fhwedel Computer Science Department |page=78 |access-date=January 13, 2024 |url-status=live |archive-url=https://web.archive.org/web/20240113201226/https://www.fh-wedel.de/fileadmin/FHW-Files/Dokumente_FHW/Forschung/Abgeschlossene_Masterarbeiten/Manuel_Ohlendorf_-_A_Cookbook_for_the_Haskell_XML_Toolbox_with_Examples_for_Processing_RDF_Documents.pdf |archive-date=January 13, 2024}}</ref> HaXml allows converting XML to Haskell data and vice versa, and XML to XML (by transforming or [[Filter (higher-order function)|filtering]]). The common use of the HaXml's parser includes defining the method of traversing the XML data and it has the <code>CFilter</code> type (''content filter''), where <code>type CFilter = Content -> [Content]</code>. It means that this [[Function (computer programming)|function]] defined by the user will take a fragment of an XML data and either return more fragments or none at all. This approach allows to choose XML elements satisfying certain conditions (e.g., tags with certain name or all children of a specified tag).<ref name="real">{{cite book |last1=O'Sullivan |first1=Bryan |last2=Goerzen |first2=John |last3=Stewart |first3=Don |year=2008 |chapter=Chapter 22. Extended Example: Web Client Programming |chapter-url=https://book.realworldhaskell.org/read/extended-example-web-client-programming.html |title=[[Real World Haskell]] |publisher=[[O'Reilly Media]] |isbn=978-0596514983}}</ref><ref>{{cite journal |last1=Wallace |first1=Malcolm |last2=Runciman |first2=Colin |date=September 1, 1999 |title=Haskell and XML: generic combinators or type-based translation? |journal=ACM SIGPLAN Notices |volume=34 |issue=9 |pages=148β159 |doi=10.1145/317765.317794 |url=https://www.cs.york.ac.uk/plasma/publications/pdf/WallaceRuncimanICFP99.pdf}}</ref> == Example == In the chapter 22 "Extended Example: Web Client Programming" of the [[Real World Haskell]] by Bryan O'Sullivan, Don Stewart, and John Goerzen, the following example is considered.<ref name="real"/> The XML file looks like this (simplified version): <syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version="2.0"> <channel> <title>Haskell Radio</title> <link>http://www.example.com/radio/</link> <description>Description of this podcast</description> <item>First item</item> <item>Second item</item> </channel> </rss> </syntaxhighlight> The following content filter is constructed: <syntaxhighlight lang="haskell"> channel :: CFilter channel = tag "rss" /> tag "channel" </syntaxhighlight> This filter is later used to get the title of the channel: <syntaxhighlight lang="haskell"> getTitle :: Content -> String getTitle doc = contentToStringDefault "Untitled Podcast" (channel /> tag "title" /> txt $ doc) </syntaxhighlight> == References == {{Reflist}} == External links == * {{Official website|hackage.haskell.org/package/HaXml}} {{Haskell programming}} [[Category:Free software programmed in Haskell]] [[Category:XML parsers]] [[Category:Software using the GNU Lesser General Public License]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite report
(
edit
)
Template:Cite web
(
edit
)
Template:Haskell programming
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Main other
(
edit
)
Template:Official website
(
edit
)
Template:Reflist
(
edit
)
Template:Template other
(
edit
)