public static Collection getInclusions(Element target) { if (target == null) return nullVector; Collection inclusions = gatherInclusions(getAncestorDeclarations(target)); Hashtable availables = new Hashtable(); Iterator iter = inclusions.iterator(); while (iter.hasNext()) { CMContent inclusion = (CMContent) iter.next(); switch (inclusion.getNodeType()) { case CMNode.GROUP : extractDeclarations(availables, (CMGroup) inclusion); break; case CMNode.ELEMENT_DECLARATION : addInclusion(availables, (CMElementDeclaration) inclusion); break; } } return availables.values(); }
public void visitCMElementDeclaration(CMElementDeclaration ed) { if (ed == root && !isRootVisited) { isRootVisited = true; CMContent content = ed.getContent(); if (content != null) { if (content.getNodeType() != CMNode.GROUP) { sb.append("("); //$NON-NLS-1$ visitCMNode(content); sb.append(")"); //$NON-NLS-1$ } else { visitCMNode(content); } } } else { sb.append(ed.getElementName()); addOccurenceSymbol(ed); } }
if (content.getNodeType() == CMNode.GROUP)
/** */ private static boolean isChild(CMContent content, CMElementDeclaration target) { switch (content.getNodeType()) { case CMNode.ELEMENT_DECLARATION : return isSameDeclaration((CMElementDeclaration) content, target); case CMNode.GROUP : CMNodeList children = ((CMGroup) content).getChildNodes(); for (int i = 0; i < children.getLength(); i++) { CMNode child = children.item(i); switch (child.getNodeType()) { case CMNode.ELEMENT_DECLARATION : if (isSameDeclaration((CMElementDeclaration) child, target)) return true; continue; // Go next child. case CMNode.GROUP : if (isChild((CMContent) child, target)) return true; continue; // Go next child. default : continue; // Go next child. } } } return false; }
switch (content.getNodeType()) { case CMNode.ELEMENT_DECLARATION : if (isWholeTagOmissible((CMElementDeclaration) content))