public Elements() { CMNamedNodeMap elems = hcm.getElements(); for (int i = 0; i < names.length; i++) { String name = names[i]; CMElementDeclaration dec = (CMElementDeclaration) elems.getNamedItem(name); if (dec != null) map.put(name, dec); } }
/** * Each derived class must call this method in its constructor * to build up its contents. */ protected void makeBuddySystem(CMNamedNodeMap original) { Iterator i = original.iterator(); if (i == null) return; while (i.hasNext()) { CMNode org = (CMNode) i.next(); String key = getKeyName(org); CMNode newNode = createBuddySystem(org); put(key, newNode); } }
protected CMElementDeclaration getSuitableElement(CMNamedNodeMap nameNodeMap) { CMElementDeclaration result = null; int size = nameNodeMap.getLength(); for (int i = 0; i < size; i++) { CMElementDeclaration candidate = (CMElementDeclaration) nameNodeMap.item(i); if (!visitedCMElementDeclarationList.contains(candidate)) { result = candidate; break; } } return result; }
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)); } } }
String attrName = attr.getName(); if (fCaseSensitive) { attrDecl = (CMAttributeDeclaration) attrMap.getNamedItem(attrName); for (int j = 0; j < attrMap.getLength(); j++) { if (!fCaseSensitive && attrMap.item(j).getNodeName().equalsIgnoreCase(attrName)) { attrDecl = (CMAttributeDeclaration) attrMap.item(j); break; for (int i = 0; i < attrMap.getLength(); i++) { attrDecl = (CMAttributeDeclaration) attrMap.item(i); if (!names.contains(attrDecl.getAttrName())) { IPropertyDescriptor holdDescriptor = createPropertyDescriptor(attrDecl);
return; // cannot validate. CMNamedNodeMap prohibited = (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS); if (prohibited.getLength() <= 0) return; // no prohibited ancestors. CMNode pdec = prohibited.getNamedItem(parent.getNodeName()); if (pdec != null) { // prohibited element is found in ancestors. Segment errorSeg = FMUtil.getSegment((IDOMNode) node, FMUtil.SEG_START_TAG);
length++; if (i < attributes.getLength() - 1) { attrInfo.append(" "); //$NON-NLS-1$ if ((i != 0) && (i % numPerLine == 0)) {
protected void addBlockMarkers(String prefix, CMDocument doc) { if (doc.getElements().getLength() > 0) { Iterator elements = doc.getElements().iterator(); CMNode node = null; while (elements.hasNext()) { node = (CMNode) elements.next(); if (node instanceof TLDElementDeclaration && ((TLDElementDeclaration) node).getBodycontent().equals(JSP12TLDNames.CONTENT_TAGDEPENDENT)) getBlockMarkers().add(new BlockMarker(prefix + node.getNodeName(), null, DOMRegionContext.BLOCK_TEXT, true)); else getBlockMarkers().add(new BlockMarker(prefix + node.getNodeName(), null, DOMJSPRegionContexts.JSP_CONTENT, true)); } } }
int globalElementCount = cmDocument.getElements().getLength(); if (globalElementCount == 0) { title = XMLWizardsMessages._UI_WARNING_TITLE_NO_ROOT_ELEMENTS;
public static Object[] getElementReferedAttributes(Element fNode, String[] filter) { List result = new ArrayList(); CMNamedNodeMap cmnnm = getElementDeclaredAttributes(fNode); for (int i = 0, n = cmnnm.getLength(); i < n; i++) { String name = cmnnm.item(i).getNodeName(); if (Arrays.asList(filter).contains(name)) { result.add(cmnnm.item(i)); } } return result.toArray(new CMNode[result.size()]); }
/** * Retreives CMAttributeDeclaration indicated by attribute name within * elementDecl */ protected CMAttributeDeclaration getCMAttributeDeclaration(CMElementDeclaration elementDecl, String attName) { CMAttributeDeclaration attrDecl = null; if (elementDecl != null) { CMNamedNodeMap attributes = elementDecl.getAttributes(); String noprefixName = DOMNamespaceHelper.getUnprefixedName(attName); if (attributes != null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(noprefixName); if (attrDecl == null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(attName); } } } return attrDecl; }
private List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
document = (CMDocumentImpl) buildCMDocumentFromFile(file.getLocation().toString()); document.setLocationString(record.getPath().toString()); if (_debug && document != null && document.getElements().getLength() == 0) { System.out.println("failure parsing " + record.getPath()); //$NON-NLS-1$ document.setProperty(JSP12TLDNames.LARGE_ICON, "jar:file:" + iconPath); //$NON-NLS-1$ if (document != null && document.getElements().getLength() == 0) { System.out.println("failure parsing " + record.getLocation()); //$NON-NLS-1$
/** * Returns sorted array of CMAttributeDeclarations. * * @param attributes * */ private CMAttributeDeclaration[] getSortedAttributes(CMNamedNodeMap attributes) { List sorted = new ArrayList(); for (int i = 0; i < attributes.getLength(); i++) { sorted.add(attributes.item(i)); } Collections.sort(sorted, getCMAttributeComparator()); return (CMAttributeDeclaration[]) sorted.toArray(new CMAttributeDeclaration[sorted.size()]); }
public CMElementDeclaration getCMElementDeclaration(Element element) { CMElementDeclaration result = null; CMDocument cmDocument = getCorrespondingCMDocument(element); if (cmDocument != null) { result = (CMElementDeclaration)cmDocument.getElements().getNamedItem(element.getNodeName()); } return result; } }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
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; }
private static boolean isExcluded(CMElementDeclaration candidate, Element target) { CMNamedNodeMap prohibited = getProhibitedAncestors(candidate); if (prohibited == null) return false; Element parent = target; while (parent != null) { CMNode pdec = prohibited.getNamedItem(parent.getNodeName()); if (pdec != null) return true; parent = getExplicitParentElement(parent); } return false; }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }