Examples of CMNamedNodeMap


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

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

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

      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

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

    if (CMUtil.isForeign(target))
      return;
    CMElementDeclaration edec = CMUtil.getDeclaration(target);
    if (edec == null)
      return;
    CMNamedNodeMap declarations = edec.getAttributes();

    List modelQueryNodes = null;
    NamedNodeMap attrs = target.getAttributes();
    for (int i = 0; i < attrs.getLength(); i++) {
      int rgnType = REGION_NAME;
      int state = ErrorState.NONE_ERROR;
      Attr a = (Attr) attrs.item(i);
      // D203637; If the target attr has prefix, the validator should
      // not
      // warn about it. That is, just ignore. It is able to check
      // whether
      // an attr has prefix or not by calling XMLAttr#isGlobalAttr().
      // When a attr has prefix (not global), it returns false.
      boolean isXMLAttr = a instanceof IDOMAttr;
      if (isXMLAttr) {
        IDOMAttr xmlattr = (IDOMAttr) a;
        if (!xmlattr.isGlobalAttr())
          continue; // skip futher validation and begin next loop.
      }

      CMAttributeDeclaration adec = (CMAttributeDeclaration) declarations.getNamedItem(a.getName());
      final String attrName = a.getName().toLowerCase(Locale.US);
      /* Check the modelquery if nothing is declared by the element declaration */
      if (adec == null) {
        if (modelQueryNodes == null)
          modelQueryNodes = ModelQueryUtil.getModelQuery(target.getOwnerDocument()).getAvailableContent((Element) node, edec, ModelQuery.INCLUDE_ATTRIBUTES);
View Full Code Here

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

  private boolean isUnknownAttr(IDOMAttr attr, Element target) {
    CMElementDeclaration dec = CMUtil.getDeclaration(target);
    if (dec == null)
      return true; // unknown.
    CMNamedNodeMap adecls = dec.getAttributes();
    CMAttributeDeclaration adec = (CMAttributeDeclaration) adecls.getNamedItem(attr.getName());
    return adec == null;
  }
View Full Code Here

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

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

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

        List trackers = mgr.getCMDocumentTrackers(-1);
        Iterator taglibs = trackers.iterator();
 
        CMDocument doc = null;
        CMNamedNodeMap elements = null;
        while (taglibs.hasNext()) {
          doc = (CMDocument) taglibs.next();
          CMNode node = null;
          if ((elements = doc.getElements()) != null && (node = elements.getNamedItem(tagToAdd)) != null && node.getNodeType() == CMNode.ELEMENT_DECLARATION) {
 
            if (node instanceof CMNodeWrapper) {
              node = ((CMNodeWrapper) node).getOriginNode();
            }
            TLDElementDeclaration tldElementDecl = (TLDElementDeclaration) node;
View Full Code Here

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

      // return new TaglibVariable[0];
      //
      // Iterator taglibs =
      // support.getCMDocuments(customTag.getStartOffset()).iterator();
      CMDocument doc = null;
      CMNamedNodeMap elements = null;
      while (taglibs.hasNext()) {
        doc = (CMDocument) taglibs.next();
        CMNode node = null;
        if ((elements = doc.getElements()) != null && (node = elements.getNamedItem(tagToAdd)) != null && node.getNodeType() == CMNode.ELEMENT_DECLARATION) {

          if (node instanceof CMNodeWrapper) {
            node = ((CMNodeWrapper) node).getOriginNode();
          }
          TLDElementDeclaration tldElementDecl = (TLDElementDeclaration) node;
View Full Code Here

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

   */
  private TagInfo getTagInfo(final TLDElementDeclaration decl, TagExtraInfo tei, String prefix, String uri) {

    TagLibraryInfo libInfo = new TagLibraryInfoImpl(prefix, uri, decl);

    CMNamedNodeMap attrs = decl.getAttributes();
    TagAttributeInfo[] attrInfos = new TagAttributeInfo[attrs.getLength()];
    TLDAttributeDeclaration attr = null;
    String type = ""; //$NON-NLS-1$

    // get tag attribute infos
    for (int i = 0; i < attrs.getLength(); i++) {
      attr = (TLDAttributeDeclaration) attrs.item(i);
      type = attr.getType();
      // default value for type is String
      if (attr.getType() == null || attr.getType().equals("")) //$NON-NLS-1$
        type = "java.lang.String"; //$NON-NLS-1$
      attrInfos[i] = new TagAttributeInfo(attr.getAttrName(), attr.isRequired(), type, false);
View Full Code Here

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

    static class Elements implements CMNamedNodeMap {
      private static String[] names = {HTML40Namespace.ElementName.SSI_CONFIG, HTML40Namespace.ElementName.SSI_ECHO, HTML40Namespace.ElementName.SSI_EXEC, HTML40Namespace.ElementName.SSI_FSIZE, HTML40Namespace.ElementName.SSI_FLASTMOD, HTML40Namespace.ElementName.SSI_INCLUDE, HTML40Namespace.ElementName.SSI_PRINTENV, HTML40Namespace.ElementName.SSI_SET};
      private Hashtable map = new Hashtable();

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

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

      if (mgr != null) {
        List moreCMDocuments = mgr.getCMDocumentTrackers(textInsertionOffset);
        if (moreCMDocuments != null) {
          for (int i = 0; i < moreCMDocuments.size(); i++) {
            CMDocument doc = (CMDocument) moreCMDocuments.get(i);
            CMNamedNodeMap elements = doc.getElements();
            if (elements != null) {
              for (int j = 0; j < elements.getLength(); j++) {
                CMElementDeclaration ed = (CMElementDeclaration) elements.item(j);
                elementDecls.add(ed);
              }
            }
          }
        }
      }

      // get position dependent CMDocuments and insert their tags as
      // proposals

      ModelQueryAdapter mqAdapter = null;
      if (node.getNodeType() == Node.DOCUMENT_NODE)
        mqAdapter = (ModelQueryAdapter) ((IDOMNode) node).getAdapterFor(ModelQueryAdapter.class);
      else
        mqAdapter = (ModelQueryAdapter) ((IDOMNode) node.getOwnerDocument()).getAdapterFor(ModelQueryAdapter.class);

      if (mqAdapter != null) {
        CMDocument doc = mqAdapter.getModelQuery().getCorrespondingCMDocument(node);
        if (doc != null) {
          CMDocument jcmdoc = getDefaultJSPCMDocument((IDOMNode) node);
          CMNamedNodeMap jspelements = jcmdoc.getElements();

          /*
           * For a built-in JSP action the content model is properly
           * set up, so don't just blindly add the rest--unless this
           * will be a direct child of the document
           */
          if (jspelements != null && (!(doc instanceof JSPCMDocument) || node.getNodeType() == Node.DOCUMENT_NODE)) {
            List rejectElements = new ArrayList();

            // determine if the document is in XML form
            Document domDoc = null;
            if (node.getNodeType() == Node.DOCUMENT_NODE)
              domDoc = (Document) node;
            else
              domDoc = node.getOwnerDocument();

            // Show XML tag forms of JSP markers if jsp:root is
            // the document element OR it's HTML but
            // isn't really in the text.
            // If the document isn't strictly XML, pull out the
            // XML tag forms it is xml format
            rejectElements.add(JSP12Namespace.ElementName.SCRIPTLET);
            rejectElements.add(JSP12Namespace.ElementName.EXPRESSION);
            rejectElements.add(JSP12Namespace.ElementName.DECLARATION);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_INCLUDE);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_PAGE);
            rejectElements.add(JSP12Namespace.ElementName.TEXT);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_TAGLIB);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_TAG);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_ATTRIBUTE);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_VARIABLE);
            if (isXMLFormat(domDoc)) {
              // jsp actions
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.USEBEAN);
              rejectElements.add(JSP12Namespace.ElementName.GETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.SETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.INCLUDE);
              rejectElements.add(JSP12Namespace.ElementName.FORWARD);
              rejectElements.add(JSP12Namespace.ElementName.PLUGIN);
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.PARAM);
              rejectElements.add(JSP12Namespace.ElementName.PARAMS);
            }


            // don't show jsp:root if a document element already
            // exists
            Element docElement = domDoc.getDocumentElement();
            if (docElement != null && ((docElement.getNodeName().equals("jsp:root")) || ((((IDOMNode) docElement).getStartStructuredDocumentRegion() != null || ((IDOMNode) docElement).getEndStructuredDocumentRegion() != null)))) //$NON-NLS-1$
              rejectElements.add(JSP12Namespace.ElementName.ROOT);

            for (int j = 0; j < jspelements.getLength(); j++) {
              CMElementDeclaration ed = (CMElementDeclaration) jspelements.item(j);
              if (rejectElements.contains(ed.getNodeName()))
                continue;
              elementDecls.add(ed);
            }

          }
        }
        // No cm document (such as for the Document (a non-Element) node itself)
        else {
          CMNamedNodeMap jspElements = getDefaultJSPCMDocument((IDOMNode) node).getElements();
          int length = jspElements.getLength();
          for (int i = 0; i < length; i++) {
            elementDecls.add(jspElements.item(i));
          }
        }
      }
    }
    return elementDecls;
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.