Skip to main content

A Typeful and Tagless Representation for XML Documents

  • Conference paper
Programming Languages and Systems (APLAS 2003)

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

Included in the following conference series:

Abstract

When constructing programs to process XML documents, we immediately face the question as to how XML documents should be represented internally in the programming language we use. Currently, most representations for XML documents are typeless in the sense that the type information of an XML document cannot be reflected in the type of the representation of the document (if the representation is assumed to be typed). Though convenient to construct, a typeless representation for XML documents often makes use of a large number of representation tags, which not only require some significant amount of space to store but may also incur numerous run-time tag checks when the represented documents are processed. Moreover, with a typeless representation for XML documents, it becomes difficult or even impossible to statically capture program invariants that are related to the type information of XML documents. Building upon our recent work on guarded recursive datatypes, we present an approach to representing XML documents in this paper that not only allows the type information of an XML document to be reflected in the type of the representation of the document but also significantly reduces the need for representation tags that are required in typeless representations. With this approach, we become able to process XML documents in a typeful manner, thus reaping various well-known software engineering benefits from the presence of types.

Partially supported by NSF grants no. CCR-0224244 and no. CCR-0229480

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. Atanassow, F., Clarke, D., Jeuring, J.: Scripting XML with Generic Haskell. In: Proceedings of Simposio Brasileiro de Linguagens de Programacao (SBLP 2003), Ouro Preto, Brazil (May 2003)

    Google Scholar 

  2. Clarke, D., Hinze, R., Jeuring, J., Löh, A., Meertens, L., Swierstra, D.: Generic Haskell, Available at http://www.generic-haskell.org/

  3. Hosoya, H., Pierce, B.C.: XDuce: A Typed XML Processing Language. In: Suciu, D., Vossen, G. (eds.) WebDB 2000. LNCS, vol. 1997, p. 226. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  4. Jeuring, J., Hagg, P.: Generic Programming for XML Tools. Technical Report UU-CS-2002-023, Utrecht University (2002)

    Google Scholar 

  5. Meijer, E., Shields, M.: XMLambda: A functional language for constructing and manipulating XML documents (1999)

    Google Scholar 

  6. Milner, R., Tofte, M., Harper, R.W., MacQueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997) (revised)

    Google Scholar 

  7. Milo, T., Suciu, D., Vianu, V.: Typechecking for XML Transformers. In: Proceedings of the Nineteenth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, pp. 11–22. ACM, New York (2000)

    Chapter  Google Scholar 

  8. OASIS Technical Committee. RELAX NG Specification (December 2001), Available at http://www.oasis-open.org/committees/relax-ng/spec-20011203.html

  9. Peyton Jones, S., et al.: Haskell 98 – A non-strict, purely functional language (February 1999), Available at http://www.haskell.org/onlinereport/

  10. Siméon, J., Wadler, P.: The Essence of XML. In: Proceedings of the 30th ACM SIGPLAN Symposium on Principles of Programming Languages, January 2003, pp. 1–13 (2003)

    Google Scholar 

  11. Thiemann, P.: A typed representation for HTML and XML documents in Haskell. Journal of functional programming 12(4&5), 435–468 (2002)

    MATH  MathSciNet  Google Scholar 

  12. Wallace, M., Runciman, C.: Haskell and XML: Generic Combinators or Type- Based Translation? In: Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Programming (ICFP 1999), vol. 34-9, pp. 148–159. ACM Press, New York (1999)

    Chapter  Google Scholar 

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

  14. World Wide Web Consortium. XML Schema Part 1: Structures. W3C Recommendation, May 2 (2001), Available at http://www.w3.org/TR/xmlschema-1

  15. World Wide Web Consortium. XML Schema Part 2: Datatypes. W3C Recommendation, May 2 (2001), Available at http://www.w3.org/TR/xmlschema-2

  16. Xi, H.: Dependent Types in Practical Programming. PhD thesis, Carnegie Mellon University, pp. viii+189 (1998), Available as http://www.cs.cmu.edu/~hwxi/DML/thesis.ps

  17. Xi, H., Chen, C., Chen, G.: Guarded recursive datatype constructors. In: Proceedings of the 30th ACM SIGPLAN Symposium on Principles of Programming Languages, New Orleans, January 2003, pp. 224–235 (2003)

    Google Scholar 

  18. Xi, H., Pfenning, F.: Dependent types in practical programming. In: Proceedings of ACM SIGPLAN Symposium on Principles of Programming Languages, San Antonio, Texas, January 1999, pp. 214–227 (1999)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Zhu, D., Xi, H. (2003). A Typeful and Tagless Representation for XML Documents. In: Ohori, A. (eds) Programming Languages and Systems. APLAS 2003. Lecture Notes in Computer Science, vol 2895. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-40018-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-40018-9_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20536-4

  • Online ISBN: 978-3-540-40018-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics