XML Manipulation with Apache AXIOM

Explore how to process Axiom and how to serialize Axiom into an output stream. Also learn to use the Axiom APIs for processing SOAP.

With the popularity of Apache Axis2, Axiom also got a good attention. One of the cool things is that you don't need to have Axis2 to use Axiom, you can download Axiom separately and use specifically. Axiom is used in a number of Apache project and other project in addition to Apache Axis2. In the first part of the article I discussed Pull and Push parser technology as well as gave an Axiom overview. I also showed how to create Axiom in various ways and how to work with attributes and namespaces. So if you followed the first part, then you have good background knowledge to follow this article. If you have not followed the first part then it is recommended that you read it before continuing.



Tree Navigation


Navigating the object structure can be done in the usual way by using the list of children (similar to any of the XML processing tool). However in Axiom, the child nodes are returned as an iterator. The idea of iterator is to support “Pull parsing” and ”On-Demand” building, so only the element you asked for will be read into the memory. Others will remain untouched. The following code sample shows how the children can be accessed. The children are of the type OMNode and can either be of type OMText or OMElement.

Get all Nodes



Iterator children = root.getChildren();
while(children.hasNext()){
OMNode node = (OMNode)children.next();
}


Get Only Elements


You can use following code to all child OMElement for a given Element, in this case you will not get any OMText element.




Iterator children = root.getChildElements();
while(children.hasNext()){
OMElement node = (OMElement)children.next();
}


Get Element by Name


Read the Rest of this Article at Developer.com

Related Articles
- "Just Add Linux": The Union of Commercial and Open Source Software into Existing Business Models
With open source taking off in the marketplace, new business models for vendors providing value-added services mix and match commercial and open technologies to increase market reach.
- Apache AXIOM
Regional Articles
- XML Manipulation with Apache AXIOM Alabama
- XML Manipulation with Apache AXIOM Alaska
- XML Manipulation with Apache AXIOM Arizona
- XML Manipulation with Apache AXIOM Arkansas
- XML Manipulation with Apache AXIOM California
- XML Manipulation with Apache AXIOM Colorado
- XML Manipulation with Apache AXIOM Connecticut
- XML Manipulation with Apache AXIOM DC
- XML Manipulation with Apache AXIOM Delaware
- XML Manipulation with Apache AXIOM Florida
- XML Manipulation with Apache AXIOM Georgia
- XML Manipulation with Apache AXIOM Hawaii
- XML Manipulation with Apache AXIOM Idaho
- XML Manipulation with Apache AXIOM Illinois
- XML Manipulation with Apache AXIOM Indiana
- XML Manipulation with Apache AXIOM Iowa
- XML Manipulation with Apache AXIOM Kansas
- XML Manipulation with Apache AXIOM Kentucky
- XML Manipulation with Apache AXIOM Louisiana
- XML Manipulation with Apache AXIOM Maine
- XML Manipulation with Apache AXIOM Maryland
- XML Manipulation with Apache AXIOM Massachusetts
- XML Manipulation with Apache AXIOM Michigan
- XML Manipulation with Apache AXIOM Minnesota
- XML Manipulation with Apache AXIOM Mississippi
- XML Manipulation with Apache AXIOM Missouri
- XML Manipulation with Apache AXIOM Montana
- XML Manipulation with Apache AXIOM Nebraska
- XML Manipulation with Apache AXIOM Nevada
- XML Manipulation with Apache AXIOM New Hampshire
- XML Manipulation with Apache AXIOM New Jersey
- XML Manipulation with Apache AXIOM New Mexico
- XML Manipulation with Apache AXIOM New York
- XML Manipulation with Apache AXIOM North Carolina
- XML Manipulation with Apache AXIOM North Dakota
- XML Manipulation with Apache AXIOM Ohio
- XML Manipulation with Apache AXIOM Oklahoma
- XML Manipulation with Apache AXIOM Oregon
- XML Manipulation with Apache AXIOM Pennsylvania
- XML Manipulation with Apache AXIOM Rhode Island
- XML Manipulation with Apache AXIOM South Carolina
- XML Manipulation with Apache AXIOM South Dakota
- XML Manipulation with Apache AXIOM Tennessee
- XML Manipulation with Apache AXIOM Texas
- XML Manipulation with Apache AXIOM Utah
- XML Manipulation with Apache AXIOM Vermont
- XML Manipulation with Apache AXIOM Virginia
- XML Manipulation with Apache AXIOM Washington
- XML Manipulation with Apache AXIOM West Virginia
- XML Manipulation with Apache AXIOM Wisconsin
- XML Manipulation with Apache AXIOM Wyoming
Related Articles
- "Just Add Linux": The Union of Commercial and Open Source Software into Existing Business Models
With open source taking off in the marketplace, new business models for vendors providing value-added services mix and match commercial and open technologies to increase market reach.
- Apache AXIOM

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML