/** */ private HTMLDocumentTypeRegistry() { super(); this.entries = new Hashtable(); // HTML 4.01 String name = "HTML";//$NON-NLS-1$ String publicId = "-//W3C//DTD HTML 4.01 Transitional//EN";//$NON-NLS-1$ String systemId = "http://www.w3.org/TR/html4/loose.dtd";//$NON-NLS-1$ String displayName = "HTML 4.01 Transitional"; //$NON-NLS-1$ this.defaultEntry = new HTMLDocumentTypeEntry(name, publicId, systemId, null, false, false, displayName, false, false, false, true); this.entries.put(publicId, this.defaultEntry); publicId = "-//W3C//DTD HTML 4.01//EN";//$NON-NLS-1$ systemId = "http://www.w3.org/TR/html4/strict.dtd";//$NON-NLS-1$ displayName = "HTML 4.01 Strict"; //$NON-NLS-1$ this.entries.put(publicId, new HTMLDocumentTypeEntry(name, publicId, systemId, null, false, false, displayName, false, false, false, true)); publicId = "-//W3C//DTD HTML 4.01 Frameset//EN";//$NON-NLS-1$ systemId = "http://www.w3.org/TR/html4/frameset.dtd";//$NON-NLS-1$ displayName = "HTML 4.01 Frameset"; //$NON-NLS-1$ this.entries.put(publicId, new HTMLDocumentTypeEntry(name, publicId, systemId, null, false, true, displayName, false, false, false, true)); // CHTML name = "HTML";//$NON-NLS-1$ publicId = CHTML_PUBLIC_ID; displayName = "Compact HTML 1.0 Draft"; //$NON-NLS-1$ this.defaultCHTMLEntry = new HTMLDocumentTypeEntry(name, publicId, null, null, false, false, displayName, false, false, false, true); this.entries.put(publicId, this.defaultCHTMLEntry); HTMLDocumentTypeRegistryReader reader = new HTMLDocumentTypeRegistryReader(); if (reader != null) reader.readRegistry(this); }
/** */ public boolean hasFeature(String feature) { if (feature == null) return false; if (feature.equals(HTML)) return true; if (feature.equals(SSI)) return true; if (feature.equals(FRAMESET)) { if (this.entry == null) return false; return this.entry.hasFrameset(); } return false; }
/** */ void regist(String pid, HTMLDocumentTypeEntry doctype) { if (pid == null || doctype == null) return; this.entries.put(pid, doctype); if (this.defaultXHTMLEntry == null) { if (doctype.isDefaultXHTML()) this.defaultXHTMLEntry = doctype; } if (this.defaultWMLEntry == null) { if (doctype.isDefaultWML()) this.defaultWMLEntry = doctype; } }
boolean newXMLType = (newEntry != null ? newEntry.isXMLType() : false); boolean newWMLType = (newEntry != null ? newEntry.isWMLType() : false); if (oldDocumentType == null || oldDocumentType.getName() != newEntry.getName()) { String name = newEntry.getName(); publicId = newEntry.getPublicId(); String systemId = newEntry.getSystemId(); newDocumentType = impl.createDocumentType(name, publicId, systemId);
if (entry.useInternalModel()) { if (pid != null && pid.equals(HTMLDocumentTypeRegistry.CHTML_PUBLIC_ID)) { return staticCHTML; pid = entry.getPublicId(); String sid = entry.getSystemId(); return buddycm; buddycm = new CMDocumentForBuddySystem(dtdcm, entry.isXMLType()); buddyCache.put(grammarURI, buddycm); return buddycm;
String name = (entry != null ? entry.getName() : null); if (name == null || name.length() == 0) name = "HTML"; // default //$NON-NLS-1$ String systemId = entry.getSystemId(); if (systemId != null) docType.setSystemId(systemId); String namespaceURI = entry.getNamespaceURI(); if (namespaceURI != null) { Element element = document.getDocumentElement();
/** */ void readRegistry(HTMLDocumentTypeRegistry reg) { if (reg == null) return; IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID); if (point != null) { IConfigurationElement[] elements = point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { HTMLDocumentTypeEntry doctype = readElement(elements[i]); // null can be returned if there's an error reading the element if (doctype != null) { reg.regist(doctype.getPublicId(), doctype); } } } }
private void getInfo(ElementInfo info) { info.decl = CMUtil.getDeclaration(info.target); info.startTag = info.target.getStartStructuredDocumentRegion(); info.endTag = info.target.getEndStructuredDocumentRegion(); info.hasStartTag = (info.startTag != null); info.hasEndTag = (info.endTag != null); Document doc = info.target.getOwnerDocument(); if (!(doc instanceof IDOMDocument)) return; String typeid = ((IDOMDocument) doc).getDocumentTypeId(); if (typeid != null) { HTMLDocumentTypeEntry entry = HTMLDocumentTypeRegistry.getInstance().getEntry(typeid); info.isXHTML = (entry != null && entry.isXMLType()); } }
defaultWML = getBoolean(element, ATT_IS_DEFAULT_WML); isWML = getBoolean(element, ATT_IS_WML); doctype = new HTMLDocumentTypeEntry(root, pid, sid, nsuri, xhtml, frameset, dname, defaultXhtml, defaultWML, isWML);