Web / Apache Axiom Interview questions
What is OMSourcedElement?
OMSourcedElement is a special kind of OMElement whose content comes from an arbitrary OMDataSource rather than from parsing XML text - it lets non-XML data masquerade as an XML element until it's actually needed in XML form.
A common use case is databinding: a JAXB-generated Java object can be wrapped in an OMDataSource and exposed as an OMSourcedElement, so the object-to-XML conversion only happens if and when the element is actually serialized or otherwise navigated as XML.
This is particularly valuable in Axis2 message-processing pipelines, where a message often passes through several phases untouched - generating its XML representation eagerly, only to discard it if the pivot logic never actually needs the payload as XML, would be wasted work that OMSourcedElement avoids.
From the outside, an OMSourcedElement behaves like any other OMElement to calling code; the deferred, data-source-backed nature is largely an implementation detail unless you're the one implementing a custom OMDataSource.
More Related questions...