Configuration Aalto StAX Parser For Speed

Overview Aalto provides various configuration options for efficient performance based on environment constraints. In this article, we shall see how to configure Aalto for speed assuming that memory is not a significant constraint. Create employee.xml as shown below. Create TestConfigureSpeed class as shown below. The configuration for speed is defined using XMLInputFactory2.configureForSpeed() (see line 17 … Read more

SAX Extensions Using Aalto

Overview As the name suggests, SAX extensions are an extension to the parsing capabilities of a SAX parser. SAX extensions provide additional capabilities to parse comments, DTD element, CData sections, etc. Additionally, there are several feature related flags (e.g. is-standalone , resolve-dtd-uris , etc.) which can be set. Please refer to the package summary for … Read more

SAX Parsing Using Aalto

Overview SAX parsing is an efficient way to parse XML documents. Unlike DOM (Document Object Model) based parsers, SAX parsers do not load the XML document in memory. SAX parsers use callback methods to let the calling code know about XML related structure. The key interfaces/classes are involved in SAX parsing are listed below: SAXParserFactory: … Read more

XML Generation For Binding Prefix Using Aalto

Overview This article demonstrates how Aalto can be used to bind namespace URI and prefix during XML generation. Create TestBindingPrefix class as shown below. Prefix is bound using the following API methods: XMLStreamWriter2.setDefaultNamespace() to set the default namespace URI (see line 21 below) XMLStreamWriter2.setPrefix() method for setting the prefix and URI(e.g. see line 28 below) … Read more

XML Generation Using Aalto

Overview This article describes how to generate XML using Aalto Aalto StAX Streaming API can be used to generate XML document. The key classes responsible for generating XML content are XMLOutputFactory2 and XMLStreamWriter2 . Create TestGenerateXml class as shown below. Point the outstream to Console output (see line 16 below). The following methods are used … Read more

Asynchronous Parsing Using Aalto: Handling Errors

Overview This article demonstrates how to handle parsing related errors during asynchronous StAX parsing using Aalto. Create employee.xml as shown below. Note that the end tag for ‘salary’ element is incorrect (see line 4 below). Create TestAsyncParsingError class as shown below. The parsing is done using wrapper class (see this article for further details). Catch … Read more

Detailed Asynchronous StAX Parsing Using Aalto: Parsing Comments, Processing Instructions, CData and Entity References

Overview In the earlier article we explored basic asynchronous StAX parsing using Aalto. In this article we shall see how Aalto’s asynchronous StAX parsing can be used to parse XML comments, processing instructions, CData and entity references. Create employee.xml as shown below. It contains comment, processing instruction, CDATA and entity references (see lines 1,3,7-9 and … Read more

Using Aalto Wrapper Class For Asynchronous StAX Parsing

Overview The basics of asynchronous stax parsing using Aalto is covered in the article mentioned here . In that article, you will note that low level buffer manipulation is required to manage asynchronous stax parsing. However, Aalto’s unit test suite provides a very convenient wrapper class that internally handles the details of byte level management … Read more

Basics Of Asynchronous StAX Parsing Using Aalto

Overview Aalto provides a unique feature to parse XML documents asynchronously i.e. the InputStream is not blocked when performing StAX based parsing. For further details, please see Introduction to Asynchronous StAX Parsing Using Aalto This article demonstrates the programming aspects for using the asynchronous parsing feature of Aalto. Create employee.xml as shown below. This XML … Read more