[119084] Enable external schemas for HTML content model
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 53ac1d9..1241871 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 @@
/**
* 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 @@
}
/**
- * 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 @@
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 @@
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 8786484..ad1d8d1 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.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 @@
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 ac0278f..de50ef2 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 @@
}
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
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java
index fd3087f..da470ad 100644
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java
+++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java
@@ -21,8 +21,13 @@
/**
* XMLModelQueryAssociationProvider
+ *
+ * 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
+ *
*/
-class XMLModelQueryAssociationProvider extends XMLAssociationProvider {
+public class XMLModelQueryAssociationProvider extends XMLAssociationProvider {
protected URIResolver idResolver;