public Element createElement(String tagName) throws DOMException { return new ElementImpl(this, tagName, this.factory); }
public OMElement createOMElement(String localName, OMNamespace ns) { return new ElementImpl((DocumentImpl) this.createOMDocument(), localName, (NamespaceImpl) ns, this); }
protected void putExceptionToSOAPFault(Exception e) throws SOAPProcessingException { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); sw.flush(); getDetail(); if (getDetail() == null) { setDetail(getNewSOAPFaultDetail(this)); } OMElement faultDetailEnty = new ElementImpl(this, SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, null, this.factory); faultDetailEnty.setText(sw.getBuffer().toString()); }
public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMDOMException { if (parent == null) { return new ElementImpl((DocumentImpl) this.createOMDocument(), localName, (NamespaceImpl) ns, this); } 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, this); parentElem.appendChild(elem); return elem; case Node.DOCUMENT_NODE: DocumentImpl docImpl = (DocumentImpl) parent; return new ElementImpl(docImpl, localName, (NamespaceImpl) ns, this); case Node.DOCUMENT_FRAGMENT_NODE: DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent; return new ElementImpl((DocumentImpl) docFragImpl .getOwnerDocument(), localName, (NamespaceImpl) ns, this); default: throw new OMDOMException( "The parent container can only be an ELEMENT, DOCUMENT " + "or a DOCUMENT FRAGMENT"); } }
/** Creates an OMElement with the builder. */ 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, this); parentElem.appendChild(elem); return elem; case Node.DOCUMENT_NODE: DocumentImpl docImpl = (DocumentImpl) parent; ElementImpl elem2 = new ElementImpl(docImpl, localName, (NamespaceImpl) ns, builder, this); docImpl.appendChild(elem2); return elem2; case Node.DOCUMENT_FRAGMENT_NODE: DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent; return new ElementImpl((DocumentImpl) docFragImpl .getOwnerDocument(), localName, (NamespaceImpl) ns, builder, this); default: throw new OMDOMException( "The parent container can only be an ELEMENT, DOCUMENT " + "or a DOCUMENT FRAGMENT"); } }
public Element createElementNS(String ns, String qualifiedName) throws DOMException { if (ns == null) ns = ""; String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if(prefix == null) { prefix = ""; } //When the namespace is a default namespace if (prefix != null && !"".equals(prefix)) { this.checkQName(prefix, localName); } NamespaceImpl namespace = new NamespaceImpl(ns, prefix); return new ElementImpl(this, localName, namespace, this.factory); }
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { // TODO Handle docType stuff OMDOMFactory fac = new OMDOMFactory(); DocumentImpl doc = new DocumentImpl(fac); fac.setDocument(doc); new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName), new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName)), fac); return doc; }