Java Integration
Transform Anything with Java
Working on XML with Java
Java plays a key role in XML technologies. Most of the integration tools are now built based on XML and java. This makes it extremely important for a developer to understand how it is being done.
Eg : BPEL Process Manager is completely XML based. The execution engine uses its custom XML parser to execute the program. The first aspect we need to consider is to choose the right parser. Below are the major factors affecting the decision.
-
Speed
-
Memory Usage
-
Complexity of XML
-
Requirement
Types of XML Processors
-
Tree Based
-
Streaming
-
Binding
Tree Based Processors can represent the entire XML object as a tree. We can traverse backwards and forward. We can use XPATH to parse through the XML. But it is more memory consuming and slower. (Eg: DOM)
Streaming method parse XML one node at a dime. They are divided into pull and push processors. It is fast and efficient. It does not occupy much of a memory, but XPATH cannot be used. The coding is a little comples.(Eg: SAX, StAX)
Binding parsers work like DOM in the background. Moreover it is simple to code and easy to maintain.(Eg: JAXB)
Common Parsers
-
SAX(Simple API for XML)
-
DOM(Document Object Model)
-
StAX(Streaming API for XML)
-
TrAX(Transformation API for XML)
Below are samples for XML integration using Java