Examples of CMElementDeclaration


Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

   */
  public void validate(IndexedRegion node) {
    Element target = (Element) node;
    if (CMUtil.isForeign(target))
      return;
    CMElementDeclaration dec = CMUtil.getDeclaration(target);
    if (dec == null)
      return; // cannot validate.
    if (!CMUtil.isHTML(dec))
      return; // no need to validate
    if (!dec.supports(HTMLCMProperties.PROHIBITED_ANCESTORS))
      return; // cannot validate.
    CMNamedNodeMap prohibited = (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS);
    if (prohibited.getLength() <= 0)
      return; // no prohibited ancestors.

    Element parent = SMUtil.getParentElement(target);
    while (parent != null) {
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

      switch (child.getNodeType()) {
        case Node.ELEMENT_NODE :
          if (!isFragment) {
            Element childElem = (Element) child;
            CMElementDeclaration ced = CMUtil.getDeclaration(childElem);
            // Undefined element is valid.
            if (ced == null)
              continue;
            // JSP (includes custom tags) and SSI are valid.
            if (CMUtil.isForeign(childElem) || CMUtil.isSSI(ced))
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

             
              rejectElements.add(JSP12Namespace.ElementName.ROOT);
            }
            //Add JSP elements into autocomplete menu
            for (int j = 0; j < jspelements.getLength(); j++) {
              CMElementDeclaration ed = (CMElementDeclaration) jspelements.item(j);
              if (!rejectElements.contains(ed.getNodeName())) {
                nodeList.add(ed);
              }
            }
           
           
            //Add Tapestry components into autocomplete menu
            ElemDecl temp = null;
            jcmdoc = getDefaultTapestryCMDocument();
            CMNamedNodeMap tapestryelements = jcmdoc.getElements();
            for (int j = 0; j < tapestryelements.getLength(); j++) {
              if(j == 0) temp =  (ElemDecl) tapestryelements.item(j);
              CMElementDeclaration ed = (CMElementDeclaration) tapestryelements.item(j);
              if (!rejectElements.contains(ed.getNodeName())) {
                nodeList.add(ed);
              }
            } 
           
            //load tapestry 5 custom components
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

  /*
   * @see ModelQuery#getCMElementDeclaration(Element)
   */
  public CMElementDeclaration getCMElementDeclaration(Element element) {
    CMElementDeclaration result = super.getCMElementDeclaration(element);
    if (result == null) {
      ModelQuery query = getEmbeddedModelQuery(element);
      if (query != null) {
        result = query.getCMElementDeclaration(element);
      }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

    // Now, the time to check exclusion.
    Vector content = new Vector(candidates.size());
    for (int i = 0; i < candidates.size(); i++) {
      Object eCandidate = candidates.elementAt(i);
      if(eCandidate instanceof CMElementDeclaration) {
        CMElementDeclaration candidate = (CMElementDeclaration) eCandidate;
        if (candidate == null)
          continue;
        if (isExcluded(candidate, element))
          continue;
        content.add(candidate);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

    }
    return null;
  }

  public CMElementDeclaration getCMElementDeclaration(Element element) {
    CMElementDeclaration result = super.getCMElementDeclaration(element);
    if (null != result)
      return result;
   
    return xmlAssocProv.getCMElementDeclaration(element);
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

 
  private void validateContent(Element parent, Node child) {
    if (child == null)
      return;

    CMElementDeclaration ed = CMUtil.getDeclaration(parent);
    if(ed == null || ed.getContentType() == CMElementDeclaration.ANY)
      return;
   
    List[] extendedContent = new List[1];
    while (child != null) {
      // perform actual validation
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

        // is
        // an element of foreign markup languages, just ignore it.
        if (CMUtil.isForeign(childElem))
          return;

        CMElementDeclaration ced = CMUtil.getDeclaration((Element) child);
        // Defect 186774: If a child is not one of HTML elements,
        // it should be regarded as a valid child regardless the
        // type of the parent content model. -- 10/12/2001
        if (ced == null || CMUtil.isSSI(ced) || (!CMUtil.isHTML(ced)))
          return;
        if (CMUtil.isObsolete(ced)){
          error = ErrorState.OBSOLETE_TAG_NAME_ERROR;
          break;
        }
       
        switch (contentType) {
          case CMElementDeclaration.ANY :
            // Keep going.
            return;
          case CMElementDeclaration.ELEMENT :
          case CMElementDeclaration.MIXED :
            if (ced == null)
              return;
            if (CMUtil.isValidChild(edec, ced))
              return;
            // Now, it is the time to check inclusion, unless the
            // target
            // document is not a XHTML.
            if (!CMUtil.isXHTML(edec)) {
              // pure HTML
              if (CMUtil.isValidInclusion(ced, target))
                return;
            }
           
            /*
             * https://bugs.eclipse.org/bugs/show_bug.cgi?id=218143 -
             * ModelQuery use not pervasive enough
             */
            if (extendedContent[0] == null) {
              extendedContent[0] = ModelQueryUtil.getModelQuery(target.getOwnerDocument()).getAvailableContent(target, edec, ModelQuery.INCLUDE_CHILD_NODES);
            }

            List availableChildElementDeclarations = extendedContent[0];
            /*
             * Retrieve and set aside just the element names for faster checking
             * later.
             */
            int availableChildCount = availableChildElementDeclarations.size();
            String elementName = ced.getElementName().toLowerCase(Locale.US);
            for (int i = 0; i < availableChildCount; i++) {
              CMNode cmnode = (CMNode) availableChildElementDeclarations.get(i);
              if (cmnode.getNodeType() == CMNode.ELEMENT_DECLARATION && cmnode.getNodeName().toLowerCase(Locale.US).equals(elementName)) {
                return;
              }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration


  private static CMDocument htmlcm = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);

  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());
      }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration

   * @see CMElementDeclaration#getAttributes()
   */
  public CMNamedNodeMap getAttributes() {
    if (attributes != null)
      return attributes;
    CMElementDeclaration edecl = getSelf();
    if (edecl == null)
      return null;
    CMElementDeclaration htmlDecl = getBuddy();
    CMNamedNodeMap htmlAttrs = (htmlDecl == null) ? null : htmlDecl.getAttributes();
    attributes = new Attrs(edecl.getAttributes(), htmlAttrs, isXHTML);
    return attributes;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.