use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.
the class HedNOFRAMES method getExclusion.
/**
* Exclusion.
* <code>NOFRAMES</code> has the exclusion.
* It is <code>NOFRAMES</code> itself.
*/
public CMContent getExclusion() {
if (exclusion != null)
// already created.
return exclusion;
if (elementCollection == null)
return null;
exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
CMNode label = elementCollection.getNamedItem(HTML40Namespace.ElementName.NOFRAMES);
if (label != null)
exclusion.appendChild(label);
return exclusion;
}
use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.
the class ModelQueryImpl method isContentValid.
public boolean isContentValid(CMElementDeclaration ed, Element element) {
boolean result = true;
if (ed != null) {
// first check to see if all the required attributes are present
//
CMNamedNodeMap map = ed.getAttributes();
int mapLength = map.getLength();
for (int i = 0; i < mapLength; i++) {
CMAttributeDeclaration ad = (CMAttributeDeclaration) map.item(i);
String attributeName = DOMNamespaceHelper.computeName(ad, element, null);
if (ad.getUsage() == CMAttributeDeclaration.REQUIRED) {
Attr attr = element.getAttributeNode(attributeName);
if (attr == null) {
result = false;
break;
}
}
}
//
if (result) {
CMNode[] originArray = getOriginArray(element);
result = originArray != null && originArray.length == element.getChildNodes().getLength();
}
}
return result;
}
use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.
the class ModelQueryExtensionManagerImpl method filterAvailableElementContent.
public void filterAvailableElementContent(List cmnodes, Element element, CMElementDeclaration ed, int includeOptions) {
String contentTypeId = getContentTypeId(element);
String parentNamespace = element.getNamespaceURI();
List modelQueryExtensions = modelQueryExtensionRegistry.getApplicableExtensions(contentTypeId, parentNamespace);
if ((includeOptions & ModelQuery.INCLUDE_CHILD_NODES) > 0) {
for (Iterator j = cmnodes.iterator(); j.hasNext(); ) {
CMNode cmNode = (CMNode) j.next();
String namespace = getNamespace(cmNode);
String name = cmNode.getNodeName();
boolean include = true;
for (int k = 0; k < modelQueryExtensions.size() && include; k++) {
{
ModelQueryExtension extension = (ModelQueryExtension) modelQueryExtensions.get(k);
include = extension.isApplicableChildElement(element, namespace, name);
if (!include) {
// remove the cmNode from the list
j.remove();
}
}
}
}
}
// add MQE-provided content
for (int k = 0; k < modelQueryExtensions.size(); k++) {
ModelQueryExtension extension = (ModelQueryExtension) modelQueryExtensions.get(k);
cmnodes.addAll(Arrays.asList(extension.getAvailableElementContent(element, parentNamespace, includeOptions)));
}
}
use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.
the class DOMValidator method insert.
protected void insert(List stringList, int insertIndex, List cmNodeList) {
if (insertIndex != -1) {
int insertListSize = cmNodeList.size();
for (int i = insertListSize - 1; i >= 0; i--) {
CMNode cmNode = (CMNode) cmNodeList.get(i);
stringList.addAll(insertIndex, createContentSpecificationList(cmNode));
}
}
}
use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.
the class JSPTranslator method addBlockMarkers.
/*
* adds block markers to JSPTranslator's block marker list for all
* elements in doc @param doc
*/
protected void addBlockMarkers(CMDocument doc) {
if (doc.getElements().getLength() > 0) {
Iterator elements = doc.getElements().iterator();
CMNode node = null;
while (elements.hasNext()) {
node = (CMNode) elements.next();
getBlockMarkers().add(new BlockMarker(node.getNodeName(), null, DOMJSPRegionContexts.JSP_CONTENT, true));
}
}
}
Aggregations