Search in sources :

Example 31 with CMNode

use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.

the class CtdHtml method createContent.

/**
 * (%html.content;).
 * %html.content; is HEAD, (FRAMESET | BODY).
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // ( )
    content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
    if (content == null)
        return;
    // HEAD
    CMNode edec = collection.getNamedItem(HTML40Namespace.ElementName.HEAD);
    if (edec != null)
        content.appendChild(edec);
    // ( | )
    CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
    content.appendChild(group);
    // FRAMESET, BODY
    String[] names = { HTML40Namespace.ElementName.FRAMESET, HTML40Namespace.ElementName.BODY };
    collection.getDeclarations(group, Arrays.asList(names).iterator());
    // since BODY start and end are omissable
    // adding valid children of BODY here under HTML
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97342
    edec = collection.getNamedItem(HTML40Namespace.ElementName.MAP);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.PRE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.BDO);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.INPUT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.P);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.NOSCRIPT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.I);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.BUTTON);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.LABEL);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.U);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.H6);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.CENTER);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.BASEFONT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.S);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.BLOCKQUOTE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.H3);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.UL);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.B);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SELECT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.Q);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.STRIKE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SCRIPT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.ABBR);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.BIG);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.H1);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.IMG);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.ACRONYM);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.DEL);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.NOFRAMES);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.TEXTAREA);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.H2);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.FONT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.OBJECT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.KBD);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.IFRAME);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.HR);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.H4);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.DIR);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SAMP);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.INS);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.H5);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SUP);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.A);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.DFN);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.ISINDEX);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.DL);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.VAR);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.FIELDSET);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.TABLE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.BR);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.TT);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.APPLET);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.OL);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SMALL);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.CITE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.FORM);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.DIV);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.CODE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SPAN);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.SUB);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.EM);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.MENU);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.ADDRESS);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML40Namespace.ElementName.STRONG);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.ARTICLE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.ASIDE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.NAV);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.SECTION);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.AUDIO);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.VIDEO);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.CANVAS);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.COMMAND);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.HEADER);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.FOOTER);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.MARK);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.FIGURE);
    if (edec != null)
        content.appendChild(edec);
    edec = collection.getNamedItem(HTML50Namespace.ElementName.RUBY);
    if (edec != null)
        content.appendChild(edec);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 32 with CMNode

use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.

the class CtdLiContainer method createContent.

/**
 * (LI)+.
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // (LI)+
    content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
    CMNode li = collection.getNamedItem(HTML40Namespace.ElementName.LI);
    if (li != null)
        content.appendChild(li);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 33 with CMNode

use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.

the class CtdAddress method createContent.

/**
 * ((%inline) | P)*.
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // ( | )*
    content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
    // (%inline)
    CMGroupImpl inlines = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
    if (inlines == null)
        return;
    collection.getInline(inlines);
    content.appendChild(inlines);
    // P
    CMNode p = collection.getNamedItem(HTML40Namespace.ElementName.P);
    if (p != null)
        content.appendChild(p);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 34 with CMNode

use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.

the class HTML5ElementCollection method create.

/**
 * Actually creates HTMLElementDeclaration instance.
 * @return HTMLElementDeclaration
 */
protected CMNode create(String elementName) {
    CMNode edec = null;
    if (elementName.equalsIgnoreCase(ACRONYM)) {
        edec = new HedPhrase(ACRONYM, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(APPLET)) {
        edec = new HedAPPLET(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(ARTICLE)) {
        edec = new HedSectioning(ARTICLE, this);
    } else if (elementName.equalsIgnoreCase(ASIDE)) {
        edec = new HedSectioning(ASIDE, this);
    } else if (elementName.equalsIgnoreCase(AUDIO)) {
        edec = new HedMediaElement(AUDIO, this);
    } else if (elementName.equalsIgnoreCase(BASEFONT)) {
        edec = new HedBASEFONT(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(BIG)) {
        edec = new HedFontStyle(BIG, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(CANVAS)) {
        edec = new HedCANVAS(this);
    } else if (elementName.equalsIgnoreCase(CENTER)) {
        edec = new HedCENTER(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(COMMAND)) {
        edec = new HedCOMMAND(this);
    } else if (elementName.equalsIgnoreCase(DATALIST)) {
        edec = new HedDATALIST(this);
    } else if (elementName.equalsIgnoreCase(DETAILS)) {
        edec = new HedDETAILS(this);
    } else if (elementName.equalsIgnoreCase(DIR)) {
        edec = new HedMENU(DIR, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(FIGCAPTION)) {
        edec = new HedFIGCAPTION(this);
    } else if (elementName.equalsIgnoreCase(FIGURE)) {
        edec = new HedFIGURE(this);
    } else if (elementName.equalsIgnoreCase(FOOTER)) {
        edec = new HedHEADER(HTML50Namespace.ElementName.FOOTER, this);
    } else if (elementName.equalsIgnoreCase(FRAME)) {
        edec = new HedFRAME(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(FRAMESET)) {
        edec = new HedFRAMESET(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(HEADER)) {
        edec = new HedHEADER(HTML50Namespace.ElementName.HEADER, this);
    } else if (elementName.equalsIgnoreCase(HGROUP)) {
        edec = new HedHGROUP(this);
    } else if (elementName.equalsIgnoreCase(ISINDEX)) {
        edec = new HedISINDEX(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(KEYGEN)) {
        edec = new HedKEYGEN(this);
    } else if (elementName.equalsIgnoreCase(MARK)) {
        edec = new HedPhrase(HTML50Namespace.ElementName.MARK, this);
    } else if (elementName.equalsIgnoreCase(MATH)) {
        edec = new HedMath(this);
    } else if (elementName.equalsIgnoreCase(METER)) {
        edec = new HedMETER(this);
    } else if (elementName.equalsIgnoreCase(NAV)) {
        edec = new HedSectioning(NAV, this);
    } else if (elementName.equalsIgnoreCase(NOFRAMES)) {
        edec = new HedNOFRAMES(this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(OUTPUT)) {
        edec = new HedOUTPUT(this);
    } else if (elementName.equalsIgnoreCase(PROGRESS)) {
        edec = new HedPROGRESS(this);
    } else if (elementName.equalsIgnoreCase(RP)) {
        edec = new HedRP(this);
    } else if (elementName.equalsIgnoreCase(RT)) {
        edec = new HedRT(this);
    } else if (elementName.equalsIgnoreCase(RUBY)) {
        edec = new HedRUBY(this);
    } else if (elementName.equalsIgnoreCase(S)) {
        edec = new HedFontStyle(S, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(SECTION)) {
        edec = new HedSectioning(SECTION, this);
    } else if (elementName.equalsIgnoreCase(SOURCE)) {
        edec = new HedSOURCE(this);
    } else if (elementName.equalsIgnoreCase(STRIKE)) {
        edec = new HedFontStyle(STRIKE, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(SUMMARY)) {
        edec = new HedSUMMARY(this);
    } else if (elementName.equalsIgnoreCase(SVG)) {
        edec = new HedSVG(this);
    } else if (elementName.equalsIgnoreCase(TIME)) {
        edec = new HedTIME(this);
    } else if (elementName.equalsIgnoreCase(TT)) {
        edec = new HedFontStyle(TT, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(U)) {
        edec = new HedFontStyle(U, this);
        ((HTMLElemDeclImpl) edec).obsolete(true);
    } else if (elementName.equalsIgnoreCase(VIDEO)) {
        edec = new HedVIDEO(this);
    } else // unknown
    {
        // NOTE: We don't define the UNKNOWN element declaration.
        // <code>null</code> for a declaration is a sign of
        // the target element is unknown.
        // -- 3/9/2001
        edec = super.create(elementName);
    }
    return edec;
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 35 with CMNode

use of org.eclipse.wst.xml.core.internal.contentmodel.CMNode in project webtools.sourceediting by eclipse.

the class CtdColumnGroup method createContent.

/**
 * (COL)*
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // ( )*
    content = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
    // COL
    CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.COL);
    if (dec != null)
        content.appendChild(dec);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Aggregations

CMNode (org.eclipse.wst.xml.core.internal.contentmodel.CMNode)133 CMElementDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)37 List (java.util.List)36 CMNamedNodeMap (org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)35 ArrayList (java.util.ArrayList)28 Iterator (java.util.Iterator)23 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)20 CMNodeList (org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList)19 CMAttributeDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration)17 CMDocument (org.eclipse.wst.xml.core.internal.contentmodel.CMDocument)17 Element (org.w3c.dom.Element)16 NodeList (org.w3c.dom.NodeList)15 CMNamedNodeMapImpl (org.eclipse.wst.xml.core.internal.contentmodel.basic.CMNamedNodeMapImpl)14 ModelQuery (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery)13 Node (org.w3c.dom.Node)13 NamedNodeMap (org.w3c.dom.NamedNodeMap)10 ModelQueryAction (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQueryAction)9 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)9 Image (org.eclipse.swt.graphics.Image)8 CustomCompletionProposal (org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal)8