use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry in project webtools.sourceediting by eclipse.
the class StructuredAutoEditStrategyHTML method isXHTML.
/**
* Is the node part of an XHTML document
* @param node
* @return
*/
private boolean isXHTML(Node node) {
Document doc = node.getOwnerDocument();
if (!(doc instanceof IDOMDocument))
return false;
String typeid = ((IDOMDocument) doc).getDocumentTypeId();
if (typeid != null) {
HTMLDocumentTypeEntry entry = HTMLDocumentTypeRegistry.getInstance().getEntry(typeid);
return (entry != null && entry.isXMLType());
}
return false;
}
use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry in project webtools.sourceediting by eclipse.
the class HTMLModelQueryCMProvider method getCorrespondingCMDocument.
/**
* 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);
if (owner == null)
return null;
String pid = getPublicId(owner);
// no PID, always return the currently-supported HTML version
if (pid == null || "".equals(pid)) {
return staticHTML5;
}
HTMLDocumentTypeEntry entry = doctypeRegistry.getEntry(pid);
if (entry == null)
return staticHTML;
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=151000 - use internal content model
if (entry.useInternalModel()) {
if (pid != null && pid.equals(HTMLDocumentTypeRegistry.CHTML_PUBLIC_ID)) {
return staticCHTML;
}
return staticHTML;
}
pid = entry.getPublicId();
String sid = entry.getSystemId();
CMDocument dtdcm = xhtmlassoc.getXHTMLCMDocument(pid, sid);
if (dtdcm == null) {
if (pid != null && pid.equals(HTMLDocumentTypeRegistry.CHTML_PUBLIC_ID)) {
return staticCHTML;
}
return staticHTML;
}
String grammarURI = xhtmlassoc.getCachedGrammerURI();
CMDocument buddycm = (CMDocument) buddyCache.get(grammarURI);
if (buddycm != null)
return buddycm;
buddycm = new CMDocumentForBuddySystem(dtdcm, entry.isXMLType());
buddyCache.put(grammarURI, buddycm);
return buddycm;
}
use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry in project webtools.sourceediting by eclipse.
the class SyntaxValidator method getInfo.
private void getInfo(ElementInfo info) {
info.decl = CMUtil.getDeclaration(info.target);
info.startTag = info.target.getStartStructuredDocumentRegion();
info.endTag = info.target.getEndStructuredDocumentRegion();
Document doc = info.target.getOwnerDocument();
if (!(doc instanceof IDOMDocument))
return;
String typeid = ((IDOMDocument) doc).getDocumentTypeId();
if (typeid != null) {
if (typeid.trim().length() != 0) {
HTMLDocumentTypeEntry entry = HTMLDocumentTypeRegistry.getInstance().getEntry(typeid);
info.isXHTML = (entry != null && entry.isXMLType());
} else {
info.isXHTML = getXMLTarget(doc);
info.isXHTML5 = info.isXHTML;
}
}
}
use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry in project webtools.sourceediting by eclipse.
the class ContentSettingsRegistry method getSystemIdFrom.
public static String getSystemIdFrom(String publicId) {
if (publicId == null || publicId.length() == 0)
return null;
HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
Enumeration e = reg.getEntries();
while (e.hasMoreElements()) {
HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
if (entry.getPublicId().equals(publicId))
return entry.getSystemId();
}
return null;
}
use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry in project webtools.sourceediting by eclipse.
the class WebContentSettingsPropertyPage method getSystemIdFrom.
private String getSystemIdFrom(String publicId) {
if (publicId == null || publicId.length() == 0)
return null;
HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
Enumeration e = reg.getEntries();
while (e.hasMoreElements()) {
HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
if (entry.getPublicId().equals(publicId))
return entry.getSystemId();
}
return null;
}
Aggregations