# XB1: XML Infoset API User Guide

## What is it?

In Web services and other applications when XML is used it is important to represent XML in an abstract way. XML Information Set (often called XML Infoset) is a W3C specification that precisely pays this role and defines number of such concepts like Element Information Item (so called eii) that precisely define what is XML element. If you do not know it go read it NOW!

XB1 is an Java API for XML Infoset that strives to provide a straightforward translation of XML Infoset information items and properties into Java interfaces and methods.

Name XB1 stands for XML Builder Version One as a second role XB1 API plays is to allow easy construction of XML documents in an incremental way. Typically when creating XML one needs to maintain also Java objects therefore XB1 allows that element children are Objects. Additionally XB1 provides XmlElementAdapter class to easily extend existing Element Information Items with custom methods.

XB1 is interface based so it is possible to swap-in different implementation for example on top of DOM (though that is not a trivial task to do ...)

## Gotcha

Here is list of not so intuitive parts of API

- addChild and addElement works differently! Method addElement will remove added element from other XML tree. However method addChild does not check that added child is an element so it is possible to add element using addChild() that is still in other tree. Beware! This can lead to strange bugs when traversing tree.

## More ...

For more info contact the author.