/** * 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(); }
private static CMNamedNodeMap getProhibitedAncestors(CMElementDeclaration dec) { if (!dec.supports(HTMLCMProperties.PROHIBITED_ANCESTORS)) return null; return (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS); }
private boolean shouldTerminateAt(CMElementDeclaration parent, CMElementDeclaration child) { if (!parent.supports(HTMLCMProperties.TERMINATORS)) return false; java.util.Iterator i = (java.util.Iterator) parent.getProperty(HTMLCMProperties.TERMINATORS); if (i == null) return false; String nextName = child.getElementName(); while (i.hasNext()) { // NOTE: CMElementDeclaration of child is not always HTMLCMElementDeclaration. // It might be one of based on DTD (for XHTML element). So, comparison must // be performed ignoring case. // -- 3/20/2002 String terminator = (String) i.next(); if (terminator == null) continue; if (nextName.equalsIgnoreCase(terminator)) return true; } return false; }
/** * */ protected String createContentSpecificationForCMElementDeclaration(CMElementDeclaration ed) { CMDocument document = (CMDocument)ed.getProperty("CMDocument"); //$NON-NLS-1$ String uri = document != null ? (String)document.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI") : null; //$NON-NLS-1$ String string = ed.getNodeName(); if (uri != null) { string = "[" + uri + "]" + string; //$NON-NLS-1$ //$NON-NLS-2$ } return string; }
public void visitCMElementDeclaration(CMElementDeclaration ed) int min = Math.max(ed.getMinOccur(), forcedMin); alwaysVisit = false; CMNamedNodeMap nodeMap = ed.getAttributes(); int size = nodeMap.getLength(); for (int j = 0; j < size; j++) CMContent content = ed.getContent(); if (content != null) if (ed.getContentType() == CMElementDeclaration.PCDATA) CMDataType dataType = ed.getDataType(); if (dataType != null)
/** */ protected boolean canFormatChild(Node node) { while (node != null) { if (node.getNodeType() != Node.ELEMENT_NODE) return true; CMElementDeclaration decl = getElementDeclaration((Element) node); if (decl != null) { if (decl.getContentType() == CMElementDeclaration.CDATA) return false; if (decl.supports(HTMLCMProperties.SHOULD_KEEP_SPACE)) { boolean shouldKeepSpace = ((Boolean) decl.getProperty(HTMLCMProperties.SHOULD_KEEP_SPACE)).booleanValue(); if (shouldKeepSpace) return false; } } node = node.getParentNode(); } return false; }
int contentType = rootElementDeclaration.getContentType(); includeSequenceGroups = ((includeOptions & INCLUDE_SEQUENCE_GROUPS) != 0); visitCMNode(rootElementDeclaration); CMAttributeDeclaration nillableAttribute = (CMAttributeDeclaration)rootElementDeclaration.getProperty("http://org.eclipse.wst/cm/properties/nillable"); //$NON-NLS-1$ if (nillableAttribute != null) CMDocument cmDocument = (CMDocument)rootElementDeclaration.getProperty("CMDocument"); //$NON-NLS-1$ if (cmDocument != null) contentType == CMElementDeclaration.ANY) CMDataType dataType = rootElementDeclaration.getDataType(); if (dataType != null)
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()); } }
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; }
if (parentDecl != null) { CMDataType childType = parentDecl.getDataType(); if (childType != null) { String[] childStrings = childType.getEnumeratedValues(); if ((parentDecl != null) && (parentDecl.getContentType() == CMElementDeclaration.PCDATA)) { addPCDATAProposal(parentDecl.getNodeName(), contentAssistRequest);
/** */ private static boolean isSameDeclaration(CMElementDeclaration aDec, CMElementDeclaration otherDec) { return aDec.getElementName() == otherDec.getElementName(); }
result = name.equalsIgnoreCase(element.getElementName()); CMNodeList cmNodeList = (CMNodeList)element.getProperty("SubstitutionGroup"); //$NON-NLS-1$ if (cmNodeList != null) String altName = alternativeCMElementDeclaration.getElementName(); result = name.equalsIgnoreCase(altName); if (result)
sb.append(PARAGRAPH_END); printDocumentation(sb, node); if (ed.getContentType() == CMElementDeclaration.PCDATA) { CMDataType dataType = ed.getDataType(); if (dataType != null) { printDataTypeInfo(sb, dataType);
public boolean isNamespaceAware(CMElementDeclaration ed) { return ed != null ? ed.getProperty("http://org.eclipse.wst/cm/properties/isNameSpaceAware") != null : false; //$NON-NLS-1$ }
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); }
/** * getDataType method * @return java.lang.String */ public CMDataType getDataType() { return fElementDecl.getDataType(); }
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); } }
DocumentType documentType = domImpl.createDocumentType(rootCMElementDeclaration.getElementName(), grammarFileName, grammarFileName); document.appendChild(documentType); String name = rootCMElementDeclaration.getNodeName(); if (namespaceInfoList.size() > 0) { NamespaceInfo info = (NamespaceInfo) namespaceInfoList.get(0);
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); } } }