use of org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocument in project webtools.sourceediting by eclipse.
the class HTMLTagsCompletionProposalComputer method isXHTMLNode.
/**
* Determine if this Document is an XHTML Document. Operates solely off of
* the Document Type declaration
*/
private static boolean isXHTMLNode(Node node) {
if (node == null) {
return false;
}
Document doc = null;
if (node.getNodeType() != Node.DOCUMENT_NODE)
doc = node.getOwnerDocument();
else
doc = ((Document) node);
if (doc instanceof IDOMDocument) {
return ((IDOMDocument) doc).isXMLType();
}
if (doc instanceof INodeNotifier) {
ModelQueryAdapter adapter = (ModelQueryAdapter) ((INodeNotifier) doc).getAdapterFor(ModelQueryAdapter.class);
CMDocument cmdoc = null;
if (adapter != null && adapter.getModelQuery() != null)
cmdoc = adapter.getModelQuery().getCorrespondingCMDocument(doc);
if (cmdoc != null) {
// model
if (cmdoc instanceof HTMLCMDocument)
return false;
if (cmdoc.supports(HTMLCMProperties.IS_XHTML))
return Boolean.TRUE.equals(cmdoc.getProperty(HTMLCMProperties.IS_XHTML));
}
}
// this should never be reached
DocumentType docType = doc.getDoctype();
// $NON-NLS-1$
return docType != null && docType.getPublicId() != null && docType.getPublicId().indexOf("-//W3C//DTD XHTML ") == 0;
}
use of org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocument in project webtools.sourceediting by eclipse.
the class HTMLContentAssistProcessor method getXHTML.
/**
* Determine if this Document is an XHTML Document. Oprates solely off of
* the Document Type declaration
*/
protected boolean getXHTML(Node node) {
if (node == null)
return false;
Document doc = null;
if (node.getNodeType() != Node.DOCUMENT_NODE)
doc = node.getOwnerDocument();
else
doc = ((Document) node);
if (doc instanceof IDOMDocument)
return ((IDOMDocument) doc).isXMLType();
if (doc instanceof INodeNotifier) {
ModelQueryAdapter adapter = (ModelQueryAdapter) ((INodeNotifier) doc).getAdapterFor(ModelQueryAdapter.class);
CMDocument cmdoc = null;
if (adapter != null && adapter.getModelQuery() != null)
cmdoc = adapter.getModelQuery().getCorrespondingCMDocument(doc);
if (cmdoc != null) {
// model
if (cmdoc instanceof HTMLCMDocument)
return false;
if (cmdoc.supports(HTMLCMProperties.IS_XHTML))
return Boolean.TRUE.equals(cmdoc.getProperty(HTMLCMProperties.IS_XHTML));
}
}
// this should never be reached
DocumentType docType = doc.getDoctype();
// $NON-NLS-1$
return docType != null && docType.getPublicId() != null && docType.getPublicId().indexOf("-//W3C//DTD XHTML ") == 0;
}
Aggregations