Skip to main content

A Better XML Parser through Functional Programming

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2002)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2257))

Included in the following conference series:

Abstract

This paper demonstrates how a higher-level, declarative view of XML parsing as folding over XML documents has helped to design and implement a better XML parser. By better we mean a full-featured, algorithmically optimal, pure-functional parser, which can act as a stream processor. By better we mean an efficient SAX parser that is easy to use, a parser that does not burden an application with the maintenance of a global state across several callbacks, a parser that eliminates classes of possible application errors.

This paper describes such better XML parser, SSAX. We demonstrate that SSAX is a better parser by comparing it with several XML parsers written in various (functional) languages, as well as with the reference XML parser Expat. In the experience of the author the declarative approach has greatly helped in the development of SSAX. We argue that the more expressive, reliable and easier to use application interface is the outcome of implementing the parsing engine as an enhanced tree fold combinator, which fully captures the control pattern of the depth- first tree traversal.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Anderson, J.: Common Lisp support for the ‘Extensible Markup Language’ (CL-XML). Version 0.906, June 2, 2001. http://homepage.mac.com/james_anderson/XML/documentation/cl-xml.html

  2. Cooper, C.: Using Expat. xml.com, September 1, 1999. http://www.xml.com/pub/a/1999/09/expat/index.html

  3. Dunford, M.: DOM XML: An Alternative to Expat. http://www.phpbuilder.com/columns/matt20001228.php3

  4. Hutton, G.: A tutorial on the universality and expressiveness of fold. Journal of Functional Programming, 9(4):355–372, July 1999.

    Article  MATH  MathSciNet  Google Scholar 

  5. Gibbons, J., Jones, G.: The Under-appreciated Unfold. Proc. Intl. Conf. Functional Programming, pp. 273–279, Baltimore, Maryland, September 27-29, 1998.

    Google Scholar 

  6. Kiselyov, O.: Functional XML parsing framework: SAX/DOM and SXML parsers with support for XML Namespaces and validation. Version 4.9, September 5, 2001. http://pobox.com/~oleg/ftp/Scheme/xml.html#XML-parser

  7. Lindig, C.: Tony-a XML Parser and Pretty Printer. Version 0.8. http://www.gaertner.de/~lindig/software/tony.html

  8. van Mourik, H.: XML parser in Scheme. Version: 0.9.23, June 2, 1998. http://student.twi.tudelft.nl/~tw585306/

  9. Neumann, A.: The Functional XML Parser. Version 1.4.4, October 30, 2000. http://WWW.Informatik.Uni-Trier.DE/~aberlea/Fxp/

  10. Sheard T., Fegaras, L.: A fold for all seasons. Proc. Conf. on Functional Programming and Computer Architecture (FPCA’93), pp. 233–242, Copenhagen, Denmark, June 1993.

    Google Scholar 

  11. Wallace M., Runciman, C.: HaXml. Version 1.02 release, May 3, 2001. http://www.cs.york.ac.uk/fp/HaXml/

  12. World Wide Web Consortium. Extensible Markup Language (XML) 1.0 (Second Edition). W3C Recommendation October 6, 2000. http://www.w3.org/TR/REC-xml

  13. World Wide Web Consortium. XML Information Set. W3C Candidate Recommendation. May 14, 2001. http://www.w3.org/TR/xml-infoset

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kiselyov, O. (2002). A Better XML Parser through Functional Programming. In: Krishnamurthi, S., Ramakrishnan, C.R. (eds) Practical Aspects of Declarative Languages. PADL 2002. Lecture Notes in Computer Science, vol 2257. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45587-6_14

Download citation

  • DOI: https://doi.org/10.1007/3-540-45587-6_14

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-43092-6

  • Online ISBN: 978-3-540-45587-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics