*/
public OMElement createOMElement(String localName, OMNamespace ns,
OMContainer parent, OMXMLParserWrapper builder) {
switch (((ParentNode) parent).getNodeType()) {
case Node.ELEMENT_NODE: // We are adding a new child to an elem
ElementImpl parentElem = (ElementImpl) parent;
ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
.getOwnerDocument(), localName, (NamespaceImpl) ns, builder);
parentElem.appendChild(elem);
return elem;
case Node.DOCUMENT_NODE:
DocumentImpl docImpl = (DocumentImpl) parent;
ElementImpl elem2 = new ElementImpl(docImpl, localName,
(NamespaceImpl) ns, builder);
docImpl.appendChild(elem2);
return elem2;
case Node.DOCUMENT_FRAGMENT_NODE:
DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl) parent;
ElementImpl elem3 = new ElementImpl((DocumentImpl) docFragImpl
.getOwnerDocument(), localName, (NamespaceImpl) ns, builder);
return elem3;
default:
throw new OMDOMException(
"The parent container can only be an ELEMENT, DOCUMENT " +