IFCXML c# deserialization problem

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small Hi, I am using .NET and #c and trying to deserialize some ifcxml (Industry Foundation Classes) files. The problem is that simple files deserialize well, but I can not deserialize
not even one file exported from ArchieCad (althought IFCviewers like Nemetchek dont have problems opening it). Probably I should add some atributes to auto generated classes?

<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small I did following: Downloaded<span>
IFC2X3.xsd and ex.xsd (http://www.iai-tech.org/ifcXML/IFC2x2/FINAL/) schema. Changed ex.xsd according to this article:
http://social.msdn.microsoft.com/Forums/en/xmlandnetfx/thread/3752d425-38ce-4219-b8a5-35504ace4a5a <span style="color:#0000ff; font-family:Times New Roman; font-size:small http://social.msdn.microsoft.com/Forums/en/xmlandnetfx/thread/3752d425-38ce-4219-b8a5-35504ace4a5a <span style="font-family:Times New Roman; font-size:small
and deleted schemaLocation from IFC2X3.xsd. With xsd.exe (exd /c IFCxml.xsd ex.xsd)<span>
I got IFCXML_ex.cs file with corresponding classes.
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small This ( Minimumexample.xml ) file deserializes OK:
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <?xml version="1.0" encoding="UTF-8"?>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <ex:iso_10303_28 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" version="2.0"
xmlns:ex="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" xsi:schemaLocation="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL http://www.iai-tech.org/ifcXML/IFC2x3/FINAL/IFC2x3.xsd
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<ex:iso_10303_28_header>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<ex:name>An Example</ex:name>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<ex:time_stamp>2010-11-12T13:04:00</ex:time_stamp>
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small Etc...
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small This one ( SimpleHouse.xml )
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <?xml version="1.0" encoding="utf-8"?>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <doc:iso_10303_28 xmlns:exp="urn:oid:1.0.10303.28.2.1.1" xmlns:doc="urn:oid:1.0.10303.28.2.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oid:1.0.10303.28.2.1.1
ex.xsd" version="2.0
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<uos id="uos_1" description="" configuration="i-ifc2x3" edo="" xmlns="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" xsi:schemaLocation="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL ifc2x3.xsd
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<IfcOrganization id="i1538
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<Id>GS</Id>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<Name>Graphisoft</Name>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<Description>Graphisoft</Description>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
</IfcOrganization>
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<IfcApplication id="i1542
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
<ApplicationDeveloper>
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small Etc...
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small Fails with:

<p style="margin:0cm 0cm 0pt <span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt UnitTests.TestVaria.Deserialize_SimpleHouse:
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt System.InvalidOperationException : There is an error in XML document (2, 2).
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt <span>
----> System.InvalidOperationException : <iso_10303_28 xmlns=urn:oid:1.0.10303.28.2.1.3> was not expected.
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt at UnitTests.TestVaria.DeserializeIFCXMLFile(String filename) in Program.cs:line 34 at UnitTests.TestVaria.Deserialize_SimpleHouse() in Program.cs:line 50 --InvalidOperationException
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderiso_10303_28.Read1446_iso_10303_28()
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt
<p style="margin:0cm 0cm 0pt <span style="font-family:"Courier New"; font-size:11pt
<p style="margin:0cm 0cm 0pt <span style="font-size:11pt <span style="font-family:Times New Roman Any ideas? Thanks in advance.
<span style="font-family:Times New Roman; font-size:small M<br/>

View the full article
 
Back
Top