Abstract
XML transformations are most naturally defined as recursive functions on trees. A naive implementation, however, would load the entire input XML tree into memory before processing. In contrast, programs in stream processing style minimise memory usage since it may release the memory occupied by the processed prefix of the input, but they are harder to write because the programmer is left with the burden to maintain a state. In this paper, we propose a model for XML stream processing and show that all programs written in a particular style of recursive functions on XML trees, the macro forest transducer, can be automatically translated to our stream processors. The stream processor is declarative in style, but can be implemented efficiently by a pushdown machine. We thus get the best of both worlds — program clarity, and efficiency in execution.
Partially supported by Comprehensive Development of e-Society Foundation Software of the Ministry of Education, Culture, Sports, Science and Technology, Japan.
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
Altinel, M., Franklin, M.J.: Efficient filtering of XML documents for selective dissemination of information. International Journal on Very Large Data Bases, 53–64 (2000)
Benzaken, V., Castagna, G., Frisch, A.: CDuce: an XML-centric general-purpose language. In: Proceedings of the 8th International Conference of Functional Programming, pp. 51–63 (2003)
Berlea, A., Seidl, H.: fxt – a transformation language for XML documents. Journal of Computing and Information Technology 10(1), 19–35 (2002)
Cimprich, P., Becker, O., Nentwich, C., Jiroušek, M.K.H., Brown, P., Batsis, M., Kaiser, T., Hlavnička, P., Matsakis, N., Dolph, C., Wiechmann, N.: Streaming transformations for XML (STX) version 1.0., http://stx.sourceforge.net/
Diao, Y., Franklin, M.J.: High-performance XML filtering: An overview of YFilter. IEEE Data Engineering Bulletin 26(1), 41–48 (2003)
Engelfriet, J., Vogler, H.: Macro tree transducers. Journal of Computer and System Sciences 31(1), 71–146 (1985)
The Glasgow Haskell Compiler, http://www.haskell.org/ghc/
Green, T.J., Gupta, A., Miklau, G., Onizuka, M., Suciu, D.: Processing XML streams with deterministic automata and stream indexes. ACM Transactions on Database Systems 29(4), 752–788 (2004)
Gupta, A.K., Suciu, D.: Stream processing of XPath queries with predicates. In: Proceedings of the 2003 ACM SIGMOD International Conference on Management of Data, pp. 419–430 (2003)
Hosoya, H., Pierce, B.C.: Regular expression pattern matching for XML. Journal of Functional Programming 13(6), 961–1004 (2003)
Hosoya, H., Pierce, B.C.: XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology 3(2), 117–148 (2003)
Jones, S.P.: Space usage. Glasgow Haskell Users Mailing List (August 17, 2004), http://www.haskell.org/pipermail/glasgow-haskell-users/2004-August/007023.html
Kay, M.: SAXON: The XSLTand XQuery processor, http://saxon.sourceforge.net/
Kiselyov, O.: A better XML parser through functional programming. In: Krishnamurthi, S., Ramakrishnan, C.R. (eds.) PADL 2002. LNCS, vol. 2257, pp. 209–224. Springer, Heidelberg (2002)
Kodama, K., Suenaga, K., Kobayashi, N.: Translation of tree-processing programs into stream-processing programs based on ordered linear type. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 41–56. Springer, Heidelberg (2004)
Ludäscher, B., Mukhopadhyay, P., Papakonstantinou, Y.: A transducer-based XML query processor. In: Proceedings of 28th International Conference on Very Large Data Bases, pp. 227–238 (2002)
Maneth, S., Berlea, A., Perst, T., Seidl, H.: XML type checking with macro tree transducers. In: Proceedings of 24th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, pp. 283–294 (2005)
Murata, M.: Extended path expressions of XML. In: Proceedings of the 20th ACM Symp. on Principles of Database Systems, pp. 153–166 (2001)
Nakano, K.: XTiSP: XML transformation language intended for stream processing, http://xtisp.org/
Nakano, K.: Composing stack-attributed transducers. Technical Report METR-2004-01, Department of Mathematical Informatics. University of Tokyo (2004)
Nakano, K.: An implementation scheme for XML transformation languages through derivation of stream processors. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 74–90. Springer, Heidelberg (2004)
Nakano, K., Mu, S.-C.: A pushdown machine for recursive XML processing (full version), http://www.ipl.t.u-tokyo.ac.jp/~ksk/en/?Publication
The nhc98 compiler, http://www.haskell.org/nhc98/
Nishimura, S.: Fusion with stacks and accumulating prameters. In: The 2004 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation, pp. 101–112 (2004)
Nishimura, S., Nakano, K.: XML stream transformer generation through program composition and dependency analysis. Science of Computer Programming 54, 257–290 (2005)
Perst, T., Seidl, H.: Macro forest transducers. Information Processing Letters 89, 141–149 (2004)
Scherzinger, S., Kemper, A.: Syntax-directed transformations of XML streams. In: Workshop on Programming Language Technologies for XML, pp. 75–86 (2005)
Suenaga, K., Kobayashi, N., Yonezawa, A.: Extension of type-based approach to generation of stream-processing programs by automatic insertion of buffering primitives. In: Hill, P.M. (ed.) LOPSTR 2005. LNCS, vol. 3901, pp. 98–114. Springer, Heidelberg (2006)
Wadler, P.: Fixing a space leak with a garbage collector. Software Practice and Experience 17(9), 595–608 (1987)
Wadler, P.: Deforestation: Transforming programs to eliminate trees. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 344–358. Springer, Heidelberg (1988)
libxslt: the XSLT C library for Gnome, http://xmlsoft.org/XSLT/
SAX: the simple API for XML, http://www.saxproject.org/
XMark: an XML benchmark project, http://www.xml-benchmark.org/
XSL: transformations (XSLT), http://www.w3c.org/TR/xslt/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Nakano, K., Mu, SC. (2006). A Pushdown Machine for Recursive XML Processing. In: Kobayashi, N. (eds) Programming Languages and Systems. APLAS 2006. Lecture Notes in Computer Science, vol 4279. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11924661_21
Download citation
DOI: https://doi.org/10.1007/11924661_21
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-48937-5
Online ISBN: 978-3-540-48938-2
eBook Packages: Computer ScienceComputer Science (R0)