public Node cloneNode(boolean deep) { ChildNode newnode = (ChildNode) super.cloneNode(deep); // Need to break the association w/ original kids newnode.previousSibling = null; newnode.nextSibling = null; newnode.isFirstChild(false); newnode.parentNode = null; return newnode; }
public ElementImpl(ParentNode parentNode, String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { this(tagName, ns, builder, factory); if (parentNode != null) { this.ownerNode = (DocumentImpl) parentNode.getOwnerDocument(); this.isOwned(true); parentNode.addChild(this); } }
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; }
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if (!OMConstants.XMLNS_NS_PREFIX.equals(localName)) { this.checkQName(prefix, localName); } else { return this.createAttribute(localName); } return new AttrImpl(this, localName, new NamespaceImpl( namespaceURI, prefix), this.factory); }
/** * Creates a new OMDOM Text node with the given value and appends it to the given parent * element. * * @see org.apache.axiom.om.OMFactory#createOMText( org.apache.axiom.om.OMElement,String) */ public OMText createOMText(OMContainer parent, String text) { ElementImpl parentElem = (ElementImpl) parent; TextImpl txt = new TextImpl((DocumentImpl) parentElem .getOwnerDocument(), text, this); parentElem.addChild(txt); return txt; }
public Attr createAttribute(String name) throws DOMException { if (!DOMUtil.isQualifiedName(name)) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } return new AttrImpl(this, name, this.factory); }
/** * Creates a Character node of the given type. * * @see org.apache.axiom.om.OMFactory#createOMText(String, int) */ public OMText createOMText(String text, int type) { switch (type) { case OMNode.TEXT_NODE: return new TextImpl(this.document, text, this); default: throw new OMDOMException("Only Text nodes are supported right now"); } }
public ElementImpl(String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { this(factory); this.localName = tagName; this.namespace = ns; this.builder = builder; if (ns != null) { this.declareNamespace(ns); } this.attributes = new AttributeMap(this); }
final void isNormalized(boolean value) { // See if flag should propagate to parent. if (!value && isNormalized() && ownerNode != null) { ownerNode.isNormalized(false); } flags = (short) (value ? flags | NORMALIZED : flags & ~NORMALIZED); }
public NodeList getChildNodes() { if (!this.done) { this.build(); } return new NodeListImpl(this, null, null); }
public AttrImpl(DocumentImpl ownerDocument, String localName, OMNamespace ns, String value, OMFactory factory) { super(ownerDocument, factory); this.attrName = localName; this.attrValue = new TextImpl(ownerDocument, value, factory); this.namespace = (NamespaceImpl) ns; }
/** @param ownerDocument */ public ElementImpl(DocumentImpl ownerDocument, String tagName, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.attributes = new AttributeMap(this); this.done = true; }
/** * Retrieves an attribute node by name. * * @see org.w3c.dom.Element#getAttributeNode(String) */ public Attr getAttributeNode(String name) { return (this.attributes == null) ? null : (AttrImpl) this.attributes .getNamedItem(name); }
/** * Removes an attribute from the element. * * @see org.apache.axiom.om.OMElement#removeAttribute (org.apache.axiom.om.OMAttribute) */ public void removeAttribute(OMAttribute attr) { this.removeAttributeNode((AttrImpl) attr); }
/** * Creates a clone which belongs to a new document. * * @see org.apache.axiom.om.OMElement#cloneOMElement() */ public OMElement cloneOMElement() { return (ElementImpl) this.cloneNode(true); }
/** * Returns the owner element. * * @see org.w3c.dom.Attr#getOwnerElement() */ public Element getOwnerElement() { // Owned is set to an element instance when the attribute is added to an // element return (Element) (isOwned() ? parent : null); }
public String toString() { return (this.namespace == null) ? this.attrName : this.namespace .getPrefix() + ":" + this.attrName; }
public OMText createOMText(OMContainer parent, char[] charArary, int type) { ElementImpl parentElem = (ElementImpl) parent; TextImpl txt = new TextImpl((DocumentImpl) parentElem .getOwnerDocument(), charArary, this); parentElem.addChild(txt); return txt; }
public ElementImpl(DocumentImpl ownerDocument, String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.namespace = ns; this.builder = builder; this.declareNamespace(ns); this.attributes = new AttributeMap(this); }