summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2007-05-08 13:56:15 (EDT)
committerpelder2007-05-08 13:56:15 (EDT)
commit269b1296015b580d2ead157245a5bc42e922b999 (patch)
treefbb36ebc930d627a44f380f4b24aeb5763f29410
parent4cf10c4ad91ba5e06ac372998199f07eda9bbb01 (diff)
downloadorg.eclipse.jet-269b1296015b580d2ead157245a5bc42e922b999.zip
org.eclipse.jet-269b1296015b580d2ead157245a5bc42e922b999.tar.gz
org.eclipse.jet-269b1296015b580d2ead157245a5bc42e922b999.tar.bz2
[172691] XPath expression /* matches processing instructions when used with EMF 2.3
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
index 05491aa..ef09fcf 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
@@ -318,12 +318,32 @@ public class EObjectInspector implements IElementInspector, INodeInspectorExtens
EObject eObject = (EObject)obj;
NodeKind result = NodeKind.ELEMENT;
EStructuralFeature containingFeature = eObject.eContainingFeature();
+ ExtendedMetaData exMD = getExtendedMetaData(eObject);
+ EClass eClass = eObject.eClass();
+ String eClassName = exMD.getName(eClass);
+ if(XMLTypePackage.eNS_URI.equals(exMD.getNamespace(eClass)))
+ {
+ // Handle objects in the generic XMLTypePackage separately. Not all types here are
+ // Elements. Comments, ProcessingInstructions, CData etcetra can also appear.
+ // This complicated further because the package has evolved since EMF 2.2, and as
+ // of EMF 2.3 includes extra types (ProcessingInstruction), which for compatibility,
+ // the code cannot explicitly reference.
+ // For these special kinds,
+ if ("ProcessingInstruction".equals(eClassName)) //$NON-NLS-1$
+ {
+ return NodeKind.PROCESSING_INSTRUCTION;
+ }
+ else if("".equals(eClassName)) //$NON-NLS-1$
+ {
+ return NodeKind.ROOT;
+ }
+ }
if (containingFeature != null)
{
// mostly EObjects map to ELEMENTs, but some EObjects are
// ATTRIBUTES.
// We check the extended meta data on the containing feature to see.
- switch (getExtendedMetaData(eObject).getFeatureKind(containingFeature))
+ switch (exMD.getFeatureKind(containingFeature))
{
case ExtendedMetaData.ATTRIBUTE_FEATURE:
case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE:
@@ -331,7 +351,7 @@ public class EObjectInspector implements IElementInspector, INodeInspectorExtens
break;
}
}
- else if (EMPTY_STRING.equals(getExtendedMetaData(eObject).getName(eObject.eClass())))
+ else if (EMPTY_STRING.equals(eClassName))
{
// it's a XML Document Root.
result = NodeKind.ROOT;