use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.
the class DTDElementContentImpl method getPathname.
public String getPathname() {
int cnt = 0;
DTDObject parent = getGroup();
if (parent == null) {
parent = getElement();
} else {
DTDGroupContent group = (DTDGroupContent) parent;
Iterator i = group.getContent().iterator();
while (i.hasNext()) {
DTDElementContent content = (DTDElementContent) i.next();
if (content == this) {
break;
}
if ((content instanceof DTDElementReferenceContent) || (content instanceof DTDEntityReferenceContent)) {
continue;
}
cnt++;
}
}
// $NON-NLS-1$ //$NON-NLS-2$
return DTDPathnameUtil.makePath(((parent == null) ? "NULL_PARENT" : parent.getPathname()), "Content", null, cnt);
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.
the class DTDVisitor method visitDTDFileGen.
/**
* @generated
*/
protected void visitDTDFileGen(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 ()
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.
the class DTDEntityImpl method findObject.
public DTDObject findObject(String relativePath) {
Object[] result = DTDPathnameUtil.parsePathComponent(relativePath);
String type = (String) result[0];
if (type == null)
return null;
DTDObject obj = null;
if (type.equals("Content")) {
// $NON-NLS-1$
obj = getContent();
} else {
return null;
}
String restPath = (String) result[3];
if ((restPath == null) || (obj == null)) {
return obj;
} else {
return obj.findObject(restPath);
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.
the class DTDElementImpl method findObject.
public DTDObject findObject(String relativePath) {
Object[] result = DTDPathnameUtil.parsePathComponent(relativePath);
String type = (String) result[0];
if (type == null)
return null;
DTDObject obj = null;
if (type.equals("Attr")) {
// $NON-NLS-1$
// TODO: fix port
// obj = findAttribute(name);
} else if ((type.equals("Content")) || (type.equals("ElemRef")) || (type.equals("EntRef"))) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
obj = getContent();
} else {
return null;
}
String restPath = (String) result[3];
if ((restPath == null) || (obj == null)) {
return obj;
} else {
return obj.findObject(restPath);
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDObject in project webtools.sourceediting by eclipse.
the class DTDUtil method loadIncludedDTD.
// load xmiModels for included DTDs
private void loadIncludedDTD(ResourceSet resources, DTD dtd) {
ExternalDTDModel extModel = getExternalDTDModel(resources, dtd.getName());
if (extModel != null) {
// now fill our hash tables for elements and parameter entities
// so that we know what can be referenced by our main dtd
DTDFile file = extModel.getExternalDTDFile();
Collection elementList = file.listDTDElement();
Collection entityList = file.listDTDEntity();
Iterator i = elementList.iterator();
while (i.hasNext()) {
DTDObject object = (DTDObject) i.next();
elementPool.put(getBaseName(object), object);
}
i = entityList.iterator();
while (i.hasNext()) {
DTDEntity entity = (DTDEntity) i.next();
if (entity.isParameterEntity()) {
pePool.put(getBaseName(entity), entity);
}
}
}
}
Aggregations