", OMXMLBuilderFactory.createOMBuilder().getDocumentElement() creates OMElement of . what I need is OMElement of ", OMXMLBuilderFactory.createOMBuilder().getDocumentElement() creates OMElement of . what I need is OMElement of ", OMXMLBuilderFactory.createOMBuilder().getDocumentElement() creates OMElement of . what I need is OMElement of

OMXMLBuilderFactory.createOMBuilder().getDocumentElement() creates empty elements for elements witout a body

35 Views Asked by At

When I pass the string "<a></a>", OMXMLBuilderFactory.createOMBuilder().getDocumentElement() creates OMElement of <a/>. what I need is OMElement of <a></a>. Is there a configuration for this? Tried StAXParserConfiguration but no configurations were found.

1

There are 1 best solutions below

0
Andreas Veithen On

<a></a> and <a/> are two strictly equivalent representations of an empty element with name a. Axiom (just like DOM and most other XML APIs for that matter) doesn't store the details of how that empty element was represented in the input document, so given <a></a> as input, it may produce <a/> as output.