Web / Apache Axiom Interview questions
What is OMText used for?
OMText represents a run of character data attached to an element - the Axiom equivalent of a DOM text node - but it's also the vehicle Axiom uses for CDATA sections and, notably, binary attachment content.
For ordinary text, omText.getText() returns the string content directly, the same as reading any character data node in another XML API.
For binary content, an OMText can instead wrap a DataHandler (from the Jakarta/JavaBeans Activation Framework) and be flagged as binary; getDataHandler() then exposes the underlying bytes, and on serialization this content can be optimized into an MTOM attachment rather than inlined as base64 text.
This dual role - plain text and binary payload carrier - is one of the more distinctive design choices in Axiom compared to more general-purpose XML APIs, and it's central to how the library supports efficient SOAP attachments.
More Related questions...