diff options
author | david_williams | 2005-04-14 14:05:08 +0000 |
---|---|---|
committer | david_williams | 2005-04-14 14:05:08 +0000 |
commit | 838590bc055f3e6b2047a134b0dd3cc1ee81c398 (patch) | |
tree | 58fb891d2a696fcc5d018ef514f7ff9f51fd2045 /bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal | |
parent | 6e7aad0e3c63c0c1d8569b4713daab175809232f (diff) | |
download | webtools.sourceediting-838590bc055f3e6b2047a134b0dd3cc1ee81c398.tar.gz webtools.sourceediting-838590bc055f3e6b2047a134b0dd3cc1ee81c398.tar.xz webtools.sourceediting-838590bc055f3e6b2047a134b0dd3cc1ee81c398.zip |
changes to co-exist with xerces and various DOM levels
Diffstat (limited to 'bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal')
6 files changed, 311 insertions, 20 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DOMModelImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DOMModelImpl.java index 95e3ef10dd..6a04794d5c 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DOMModelImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DOMModelImpl.java @@ -905,4 +905,11 @@ public class DOMModelImpl extends AbstractStructuredModel implements IStructured } getModelNotifier().valueChanged(node); } + + /** + * NOT IMPLEMENTED. Is defined here in preparation of DOM 3. + */ + public Object getFeature(String feature, String version) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + } } diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java index efc2109f4a..3a9f765f48 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java @@ -35,6 +35,7 @@ import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; +import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.DocumentFragment; @@ -97,10 +98,10 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { NodeListImpl result = null; if (active) { result = (NodeListImpl) cache.get(tagName); - // if (result != null) { - // System.out.println("getElementsByTagname from cache: " + + // if (result != null) { + // System.out.println("getElementsByTagname from cache: " + // tagName); - // } + // } } return result; } @@ -275,7 +276,7 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { public CDATASection createCDATASection(String data) throws DOMException { // allow CDATA section // if (!isXMLType()) { - // throw new DOMException(DOMException.NOT_SUPPORTED_ERR, new + // throw new DOMException(DOMException.NOT_SUPPORTED_ERR, new // String()); // } CDATASectionImpl cdata = new CDATASectionImpl(); @@ -315,7 +316,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { CommentElementRegistry registry = CommentElementRegistry.getInstance(); if (registry.setupCommentElement(element)) { return element; - } else { + } + else { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, new String()); } } @@ -476,7 +478,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == DOCUMENT_TYPE_NODE && child instanceof DocumentType) { return (DocumentType) child; - } else if (child.getNodeType() == ELEMENT_NODE && ((IDOMElement) child).isCommentTag()) { + } + else if (child.getNodeType() == ELEMENT_NODE && ((IDOMElement) child).isCommentTag()) { // search DOCTYPE inside of generic comment element DocumentType docType = findDoctype(child); if (docType != null) { @@ -497,7 +500,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { Element docElement = findDocumentElement(docName, element, firstFound); if (docElement != null) { return docElement; - } else { + } + else { // added 'else continue' to better handle cases where // there is "more than one root" element // especially complicated by CommentElements, which are @@ -521,7 +525,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { if (isXMLType()) { if (localName.equals(docName)) return element; - } else { + } + else { if (localName.equalsIgnoreCase(docName)) return element; } @@ -554,7 +559,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { if (name.charAt(1) == 'x') { // hexadecimal radix = 16; s = name.substring(2); - } else { // decimal + } + else { // decimal s = name.substring(1); } if (s == null || s.length() == 0) @@ -564,7 +570,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { char c = 0; try { c = (char) Integer.parseInt(s, radix); - } catch (NumberFormatException ex) { + } + catch (NumberFormatException ex) { } if (c == 0) return null; @@ -666,14 +673,14 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { /** */ protected DocumentTypeAdapter getDocumentTypeAdapter() { - // be sure to release since possibly changing - if(this.documentTypeAdapter != null) { - this.documentTypeAdapter.release(); - } - this.documentTypeAdapter = (DocumentTypeAdapter) getAdapterFor(DocumentTypeAdapter.class); + // be sure to release since possibly changing + if (this.documentTypeAdapter != null) { + this.documentTypeAdapter.release(); + } + this.documentTypeAdapter = (DocumentTypeAdapter) getAdapterFor(DocumentTypeAdapter.class); if (this.documentTypeAdapter == null) { // add default adapter - this.documentTypeAdapter = new DocumentTypeAdapterImpl(this); + this.documentTypeAdapter = new DocumentTypeAdapterImpl(this); addAdapter(this.documentTypeAdapter); } return this.documentTypeAdapter; @@ -908,7 +915,7 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { } private NodeListImpl internalGetElementsByTagName(String tagName) { - //System.out.println("getElementsByTagname: " + tagName); + // System.out.println("getElementsByTagname: " + tagName); NodeIterator it = createNodeIterator(this, NodeFilter.SHOW_ALL, null, false); if (it == null) return new NodeListImpl(); @@ -966,8 +973,8 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { protected boolean isValidName(String name) { if (name == null || name.length() == 0) return false; - // // DMW: modified for XML4J 4.0.1 - // if (XMLChar.isValidName(name)) return true; + // // DMW: modified for XML4J 4.0.1 + // if (XMLChar.isValidName(name)) return true; if (NameValidator.isValid(name)) return true; // special for invalid declaration @@ -1067,4 +1074,81 @@ public class DocumentImpl extends NodeContainer implements IDOMDocument { */ public void setVersion(java.lang.String version) { } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public String getInputEncoding() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public String getXmlEncoding() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public boolean getXmlStandalone() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void setXmlStandalone(boolean xmlStandalone) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public String getXmlVersion() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void setXmlVersion(String xmlVersion) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public String getDocumentURI() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void setDocumentURI(String documentURI) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public DOMConfiguration getDomConfig() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void normalizeDocument() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implmented in this version"); + } } diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java index ed74ec87ee..801e4f6209 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java @@ -14,7 +14,6 @@ package org.eclipse.wst.xml.core.internal.document; - import java.util.Iterator; import org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser; @@ -1443,4 +1442,25 @@ public class ElementImpl extends NodeContainer implements IDOMElement { } return buffer.toString(); } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void setIdAttribute(String name, boolean isId) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not supported in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not supported in this version"); + } + + /** + * NOT IMPLEMENTED. Is defined here in preparation for DOM 3. + */ + public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not supported in this version"); + } } diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java index 80e5d6fdbd..254faa8bf2 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java @@ -224,4 +224,18 @@ public class EntityImpl extends NodeImpl implements Entity { */ public void setVersion(java.lang.String version) { } + + public String getInputEncoding() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version"); + } + + public String getXmlEncoding() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version"); + } + + + public String getXmlVersion() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version"); + } + } diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java index 377496b822..41ce8de05a 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java @@ -30,6 +30,8 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; +import org.w3c.dom.TypeInfo; +import org.w3c.dom.UserDataHandler; /** @@ -822,4 +824,104 @@ public abstract class NodeImpl extends AbstractNotifier implements IDOMNode { } return result; } + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public short compareDocumentPosition(Node other) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public String getBaseURI() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public Object getFeature(String feature, String version) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public String getTextContent() throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public Object getUserData(String key) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public boolean isDefaultNamespace(String namespaceURI) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public boolean isEqualNode(Node arg) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public boolean isSameNode(Node other) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public String lookupNamespaceURI(String prefix) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public String lookupPrefix(String namespaceURI) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public void setTextContent(String textContent) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public Object setUserData(String key, Object data, UserDataHandler handler) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public TypeInfo getSchemaTypeInfo() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + /** + * NOT IMPLEMENTED, is defined here in preparation of DOM Level 3 + */ + public boolean isId() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented in this version."); + }; + + } diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/TextImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/TextImpl.java index 2f057988c0..d877c2d002 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/TextImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/TextImpl.java @@ -636,6 +636,20 @@ public class TextImpl extends CharacterDataImpl implements IDOMText { } /** + * Returns whether this text node contains <a + * href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'> + * element content whitespace</a>, often abusively called "ignorable + * whitespace". The text node is determined to contain whitespace in + * element content during the load of the document or if validation occurs + * while using <code>Document.normalizeDocument()</code>. + * + * @since DOM Level 3 + */ + public boolean isElementContentWhitespace() { + return isWhitespace(); + } + + /** */ public boolean isWhitespace() { String data = getData(); @@ -1111,4 +1125,54 @@ public class TextImpl extends CharacterDataImpl implements IDOMText { String second = (end < length ? source.substring(end, length) : null); return new StringPair(first, second); } + + public String getWholeText() { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not Implemented in this version."); + } + /** + * Replaces the text of the current node and all logically-adjacent text + * nodes with the specified text. All logically-adjacent text nodes are + * removed including the current node unless it was the recipient of the + * replacement text. <br> + * This method returns the node which received the replacement text. The + * returned node is: + * <ul> + * <li><code>null</code>, when the replacement text is the empty + * string; </li> + * <li>the current node, except when the current node is read-only; </li> + * <li> a new <code>Text</code> node of the same type ( + * <code>Text</code> or <code>CDATASection</code>) as the current + * node inserted at the location of the replacement. </li> + * </ul> + * <br> + * For instance, in the above example calling + * <code>replaceWholeText</code> on the <code>Text</code> node that + * contains "bar" with "yo" in argument results in the following: <br> + * Where the nodes to be removed are read-only descendants of an + * <code>EntityReference</code>, the <code>EntityReference</code> + * must be removed instead of the read-only nodes. If any + * <code>EntityReference</code> to be removed has descendants that are + * not <code>EntityReference</code>, <code>Text</code>, or + * <code>CDATASection</code> nodes, the <code>replaceWholeText</code> + * method must fail before performing any modification of the document, + * raising a <code>DOMException</code> with the code + * <code>NO_MODIFICATION_ALLOWED_ERR</code>. <br> + * For instance, in the example below calling + * <code>replaceWholeText</code> on the <code>Text</code> node that + * contains "bar" fails, because the <code>EntityReference</code> node + * "ent" contains an <code>Element</code> node which cannot be removed. + * + * @param content + * The content of the replacing <code>Text</code> node. + * @return The <code>Text</code> node created with the specified + * content. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the + * <code>Text</code> nodes being replaced is readonly. + * @since DOM Level 3 + */ + public Text replaceWholeText(String content) + throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Not implemented"); + } } |