Search in sources :

Example 6 with DTDObject

use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.

the class DTDFileImpl method findObject.

public DTDObject findObject(String relativePath) {
    Object[] result = DTDPathnameUtil.parsePathComponent(relativePath);
    String type = (String) result[0];
    if (type == null)
        return null;
    String name = (String) result[1];
    DTDObject obj = null;
    if (type.equals("Elem")) {
        // $NON-NLS-1$
        obj = findElement(name);
    } else if (type.equals("Ent")) {
        // $NON-NLS-1$
        obj = findEntity(name);
    } else if (type.equals("PEnt")) {
        // $NON-NLS-1$
        obj = findParameterEntityReference(name);
    } else if (type.equals("Nota")) {
        // $NON-NLS-1$
        obj = findNotation(name);
    } else {
        return null;
    }
    String restPath = (String) result[3];
    if ((restPath == null) || (obj == null)) {
        return obj;
    } else {
        return obj.findObject(restPath);
    }
}
Also used : DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Example 7 with DTDObject

use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.

the class DTDVisitor method visitDTDFile.

public void visitDTDFile(DTDFile file) {
    Collection notations = file.listDTDNotation();
    for (Iterator i = notations.iterator(); i.hasNext(); ) {
        visitDTDNotation((DTDNotation) i.next());
    }
    Collection entities = file.listDTDEntity();
    for (Iterator i = entities.iterator(); i.hasNext(); ) {
        visitDTDEntity((DTDEntity) i.next());
    }
    Collection objects = file.listDTDElementAndDTDParameterEntityReference();
    for (Iterator i = objects.iterator(); i.hasNext(); ) {
        DTDObject object = (DTDObject) i.next();
        if (object instanceof DTDElement) {
            visitDTDElement((DTDElement) object);
        } else // end of if ()
        {
            visitDTDParameterEntityReference((DTDParameterEntityReference) object);
        }
    // end of if ()
    }
}
Also used : Iterator(java.util.Iterator) Collection(java.util.Collection) DTDElement(org.eclipse.wst.dtd.core.internal.emf.DTDElement) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Aggregations

DTDObject (org.eclipse.wst.dtd.core.internal.emf.DTDObject)7 Iterator (java.util.Iterator)4 Collection (java.util.Collection)3 InternalEObject (org.eclipse.emf.ecore.InternalEObject)3 DTDElement (org.eclipse.wst.dtd.core.internal.emf.DTDElement)2 DTDElementContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementContent)1 DTDElementReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent)1 DTDEntity (org.eclipse.wst.dtd.core.internal.emf.DTDEntity)1 DTDEntityReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent)1 DTDFile (org.eclipse.wst.dtd.core.internal.emf.DTDFile)1 DTDGroupContent (org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent)1