private static CMElementDeclaration getHTMLCMElemDecl(CMElementDeclaration original) { CMElementDeclaration buddy = null; if (htmlcm != null) { CMNamedNodeMap elems = htmlcm.getElements(); if (elems != null) { buddy = (CMElementDeclaration) elems.getNamedItem(original.getElementName()); } } return buddy; }
private String getNamespace(CMNode cmNode) { String namespace = null; CMDocument cmDocument = (CMDocument)cmNode.getProperty("CMDocument"); //$NON-NLS-1$ if (cmDocument != null) { namespace = (String)cmDocument.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI"); //$NON-NLS-1$ } return namespace; }
protected String getFallbackNamepaceURI(CMElementDeclaration ed) { String fallbackNamepaceURI = null; CMDocument cmDocument = (CMDocument)ed.getProperty("CMDocument"); //$NON-NLS-1$ if (cmDocument != null) { fallbackNamepaceURI = (String)cmDocument.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI"); //$NON-NLS-1$ } return fallbackNamepaceURI; }
protected boolean requiresAttributes(CMElementDeclaration ed) { CMNamedNodeMap attributes = ed.getAttributes(); if (attributes == null) { return false; } for (int i = 0; i < attributes.getLength(); i++) { if (((CMAttributeDeclaration) attributes.item(i)).getUsage() == CMAttributeDeclaration.REQUIRED) { return true; } } return false; } }
private static void extractDeclarations(Hashtable availables, CMGroup group) { CMNodeList content = group.getChildNodes(); for (int i = 0; i < content.getLength(); i++) { CMNode cmn = content.item(i); if (cmn == null || cmn.getNodeType() != CMNode.ELEMENT_DECLARATION) continue; addInclusion(availables, (CMElementDeclaration) cmn); } } }
protected void generateAttributes(CMElementDeclaration elementDecl, StringBuffer buffer) { CMNamedNodeMap attributes = elementDecl.getAttributes(); if (attributes == null) { return; } for (int i = 0; i < attributes.getLength(); i++) { generateAttribute((CMAttributeDeclaration) attributes.item(i), buffer); } return; }
protected String getKey(CMNode cmNode) { String key = cmNode.getNodeName(); CMDocument cmDocument = (CMDocument)cmNode.getProperty("CMDocument"); //$NON-NLS-1$ if (cmDocument != null) { String namespaceURI = (String)cmDocument.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI"); //$NON-NLS-1$ if (namespaceURI != null) { key = "[" + namespaceURI + "]" + key; //$NON-NLS-1$ //$NON-NLS-2$ } } return key; }
public void visitCMGroup(CMGroup group) { CMNodeList nodeList = group.getChildNodes(); int size = nodeList.getLength(); for (int i = 0; i < size; i++) { visitCMNode(nodeList.item(i)); } }
private static boolean hasStyleAttribute(IDOMElement ele) { CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); if (decl == null) { return false; } if (decl.getAttributes().getNamedItem("style") != null) { return true; } return false; } }
private static CMNamedNodeMap getProhibitedAncestors(CMElementDeclaration dec) { if (!dec.supports(HTMLCMProperties.PROHIBITED_ANCESTORS)) return null; return (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS); }
/** * getContentType method * @return int * * Returns one of : * ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA. */ public int getContentType() { return fElementDecl.getContentType(); }
/** * getAttributes method * @return CMNamedNodeMap * * Returns CMNamedNodeMap of AttributeDeclaration */ public CMNamedNodeMap getAttributes() { return fElementDecl.getAttributes(); }
/** * CMNodeWrapper constructor comment. */ public CMNodeWrapperImpl(String prefix, CMNode node) { super(); fPrefix = prefix; fNode = node; fNodeName = fPrefix + ":" + fNode.getNodeName(); //$NON-NLS-1$ }
/** */ private static boolean isSameDeclaration(CMElementDeclaration aDec, CMElementDeclaration otherDec) { return aDec.getElementName() == otherDec.getElementName(); }
private CMElementDeclaration getSelf() { if (self.getNodeType() != CMNode.ELEMENT_DECLARATION) return null; return (CMElementDeclaration) self; }
protected boolean isAbstract(CMNode ed) { boolean result = false; if (ed != null) { Object value = ed.getProperty("Abstract"); //$NON-NLS-1$ result = (value == Boolean.TRUE); } return result; }
/** * getMaxOccur method * @return int * * If -1, it's UNBOUNDED. */ public int getMaxOccur() { return fElementDecl.getMaxOccur(); }
/** * getMinOccur method * @return int * * If 0, it's OPTIONAL. * If 1, it's REQUIRED. */ public int getMinOccur() { return fElementDecl.getMinOccur(); }
/** * supports method * @return boolean * * Returns true if the CMNode supports a specified property * */ public boolean supports(String propertyName) { return fNode.supports(propertyName); } }
/** * getMinOccur method * @return int * * If 0, it's OPTIONAL. * If 1, it's REQUIRED. */ public int getMinOccur() { return fCMContent.getMinOccur(); }