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
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
Clarke, D., Hinze, R., Jeuring, J., Löh, A., Meertens, L., Swierstra, D.: Generic Haskell, Available at http://www.generic-haskell.org/
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)
Jeuring, J., Hagg, P.: Generic Programming for XML Tools. Technical Report UU-CS-2002-023, Utrecht University (2002)
Meijer, E., Shields, M.: XMLambda: A functional language for constructing and manipulating XML documents (1999)
Milner, R., Tofte, M., Harper, R.W., MacQueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997) (revised)
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)
OASIS Technical Committee. RELAX NG Specification (December 2001), Available at http://www.oasis-open.org/committees/relax-ng/spec-20011203.html
Peyton Jones, S., et al.: Haskell 98 – A non-strict, purely functional language (February 1999), Available at http://www.haskell.org/onlinereport/
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)
Thiemann, P.: A typed representation for HTML and XML documents in Haskell. Journal of functional programming 12(4&5), 435–468 (2002)
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)
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
World Wide Web Consortium. XML Schema Part 1: Structures. W3C Recommendation, May 2 (2001), Available at http://www.w3.org/TR/xmlschema-1
World Wide Web Consortium. XML Schema Part 2: Datatypes. W3C Recommendation, May 2 (2001), Available at http://www.w3.org/TR/xmlschema-2
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
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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