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); } }
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 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)); } } }
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; }
public CMNamedNodeMap getElements() { if (elements != null) return elements; CMDocument cmdoc = getSelf(); if (cmdoc == null) return null; elements = new Elements(cmdoc.getElements(), isXHTML); return elements; }
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)); } } }
public void debugPrint(Collection collection) { for (Iterator iter = collection.iterator(); iter.hasNext(); ) { CMDocument cmDocument = (CMDocument)iter.next(); System.out.println("-----------------------------------------------"); //$NON-NLS-1$ System.out.println("cmDocument (" + cmDocument.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI") +")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ CMNamedNodeMapImpl elementMap = (CMNamedNodeMapImpl)cmDocument.getElements(); int size = elementMap.getLength(); for (int i = 0; i < size; i++) { CMElementDeclaration ed = (CMElementDeclaration)elementMap.item(i); CMDescriptionBuilder builder = new CMDescriptionBuilder(); System.out.println(" ELEMENT " + ed.getNodeName() + " = " + builder.buildDescription(ed)); //$NON-NLS-1$ //$NON-NLS-2$ } } } }
private void addSSIDecls() { CMDocument ssi = SSICMDocumentFactory.getCMDocument(); if (ssi == null) return; CMNamedNodeMap elements = ssi.getElements(); Iterator i = elements.iterator(); while (i.hasNext()) { CMElementDeclaration decl = (CMElementDeclaration) i.next(); if (decl == null) continue; put(decl.getElementName(), decl); } } }
protected CMElementDeclaration getSuitableElement(CMElementDeclaration ed, CMDocument cmDocument) { CMElementDeclaration result = null; if (ed != null) { result = getSuitableElement(ed.getLocalElements()); } if (result == null && cmDocument != null) { result = getSuitableElement(cmDocument.getElements()); } return result; }
public void visitCMDocument(CMDocument document) { CMNamedNodeMap map = document.getElements(); int size = map.getLength(); for (int i = 0; i < size; i++) { visitCMNode(map.item(i)); } }
public void visitCMDocument(CMDocument document) { CMNamedNodeMap map = document.getElements(); int size = map.getLength(); for (int i = 0; i < size; i++) { visitCMNode(map.item(i)); } }
private static boolean isTagAvailable(Document document, String elementName) { ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document); if (modelQuery != null) { CMDocument cmdoc = modelQuery.getCorrespondingCMDocument(document); CMNamedNodeMap map = cmdoc.getElements(); if ((CMElementDeclaration) map.getNamedItem(elementName) != null) { return true; } } return false; }
private static void loadFromCMDocument(TaglibPaletteDrawer category, CMDocument cmdoc) { CMNamedNodeMap nodeMap = cmdoc.getElements(); for (int i = 0, size = nodeMap.getLength(); i < size; i++) { CMElementDeclaration eledecl = (CMElementDeclaration) nodeMap .item(i); String tagName = eledecl.getElementName(); TagToolPaletteEntry item; if (tagName.equalsIgnoreCase(IHTMLConstants.TAG_INPUT)) {//TODO: fix this nonsense! StringBuffer name = new StringBuffer(category.getURI()); name.append(":").append(tagName).append(":").append(tagName); item = category.getTagPaletteEntryById(name.toString()); } else { item = category.getTagPaletteEntryByTagName(tagName); } if (item == null) { createTagEntry(category, eledecl); } } }
public void visitCMAnyElement(CMAnyElement anyElement) { String uri = anyElement.getNamespaceURI(); List list = getCMDocumentList(rootElement, rootElementDeclaration, uri); for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { CMDocument cmdocument = (CMDocument)iterator.next(); if (cmdocument != null) { CMNamedNodeMap map = cmdocument.getElements(); int size = map.getLength(); for (int i = 0; i < size; i++) { CMNode ed = map.item(i); addToTable(childNodeTable,ed); } } } }
public static void testPopulateDocumentFromGrammarFile(Document document, String grammarFileName, String rootElementName, boolean hack) { try { CMDocument cmDocument = ContentModelManager.getInstance().createCMDocument(grammarFileName, null); CMNamedNodeMap elementMap = cmDocument.getElements(); CMElementDeclaration element = (CMElementDeclaration) elementMap.getNamedItem(rootElementName); DOMContentBuilderImpl contentBuilder = new DOMContentBuilderImpl(document); contentBuilder.supressCreationOfDoctypeAndXMLDeclaration = hack; contentBuilder.createDefaultRootContent(cmDocument, element); System.out.println(); System.out.println("-----------------------------"); //$NON-NLS-1$ DOMWriter writer = new DOMWriter(); if (hack) { writer.print(document, grammarFileName); } else { writer.print(document); } System.out.println("-----------------------------"); //$NON-NLS-1$ } catch (Exception e) { System.out.println("Error: " + e); //$NON-NLS-1$ e.printStackTrace(); } }
int globalElementCount = cmDocument.getElements().getLength(); if (globalElementCount == 0) { title = XMLWizardsMessages._UI_WARNING_TITLE_NO_ROOT_ELEMENTS;
/** * getElements method * @return CMNamedNodeMap * * Returns CMNamedNodeMap of ElementDeclaration */ public CMNamedNodeMap getElements() { if (fElements == null) { int length = getDocument().getElements().getLength(); CMNamedNodeMapImpl elements = new CMNamedNodeMapImpl(); for (int i = 0; i < length; i++) { CMElementDeclaration ed = new CMElementDeclarationWrapperImpl(fPrefix, (CMElementDeclaration) getDocument().getElements().item(i)); elements.setNamedItem(ed.getNodeName(), ed); } fElements = elements; } return fElements; }
return false; CMNamedNodeMap map = cm.getElements(); if (map == null) { return false;
private void registerTaglib(String prefix, String uri, IStructuredDocumentRegion anchorStructuredDocumentRegion, CMDocument tld) { CMNamedNodeMap elements = tld.getElements();
CMNamedNodeMap nameNodeMap = cmDocument.getElements(); CMElementDeclaration cmElementDeclaration = (CMElementDeclaration) nameNodeMap.getNamedItem(getRootElementName());