/** * the default implementation can just refer to the owning document */ public IDOMModel getModel() { if (this.ownerDocument == null) return null; return this.ownerDocument.getModel(); }
/** * createDocument method * * @return org.w3c.dom.Document */ protected Document internalCreateDocument() { DocumentImpl document = new DocumentImpl(); document.setModel(this); return document; }
/** */ private void setActive(Object active) { this.active = active; // side effect // when ever becomes active, besure tagNameCache is cleared // (and not used) if (active == null) { document.activateTagNameCache(true); } else { document.activateTagNameCache(false); } }
/** * cloneNode method * * @return org.w3c.dom.Node * @param deep * boolean */ public Node cloneNode(boolean deep) { DocumentImpl cloned = new DocumentImpl(this); if (deep) cloned.importChildNodes(this, true); return cloned; }
/** */ protected void importChildNodes(Node parent, boolean deep) { if (parent == null) return; removeChildNodes(); for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) { Node imported = importNode(child, deep); if (imported == null) continue; appendChild(imported); } }
protected void setModel(IDOMModel model) { super.setModel(model); } }
/** * @param tagName */ protected void checkTagNameValidity(String tagName) { if (!isValidName(tagName)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, createDOMExceptionMessage(DOMException.INVALID_CHARACTER_ERR, tagName)); } }
/** */ public Element createElementNS(String uri, String tagName) throws DOMException { if (!isValidName(tagName)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, new String()); } ElementImpl element = (ElementImpl) createElement(tagName); element.setNamespaceURI(uri); return element; }
public Element createCommentElement(String tagName, boolean isJSPTag) throws DOMException { Element result = null; if (!isJSPType() && isJSPTag) { throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, new String()); } ElementImpl element = (ElementImpl) createElement(tagName); element.setJSPTag(isJSPTag); CommentElementRegistry registry = CommentElementRegistry.getInstance(); if (registry.setupCommentElement(element)) { result = element; } else { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, new String()); } return result; }
/** */ public Element getElementById(String id) { if (id == null) return null; NodeIterator it = createNodeIterator(this, NodeFilter.SHOW_ALL, null, false); if (it == null) return null; for (Node node = it.nextNode(); node != null; node = it.nextNode()) { if (node.getNodeType() != ELEMENT_NODE) continue; ElementImpl element = (ElementImpl) node; String value = element.getAttribute("id");//$NON-NLS-1$ if (value != null && value.equals(id)) return element; } return null; }
Element childNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + elementTag); if (getAttributes() != null) Text textNode = getDocument().createTextNode("\n\n"); //$NON-NLS-1$ parentNode.appendChild(textNode); Text textNode = getDocument().createTextNode("\n\n"); //$NON-NLS-1$ parentNode.insertBefore(textNode, getRelativeNode());
/** * createElement method * * @return org.w3c.dom.Element * @param tagName * java.lang.String */ public Element createElement(String tagName) throws DOMException { checkTagNameValidity(tagName); ElementImpl element = new ElementImpl(); element.setOwnerDocument(this); element.setTagName(tagName); return element; }
return new NodeListImpl(); NodeIterator it = createNodeIterator(this, NodeFilter.SHOW_ALL, null, false); if (it == null) return new NodeListImpl();
public void endRecording() { DocumentImpl doc = getDocument(); doc.getModel().endRecording(this); }
private NodeListImpl internalGetElementsByTagName(String tagName) { // System.out.println("getElementsByTagname: " + tagName); NodeIterator it = createNodeIterator(this, NodeFilter.SHOW_ALL, null, false); if (it == null) return new NodeListImpl(); NodeListImpl elements = new NodeListImpl(); if (tagName.length() == 1 && tagName.charAt(0) == '*') { tagName = null; // do not care } for (Node node = it.nextNode(); node != null; node = it.nextNode()) { if (node.getNodeType() != ELEMENT_NODE) continue; if (tagName != null) { ElementImpl element = (ElementImpl) node; if (!element.matchTagName(tagName)) continue; } elements.appendNode(node); } if (usetagnamecache) { tagNameCache.addItem(tagName, elements); } return elements; }
/** * notifyValueChanged method */ protected void notifyNameChanged() { if (this.ownerElement == null) return; DocumentImpl document = (DocumentImpl) this.ownerElement.getContainerDocument(); if (document == null) return; DOMModelImpl model = (DOMModelImpl) document.getModel(); if (model == null) return; model.nameChanged(this); }
if (document == null) return new NodeListImpl(); NodeIterator it = document.createNodeIterator(this, NodeFilter.SHOW_ALL, null, false); if (it == null) return new NodeListImpl();
/** */ public void notifyStartTagChanged() { DocumentImpl document = (DocumentImpl) getContainerDocument(); if (document == null) return; DOMModelImpl model = (DOMModelImpl) document.getModel(); if (model == null) return; model.startTagChanged(this); }
if (document == null) return new NodeListImpl(); NodeIterator it = document.createNodeIterator(this, NodeFilter.SHOW_ALL, null, false); if (it == null) return new NodeListImpl();
/** * notifyValueChanged method */ public void notifyEndTagChanged() { DocumentImpl document = (DocumentImpl) getContainerDocument(); if (document == null) return; DOMModelImpl model = (DOMModelImpl) document.getModel(); if (model == null) return; model.endTagChanged(this); }