Search in sources :

Example 61 with CMNamedNodeMap

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

the class CMPrinter method visitCMDocument.

public void visitCMDocument(CMDocument document) {
    // $NON-NLS-1$
    fStringBuffer.append(indent + "<CMDocument");
    printAttributes(fStringBuffer, document);
    // $NON-NLS-1$
    fStringBuffer.append(">\n");
    incrementIndent();
    // printEntities(sb, document.getEntities());
    printProperties(fStringBuffer, document);
    CMNamedNodeMap map = document.getElements();
    int size = map.getLength();
    for (int i = 0; i < size; i++) {
        visitCMNode(map.item(i));
    }
    decrementIndent();
    // $NON-NLS-1$
    fStringBuffer.append(indent + "</CMDocument>\n");
}
Also used : CMNamedNodeMap(org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)

Example 62 with CMNamedNodeMap

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

the class CMDocumentImpl method toString.

public String toString() {
    StringBuffer buffer = new StringBuffer();
    buffer.append(super.toString());
    // $NON-NLS-1$
    buffer.append("\n\t short name:" + StringUtils.escape(getShortname()));
    // $NON-NLS-1$
    buffer.append("\n\t display name:" + StringUtils.escape(getDisplayName()));
    // $NON-NLS-1$
    buffer.append("\n\t description (info):" + StringUtils.escape(getDescription()));
    // $NON-NLS-1$
    buffer.append("\n\t URI:" + StringUtils.escape(getUri()));
    // $NON-NLS-1$
    buffer.append("\n\t jsp version:" + StringUtils.escape(getJspversion()));
    // $NON-NLS-1$
    buffer.append("\n\t taglib version:" + StringUtils.escape(getTlibversion()));
    // $NON-NLS-1$
    buffer.append("\n\t small icon:" + StringUtils.escape(getSmallIcon()));
    // $NON-NLS-1$
    buffer.append("\n\t large icon:" + StringUtils.escape(getLargeIcon()));
    if (getValidator() != null)
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        buffer.append("\n\t validator:" + StringUtils.replace(getValidator().toString(), "\n", "\n\t\t"));
    // $NON-NLS-1$
    buffer.append("\n\t listeners:");
    for (int i = 0; i < getListeners().size(); i++) {
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        buffer.append("\n" + StringUtils.replace(getListeners().get(i).toString(), "\n", "\n\t\t"));
    }
    // $NON-NLS-1$
    buffer.append("\n\t elements:");
    CMNamedNodeMap elements = getElements();
    for (int i = 0; i < elements.getLength(); i++) {
        // $NON-NLS-1$ //$NON-NLS-2$
        buffer.append(StringUtils.replace(elements.item(i).toString(), "\n", "\n\t\t"));
    }
    return buffer.toString();
}
Also used : CMNamedNodeMap(org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)

Example 63 with CMNamedNodeMap

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

the class StyleAdapterFactory method isTagAvailable.

private static boolean isTagAvailable(Document document, String elementName) {
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
    if (modelQuery != null) {
        CMDocument cmdoc = modelQuery.getCorrespondingCMDocument(document);
        CMNamedNodeMap map = cmdoc.getElements();
        if ((CMElementDeclaration) map.getNamedItem(elementName) != null) {
            return true;
        }
    }
    return false;
}
Also used : CMDocument(org.eclipse.wst.xml.core.internal.contentmodel.CMDocument) ModelQuery(org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery) CMNamedNodeMap(org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)

Example 64 with CMNamedNodeMap

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

the class CMElementDeclarationBuddySystem method getAttributes.

/*
	 * @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;
}
Also used : CMElementDeclaration(org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration) CMNamedNodeMap(org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)

Example 65 with CMNamedNodeMap

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

the class NamespaceValidator method isUnknownAttr.

private boolean isUnknownAttr(IDOMAttr attr, Element target) {
    CMElementDeclaration dec = CMUtil.getDeclaration(target);
    if (dec == null)
        // unknown.
        return true;
    CMNamedNodeMap adecls = dec.getAttributes();
    CMAttributeDeclaration adec = (CMAttributeDeclaration) adecls.getNamedItem(attr.getName());
    return adec == null;
}
Also used : CMElementDeclaration(org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration) CMAttributeDeclaration(org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration) CMNamedNodeMap(org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)

Aggregations

CMNamedNodeMap (org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)68 CMElementDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)39 CMNode (org.eclipse.wst.xml.core.internal.contentmodel.CMNode)36 CMDocument (org.eclipse.wst.xml.core.internal.contentmodel.CMDocument)26 CMAttributeDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration)23 List (java.util.List)21 ArrayList (java.util.ArrayList)18 ModelQuery (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery)16 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)14 Element (org.w3c.dom.Element)14 CMNamedNodeMapImpl (org.eclipse.wst.xml.core.internal.contentmodel.basic.CMNamedNodeMapImpl)13 NamedNodeMap (org.w3c.dom.NamedNodeMap)10 CMDataType (org.eclipse.wst.xml.core.internal.contentmodel.CMDataType)9 NodeList (org.w3c.dom.NodeList)9 Iterator (java.util.Iterator)8 Attr (org.w3c.dom.Attr)8 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)7 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)6 CMNodeList (org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList)6 IDOMElement (org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)6