Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » getResource issue
getResource issue [message #619500] Tue, 20 April 2010 12:43 Go to next message
Vaz is currently offline Vaz
Messages: 16
Registered: July 2009
Junior Member
Hello all,

I'm trying to load a xml into an EObject. I use the following code:

(...)
resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED _META_DATA, Boolean.TRUE); resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new GenericXMLResourceFactoryImpl());
Resource resource = resourceSet.getResource(URI.createFileURI(xmlFile), true);
EObject documentRoot = (EObject)resource.getContents().get(0);
(...)


I get an exception on the last line.


Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException: org.eclipse.emf.ecore.xmi.IllegalValueException: Value '0' is not legal. (file:///C:/copy/wS/BS/data/example.ifcxml, 161, 46)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
at bs.Loader.XsdTest.main(XsdTest.java:113)
Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value '0' is not legal. (file:///C:/copy/wS/BS/data/example.ifcxml, 161, 46)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2662)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XML Handler.java:2716)
at org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.handleObjectAtt ribs(SAXXMLHandler.java:83)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFa ctory(XMLHandler.java:2192)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFe atureType(XMLHandler.java:2158)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:2034)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1813)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1023)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1282)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:255)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:270)
... 2 more
Caused by: java.lang.IllegalArgumentException: The value '0' is invalid.
at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createFromStrin g(XMLHelperImpl.java:1621)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHel perImpl.java:1162)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2657)
... 27 more


Well, on the line 161 of the xml file i have the following: "<IfcLengthMeasure pos="0">0.</IfcLengthMeasure>".

In the context:

<IfcCartesianPoint id="i22">
<Coordinates ex:cType="list">
<IfcLengthMeasure pos="0">0.</IfcLengthMeasure>
<IfcLengthMeasure pos="1">0.</IfcLengthMeasure>
<IfcLengthMeasure pos="2">0.</IfcLengthMeasure>
</Coordinates>
</IfcCartesianPoint>


The element in the xml schema is as follows:

<xs:element name="IfcLengthMeasure" nillable="true">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="ifc:IfcLengthMeasure">
<xs:attributeGroup ref="ex:instanceAttributes">
</xs:attributeGroup>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

<xs:simpleType name="IfcLengthMeasure">
<xs:restriction base="xs:double">
</xs:restriction>
</xs:simpleType>


<xs:attributeGroup name="instanceAttributes">
<xs:attribute name="id" type="xs:ID" use="optional"/>
<xs:attribute name="path" type="xs:NMTOKENS" use="optional"/>
<xs:attribute name="pos" use="optional">
<xs:simpleType>
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:integer"/>
</xs:simpleType>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup


I already validated the xml with SAX and here: http://tools.decisionsoft.com/schemaValidate/
None of them returned errors, so i'm excluding any xml issues.

Could it be a problem with the parser EMF uses? If i remove the "pos" attribute i don't get the exception, but then i lose important data :blush:
Does any of you have an idea or suggestion?

Thank you,
João Vaz
Re: getResource issue [message #619501 is a reply to message #619500] Tue, 20 April 2010 13:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25747
Registered: July 2009
Senior Member
João,

Comments below.

Vaz wrote:
> Hello all,
>
> I'm trying to load a xml into an EObject. I use the following code:
>
> (...)
> resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED _META_DATA,
> Boolean.TRUE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
> new GenericXMLResourceFactoryImpl());
It already uses that option, so no point in doing the options thing
before it.
> Resource resource =
> resourceSet.getResource(URI.createFileURI(xmlFile), true);
> EObject documentRoot = (EObject)resource.getContents().get(0);
> (...)
>
>
> I get an exception on the last line.
>
>
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value '0' is not
> legal. (file:///C:/copy/wS/BS/data/example.ifcxml, 161, 46)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
>
> at bs.Loader.XsdTest.main(XsdTest.java:113)
I don't know what models you have registered. Did you generate a model
for your schema? If so, try invoking Generate Test Code and using the
generated XyzExample.java in the *.tests project.
> Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value '0'
> is not legal. (file:///C:/copy/wS/BS/data/example.ifcxml, 161, 46)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2662)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XML Handler.java:2716)
>
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.handleObjectAtt ribs(SAXXMLHandler.java:83)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFa ctory(XMLHandler.java:2192)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFe atureType(XMLHandler.java:2158)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:2034)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1813)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1023)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
>
> at
> org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at
> org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown Source)
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1282)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:255)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:270)
>
> ... 2 more
> Caused by: java.lang.IllegalArgumentException: The value '0' is
> invalid. at
> org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFa ctoryImpl.java:439)
>
If your schema was actually being used, I'd expect this to end up using
an EDataType from XMLTypeFactoryImpl. Do you know which model's
EDataType is being used to process the literals here?
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createFromStrin g(XMLHelperImpl.java:1621)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHel perImpl.java:1162)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2657)
>
> ... 27 more
>
>
> Well, on the line 161 of the xml file i have the following:
> "<IfcLengthMeasure pos="0">0.</IfcLengthMeasure>".
>
> In the context:
>
> <IfcCartesianPoint id="i22">
> <Coordinates ex:cType="list">
> <IfcLengthMeasure pos="0">0.</IfcLengthMeasure>
> <IfcLengthMeasure pos="1">0.</IfcLengthMeasure>
> <IfcLengthMeasure pos="2">0.</IfcLengthMeasure>
> </Coordinates>
> </IfcCartesianPoint>
>
>
> The element in the xml schema is as follows:
>
> <xs:element name="IfcLengthMeasure" nillable="true">
> <xs:complexType>
> <xs:simpleContent>
> <xs:extension base="ifc:IfcLengthMeasure">
> <xs:attributeGroup ref="ex:instanceAttributes">
> </xs:attributeGroup>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
>
> <xs:simpleType name="IfcLengthMeasure">
> <xs:restriction base="xs:double">
> </xs:restriction>
> </xs:simpleType>
>
>
> <xs:attributeGroup name="instanceAttributes">
> <xs:attribute name="id" type="xs:ID" use="optional"/>
> <xs:attribute name="path" type="xs:NMTOKENS" use="optional"/>
> <xs:attribute name="pos" use="optional">
> <xs:simpleType>
> <xs:restriction>
> <xs:simpleType>
> <xs:list itemType="xs:integer"/>
> </xs:simpleType>
> <xs:minLength value="1"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:attributeGroup
>
>
> I already validated the xml with SAX and here:
> http://tools.decisionsoft.com/schemaValidate/
> None of them returned errors, so i'm excluding any xml issues.
>
> Could it be a problem with the parser EMF uses?
No, some issue with the data type being used not allowing the value "0"
but I can't imagine why. "xsd:integer" obviously allows that and a list
of those should allow it too.
> If i remove the "pos" attribute i don't get the exception, but then i
> lose important data :blush: Does any of you have an idea or suggestion?
> Thank you,
> João Vaz
Re: getResource issue [message #619548 is a reply to message #619500] Thu, 22 April 2010 10:46 Go to previous messageGo to next message
Vaz is currently offline Vaz
Messages: 16
Registered: July 2009
Junior Member
Hi Ed,
Quote:
> Just from the snips you've shown, it's not apparent to me yet what data
> type is being used to process the "0" value.

My xml schema imports another schema. So in fact I have to load both into separate models, resulting in two separate *.ecore files. Although here, I didn't understand your suggestion, when you say Quote:
> If there is more than one Ecore model, it's important to put all of them
> in resources before saving any of them so that they reference each other
> correctly via their physical location.
you mean that I must put both EcorePackages in the same ResourceSet? If so, i think I'm already doing that.


Thus, the relevant lines to solve the error from both generated Ecore models are:

The IfcCartesianPoint:

<eClassifiers xsi:type="ecore:EClass" name="IfcCartesianPoint" eSuperTypes="./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//IfcPoint ">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="IfcCartesianPoint"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="coordinates" lowerBound="1"
eType="ecore:EClass ./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//CoordinatesTy pe1 "
containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="Coordinates"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
which has an eStructuralFeature "Coordinates" of the type CoordinatesType1:

<eClassifiers xsi:type="ecore:EClass" name="CoordinatesType1">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Coordinates_._1_._type"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="ifcLengthMeasure" lowerBound="1"
upperBound="3" eType="ecore:EClass ./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//IfcLengthMeas ureType "
containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="IfcLengthMeasure"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="arraySize" eType="ecore:EDataType ./org.iso.standard._10303.part._28.version._2.xmlschema.comm on2.ecore#//ArraySizeType ">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="arraySize"/>
<details key="namespace" value=" urn:iso.org:standard:10303:part(28):version(2):xmlschema:com mon "/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cType" eType="ecore:EDataType ./org.iso.standard._10303.part._28.version._2.xmlschema.comm on2.ecore#//CTypeType "
defaultValueLiteral="list" unsettable="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="cType"/>
<details key="namespace" value=" urn:iso.org:standard:10303:part(28):version(2):xmlschema:com mon "/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="itemType" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//QName"
defaultValueLiteral="ifc:IfcLengthMeasure" unsettable="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="itemType"/>
<details key="namespace" value=" urn:iso.org:standard:10303:part(28):version(2):xmlschema:com mon "/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>

Here starts the problem (i think...), because the CoordinatesType1 has an eStructuralFeatures named ifcLengthMeasure which references the type IfcLengthMeasureType :

<eClassifiers xsi:type="ecore:EClass" name="IfcLengthMeasureType">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="IfcLengthMeasure_._type"/>
<details key="kind" value="simple"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType ./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//IfcLengthMeas ure "
unsettable="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value=":0"/>
<details key="kind" value="simple"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
iD="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="id"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//NMTOKENS">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="path"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="pos" eType="ecore:EDataType ./org.iso.standard._10303.part._28.version._2.xmlschema.comm on2.ecore#//PosType ">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="pos"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>

The error parsing the xml data is very specific and points out to the Attribute "pos" of the Eclass above, and it doesn't matter what value I insert. That Attribute is of the type "PosType" and is declared in the other Ecore file as follows:
<eClassifiers xsi:type="ecore:EDataType" name="PosType" instanceClassName="java.util.List">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="pos_._type"/>
<details key="minLength" value="1"/>
</eAnnotations>
</eClassifiers>





And finally, the xml I'm trying to load (which is created automatically with a specific sofware):

(...)
<IfcCartesianPoint id="i22">
<Coordinates ex:cType="list">
<IfcLengthMeasure pos="0">0.</IfcLengthMeasure>
<IfcLengthMeasure pos="1">0.</IfcLengthMeasure>
<IfcLengthMeasure pos="2">0.</IfcLengthMeasure>
</Coordinates>
</IfcCartesianPoint>
(...)

Do you think there's a problem with the generated models? Or maybe even with the way they reference each other?

I know the post got a bit confusing (and huge), sorry for that, but it gets really difficult to explain the problem.

Thanks once more,
João Vaz
Re: getResource issue [message #619549 is a reply to message #619548] Fri, 23 April 2010 13:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25747
Registered: July 2009
Senior Member
Vaz,

Comments below.

Vaz wrote:
> Hi Ed,
> Quote:
>> Just from the snips you've shown, it's not apparent to me yet what
>> data type is being used to process the "0" value.
>
> My xml schema imports another schema. So in fact I have to load both
> into separate models, resulting in two separate *.ecore files.
> Although here, I didn't understand your suggestion, when you say Quote:
>> If there is more than one Ecore model, it's important to put all of
>> them in resources before saving any of them so that they reference
>> each other correctly via their physical location.
> you mean that I must put both EcorePackages in the same ResourceSet?
> If so, i think I'm already doing that.
The models will reference each other via the URI of the resource that
contains them, so it's import to establish those names first. Perhaps
you're lucky that the order in which you process happens to set the URI
of the referenced model before a reference to it from the second model
is saved.
>
>
> Thus, the relevant lines to solve the error from both generated Ecore
> models are:
>
> The IfcCartesianPoint:
>
> <eClassifiers xsi:type="ecore:EClass" name="IfcCartesianPoint"
> eSuperTypes="./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//IfcPoint ">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="IfcCartesianPoint"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference" name="coordinates"
> lowerBound="1"
> eType="ecore:EClass
> ./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//CoordinatesTy pe1 "
> containment="true" resolveProxies="false">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="Coordinates"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
> which has an eStructuralFeature "Coordinates" of the type
> CoordinatesType1:
>
> <eClassifiers xsi:type="ecore:EClass" name="CoordinatesType1">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Coordinates_._1_._type"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="ifcLengthMeasure" lowerBound="1"
> upperBound="3" eType="ecore:EClass
> ./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//IfcLengthMeas ureType "
> containment="true" resolveProxies="false">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="IfcLengthMeasure"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="arraySize"
> eType="ecore:EDataType
> ./org.iso.standard._10303.part._28.version._2.xmlschema.comm on2.ecore#//ArraySizeType ">
>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="arraySize"/>
> <details key="namespace"
> value=" urn:iso.org:standard:10303:part(28):version(2):xmlschema:com mon "/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="cType"
> eType="ecore:EDataType
> ./org.iso.standard._10303.part._28.version._2.xmlschema.comm on2.ecore#//CTypeType "
>
> defaultValueLiteral="list" unsettable="true">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="cType"/>
> <details key="namespace"
> value=" urn:iso.org:standard:10303:part(28):version(2):xmlschema:com mon "/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="itemType"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//QName"
> defaultValueLiteral="ifc:IfcLengthMeasure" unsettable="true">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="itemType"/>
> <details key="namespace"
> value=" urn:iso.org:standard:10303:part(28):version(2):xmlschema:com mon "/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
> Here starts the problem (i think...), because the CoordinatesType1 has
> an eStructuralFeatures named ifcLengthMeasure which references the
> type IfcLengthMeasureType :
>
> <eClassifiers xsi:type="ecore:EClass" name="IfcLengthMeasureType">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="IfcLengthMeasure_._type"/>
> <details key="kind" value="simple"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
> eType="ecore:EDataType
> ./org.tech.iai.ifc.xml.ifc._2x3.final2.ecore#//IfcLengthMeas ure "
> unsettable="true">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value=":0"/>
> <details key="kind" value="simple"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
> iD="true">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="id"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="path"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//NMTOKENS">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="path"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pos"
> eType="ecore:EDataType
> ./org.iso.standard._10303.part._28.version._2.xmlschema.comm on2.ecore#//PosType ">
>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="pos"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
>
> The error parsing the xml data is very specific and points out to the
> Attribute "pos" of the Eclass above, and it doesn't matter what value
> I insert. That Attribute is of the type "PosType" and is declared in
> the other Ecore file as follows:
> <eClassifiers xsi:type="ecore:EDataType" name="PosType"
> instanceClassName="java.util.List">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
I don't seen an annotation for key="baseType" nor any EDataType that
specifies the itemType.
> <details key="name" value="pos_._type"/>
> <details key="minLength" value="1"/>
> </eAnnotations>
> </eClassifiers>
>
>
If you provide a complete schema I can see if it's producing the right
Ecore model from it but what you show looks incomplete.
>
>
>
> And finally, the xml I'm trying to load (which is created
> automatically with a specific sofware):
>
> (...)
> <IfcCartesianPoint id="i22">
> <Coordinates ex:cType="list">
> <IfcLengthMeasure pos="0">0.</IfcLengthMeasure>
> <IfcLengthMeasure pos="1">0.</IfcLengthMeasure>
> <IfcLengthMeasure pos="2">0.</IfcLengthMeasure>
> </Coordinates>
> </IfcCartesianPoint>
> (...)
>
> Do you think there's a problem with the generated models? Or maybe
> even with the way they reference each other?
>
> I know the post got a bit confusing (and huge), sorry for that, but it
> gets really difficult to explain the problem.
>
> Thanks once more,
> João Vaz
Re: getResource issue [message #619551 is a reply to message #619500] Mon, 26 April 2010 06:29 Go to previous messageGo to next message
Vaz is currently offline Vaz
Messages: 16
Registered: July 2009
Junior Member
Hi Ed,
Quote:
> The models will reference each other via the URI of the resource that
> contains them, so it's import to establish those names first. Perhaps
> you're lucky that the order in which you process happens to set the URI
> of the referenced model before a reference to it from the second model
> is saved.

Understood now.


Quote:
> If you provide a complete schema I can see if it's producing the right
> Ecore model from it but what you show looks incomplete.

I can't post the schema because it has 22.000 lines :blush:
Though both schemas (IFC.xsd and the referenced ex.xsd) are available here http://www.iai-tech.org/products/ifc_specification/ifcxml-re leases/ifcxml2x3-release/summary and I'd greatly appreciate if you could take a look at it.

Thanks again for your help.

João Vaz
Re: getResource issue [message #619553 is a reply to message #619551] Mon, 26 April 2010 06:47 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25747
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080500070805090605070304
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Vaz,

For me I end up with this

<eClassifiers xsi:type="ecore:EDataType" name="PosType"
instanceClassName="java.util.List">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="pos_._type"/>
*<details key="baseType" value="pos_._type_._base"/>*
<details key="minLength" value="1"/>
</eAnnotations>
</eClassifiers>

Note there's a baseType annotation. So it looks fine to me and I don't
know why it's not working this same expected way for you.


Vaz wrote:
> Hi Ed,
> Quote:
>> The models will reference each other via the URI of the resource that
>> contains them, so it's import to establish those names first. Perhaps
>> you're lucky that the order in which you process happens to set the
>> URI of the referenced model before a reference to it from the second
>> model is saved.
>
> Understood now.
>
>
> Quote:
>> If you provide a complete schema I can see if it's producing the
>> right Ecore model from it but what you show looks incomplete.
>
> I can't post the schema because it has 22.000 lines :blush: Though
> both schemas (IFC.xsd and the referenced ex.xsd) are available here
> http://www.iai-tech.org/products/ifc_specification/ifcxml-re leases/ifcxml2x3-release/summary
> and I'd greatly appreciate if you could take a look at it.
>
> Thanks again for your help.
>
> João Vaz

--------------080500070805090605070304
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Vaz,<br>
<br>
For me I end up with this<br>
<br>
  &lt;eClassifiers xsi:type="ecore:EDataType" name="PosType"
instanceClassName="java.util.List"&gt;<br>
    &lt;eAnnotations
source=<a class="moz-txt-link-rfc2396E" href="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">"http:///org/eclipse/emf/ecore/util/ExtendedMetaData"</a>&gt;<br>
      &lt;details key="name" value="pos_._type"/&gt;<br>
      <b>&lt;details key="baseType" value="pos_._type_._base"/&gt;</b><br>
      &lt;details key="minLength" value="1"/&gt;<br>
    &lt;/eAnnotations&gt;<br>
  &lt;/eClassifiers&gt;<br>
<br>
Note there's a baseType annotation.  So it looks fine to me and I don't
know why it's not working this same expected way for you.<br>
<br>
<br>
Vaz wrote:
<blockquote cite="mid:hr3ptf$1o5$1@build.eclipse.org" type="cite">Hi
Ed,
<br>
Quote:
<br>
<blockquote type="cite">The models will reference each other via the
URI of the resource that contains them, so it's import to establish
those names first. Perhaps you're lucky that the order in which you
process happens to set the URI of the referenced model before a
reference to it from the second model is saved.
<br>
</blockquote>
<br>
Understood now.
<br>
<br>
<br>
Quote:
<br>
<blockquote type="cite">If you provide a complete schema I can see if
it's producing the right Ecore model from it but what you show looks
incomplete.
<br>
</blockquote>
<br>
I can't post the schema because it has 22.000 lines  :blush: Though
both schemas (IFC.xsd and the referenced ex.xsd) are available here
<a class="moz-txt-link-freetext" href=" http://www.iai-tech.org/products/ifc_specification/ifcxml-re leases/ifcxml2x3-release/summary"> http://www.iai-tech.org/products/ifc_specification/ifcxml-re leases/ifcxml2x3-release/summary</a>
and I'd greatly appreciate if you could take a look at it.
<br>
<br>
Thanks again for your help.
<br>
<br>
João Vaz
<br>
</blockquote>
</body>
</html>

--------------080500070805090605070304--
Previous Topic:XMLResource with xmlns=""
Next Topic:getResource issue
Goto Forum:
  


Current Time: Sun Apr 20 09:33:20 EDT 2014

Powered by FUDForum. Page generated in 0.03990 seconds