Axiom User Guide


Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Table of Contents

1. Introduction
What is Axiom?
For whom is this Tutorial?
What is Pull Parsing?
A Bit of History
Features of Axiom
Relation with StAX
A Bit About Caching
Where Does SOAP Come into Play?
2. Working with Axiom
Obtaining the Axiom Binary
Creating an object model programmatically
Creating an object model by parsing an XML document
Complete Code for the Axiom based Document Building and Serialization
Creating stream readers and writers using StAXUtils
Releasing the parser
Exception handling
3. Advanced Operations with Axiom
Accessing the Pull Parser
4. Integrating Axiom into your project
Using Axiom in a Maven 2 project
Adding Axiom as a dependency
Managing the JAF dependency
Applying application wide configuration
Changing the default StAX factory settings
Migrating from older Axiom versions
5. Common mistakes, problems and anti-patterns
Violating the javax.activation.DataSource contract
Issues that magically disappear
The OM-inside-OMDataSource anti-pattern
Weak version
Strong version
6. Appendix
Program Listing for Build and Serialize

List of Figures

1.1. Architecture overview
2.1. The Axiom API with different implementations

List of Examples

2.1. Creating an object model programmatically
2.2. Usage of addChild
2.3. Creating an object model from an input stream
2.4. Creating an OM document with namespaces
5.1. DataSource implementation that violates the interface contract
5.2. OMDataSource#getReader() implementation used in older ADB versions