private static boolean isValidChild(CMElementDeclaration parent, CMElementDeclaration child) { if (parent == null || child == null) return false; CMContent content = parent.getContent(); if (content == null) return false; return isChild(content, child); }
protected void generateGraph(CMElementDeclaration ed) { int contentType = ed.getContentType(); if (contentType == CMElementDeclaration.MIXED || contentType == CMElementDeclaration.ELEMENT) { visitCMNode(ed.getContent()); } // CMElementDeclaration.PCDATA... no graph required // CMElementDeclaration.ANY... no graph required context.getLastGraphNode().isTerminal = true; }
CMContent content = ed.getContent(); if (content != null)
public CMContent getContent() { CMElementDeclaration edecl = getSelf(); if (edecl == null) return null; return edecl.getContent(); }
CMContent content = ed.getContent(); if (content.getNodeType() == CMNode.GROUP)
/** * getCMContent method * @return CMContent * * Returns the root node of this element's content model. * This can be an CMElementDeclaration or a CMGroup */ public CMContent getContent() { if (fCMContent == null) { CMContent content = fElementDecl.getContent(); if (content == null) return null; if (content instanceof CMGroup) fCMContent = new CMGroupWrapperImpl(fPrefix, (CMGroup) content); else fCMContent = new CMContentWrapperImpl(fPrefix, content); } return fCMContent; }
CMContent content = ed.getContent(); if (content != null) { visitCMNode(content);
/** * Call this method only when the parent content type is one of * the following: ANY, ELEMENT, or MIXED. */ public static boolean isValidChild(CMElementDeclaration parent, CMElementDeclaration child) { if (parent == null || child == null) return false; if (isHTML(parent) && (!isHTML(child))) return true; CMContent content = parent.getContent(); if (content == null) return false; return isChild(content, child); }
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 ((parent != null) && (parent.getNodeType() == Node.ELEMENT_NODE)) { CMElementDeclaration decl = fModelUtil.getModelQuery().getCMElementDeclaration((Element) parent); CMContent content = decl.getContent(); if (content instanceof CMGroup) { CMGroup cmGroup = (CMGroup) content;
public void visitCMElementDeclaration(CMElementDeclaration ed) { CMNamedNodeMap nodeMap = ed.getAttributes(); int size = nodeMap.getLength(); for (int i = 0; i < size; i++) { visitCMNode(nodeMap.item(i)); } visitCMNode(ed.getContent()); visitCMDataType(ed.getDataType()); } }
case CMNode.ELEMENT_DECLARATION : if (isWholeTagOmissible((CMElementDeclaration) content)) if (isChild(((CMElementDeclaration) content).getContent(), target)) return true; return isSameDeclaration((CMElementDeclaration) content, target); case CMNode.ELEMENT_DECLARATION : if (isWholeTagOmissible((CMElementDeclaration) child)) if (isChild(((CMElementDeclaration) child).getContent(), target)) return true; if (isSameDeclaration((CMElementDeclaration) child, target))
protected boolean isSimpleChoiceGroupContentModel(CMElementDeclaration ed) { boolean result = false; CMNode cmNode = ed.getContent(); if (cmNode != null && cmNode.getNodeType() == CMNode.GROUP) { CMGroup cmGroup = (CMGroup)cmNode; if (cmGroup.getOperator() == CMGroup.CHOICE && cmGroup.getMaxOccur() == -1) { result = true; CMNodeList list = cmGroup.getChildNodes(); for (int i = list.getLength() - 1; i >= 0; i--) { if (list.item(i).getNodeType() != CMNode.ELEMENT_DECLARATION) { result = false; break; } } } } return result; }
public void createCMContent(CMDocument parentCMDocument, CMElementDeclaration parentEd, CMDocument childCMDocument, CMElementDeclaration childEd, boolean isLocal, String uri) { // add element to the parent's content // consider all content to be of the form (A | B | C)* // CMGroupImpl group = (CMGroupImpl)parentEd.getContent(); CMNodeListImpl groupChildNodeList = (CMNodeListImpl)group.getChildNodes(); if (parentCMDocument == childCMDocument) { if (!groupChildNodeList.contains(childEd)) { groupChildNodeList.add(childEd); } if (isLocal) { CMNamedNodeMapImpl localElementMap = (CMNamedNodeMapImpl)parentEd.getLocalElements(); localElementMap.put(childEd); } } else { CMAnyElement cmAnyElement = lookupOrCreateCMAnyElement((CMDocumentImpl)parentCMDocument, uri); if (!groupChildNodeList.contains(cmAnyElement)) { groupChildNodeList.add(cmAnyElement); } } }