Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavid_williams2006-06-12 21:29:59 +0000
committerdavid_williams2006-06-12 21:29:59 +0000
commit138ba69f46dbfaff8cd4fdc7a0201ede63fc4342 (patch)
tree01c7a9494cbd73e17ca776ede93a5e0990aa5ae6 /bundles/org.eclipse.wst.html.core/src/org/eclipse
parentdcc1895d677869a41e538501bab3d67e78cce4a0 (diff)
downloadwebtools.sourceediting-138ba69f46dbfaff8cd4fdc7a0201ede63fc4342.tar.gz
webtools.sourceediting-138ba69f46dbfaff8cd4fdc7a0201ede63fc4342.tar.xz
webtools.sourceediting-138ba69f46dbfaff8cd4fdc7a0201ede63fc4342.zip
[119084] Enable external schemas for HTML content model
Diffstat (limited to 'bundles/org.eclipse.wst.html.core/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryCMProvider.java19
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryImpl.java18
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java9
3 files changed, 40 insertions, 6 deletions
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryCMProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryCMProvider.java
index 53ac1d98f7..12418712b7 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryCMProvider.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryCMProvider.java
@@ -28,7 +28,13 @@ import org.w3c.dom.Node;
/**
* CMDocument provider for HTML and XHTML documents.
+ *
+ * This added and/or made public specifically for experimentation. It will
+ * change as this functionality becomes API. See
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=119084
*/
+
+
public class HTMLModelQueryCMProvider implements ModelQueryCMProvider {
@@ -45,8 +51,8 @@ public class HTMLModelQueryCMProvider implements ModelQueryCMProvider {
}
/**
- * Returns the CMDocument that corresponds to the DOM Node.
- * or null if no CMDocument is appropriate for the DOM Node.
+ * Returns the CMDocument that corresponds to the DOM Node. or null if no
+ * CMDocument is appropriate for the DOM Node.
*/
public CMDocument getCorrespondingCMDocument(Node node) {
IDOMDocument owner = getOwnerXMLDocument(node);
@@ -62,7 +68,9 @@ public class HTMLModelQueryCMProvider implements ModelQueryCMProvider {
return staticHTML;
pid = entry.getPublicId();
- CMDocument dtdcm = xhtmlassoc.getXHTMLCMDocument(pid, entry.getSystemId());
+ String sid = entry.getSystemId();
+
+ CMDocument dtdcm = xhtmlassoc.getXHTMLCMDocument(pid, sid);
if (dtdcm == null) {
if (pid != null && pid.equals(HTMLDocumentTypeRegistry.CHTML_PUBLIC_ID)) {
return staticCHTML;
@@ -70,12 +78,13 @@ public class HTMLModelQueryCMProvider implements ModelQueryCMProvider {
return staticHTML;
}
- CMDocument buddycm = (CMDocument) buddyCache.get(pid);
+ String grammarURI = xhtmlassoc.getCachedGrammerURI();
+ CMDocument buddycm = (CMDocument) buddyCache.get(grammarURI);
if (buddycm != null)
return buddycm;
buddycm = new CMDocumentForBuddySystem(dtdcm, entry.isXMLType());
- buddyCache.put(pid, buddycm);
+ buddyCache.put(grammarURI, buddycm);
return buddycm;
}
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryImpl.java
index 8786484615..ad1d8d1768 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryImpl.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/HTMLModelQueryImpl.java
@@ -21,19 +21,27 @@ import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.ModelQueryImpl;
import org.eclipse.wst.xml.core.internal.contentmodel.util.CMDocumentCache;
+import org.eclipse.wst.xml.core.internal.modelquery.XMLModelQueryAssociationProvider;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.ssemodelquery.MovableModelQuery;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
+/**
+ * This added and/or made public specifically for experimentation. It
+ * will change as this functionality becomes API. See
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=119084
+ */
+
public class HTMLModelQueryImpl extends ModelQueryImpl implements MovableModelQuery {
protected CMDocumentCache fCache = null;
+ protected XMLModelQueryAssociationProvider xmlAssocProv = null;
public HTMLModelQueryImpl(CMDocumentCache cache, URIResolver idResolver) {
super(new HTMLModelQueryAssociationProvider(cache, idResolver));
fCache = cache;
+ xmlAssocProv = new XMLModelQueryAssociationProvider(cache, idResolver);
}
public List getAvailableContent(Element element, CMElementDeclaration ed, int includeOptions) {
@@ -137,4 +145,12 @@ public class HTMLModelQueryImpl extends ModelQueryImpl implements MovableModelQu
return null;
}
+ public CMElementDeclaration getCMElementDeclaration(Element element) {
+ CMElementDeclaration result = super.getCMElementDeclaration(element);
+ if (null != result)
+ return result;
+
+ return xmlAssocProv.getCMElementDeclaration(element);
+ }
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java
index ac0278f8e9..de50ef20ad 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java
@@ -116,4 +116,13 @@ class XHTMLAssociationProvider extends XMLAssociationProvider {
}
return result;
}
+
+ /**
+ * This added and/or made public specifically for experimentation. It
+ * will change as this functionality becomes API. See
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=119084
+ */
+ public String getCachedGrammerURI() {
+ return fCachedGrammerURI;
+ }
} \ No newline at end of file

Back to the top