Ciao.
Ho il seguente blocco xml:
codice:
<?xml version="1.0" encoding="UTF-8" ?>
- <ex:iso_10303_28 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ex="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" xmlns="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" xsi:schemaLocation="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL http://www.iai-tech.org/ifcXML/IFC2x3/FINAL/IFC2X3.xsd" version="2.0">
- <ex:iso_10303_28_header>
<ex:name>example.ifcxml</ex:name>
<ex:time_stamp>2008-08-25T23:24:27</ex:time_stamp>
<ex:author>Architect</ex:author>
<ex:organization>Building Designer Office</ex:organization>
<ex:preprocessor_version>IFC Engine DLL version 1.02 beta</ex:preprocessor_version>
<ex:originating_system>IFC Engine DLL version 1.02 beta</ex:originating_system>
<ex:authorization>The authorising person</ex:authorization>
<ex:documentation>ViewDefinition [CoordinationView, QuantityTakeOffAddOnView]</ex:documentation>
</ex:iso_10303_28_header>
- <uos id="uos_1" description="" edo="" configuration="default" xmlns="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" xsi:schemaLocation="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL http://www.iai-tech.org/ifcXML/IFC2x3/FINAL/IFC2X3.xsd">
- <IfcProject id="i1">
<GlobalId>2ed7deT153aRxe9mZWpFs7</GlobalId>
- <OwnerHistory>
<IfcOwnerHistory xsi:nil="true" ref="i2" />
</OwnerHistory>
<Name>Default Project</Name>
<Description>Description of Default Project</Description>
- <RepresentationContexts ex:cType="set">
<IfcGeometricRepresentationContext pos="0" xsi:nil="true" ref="i20" />
</RepresentationContexts>
- <UnitsInContext>
<IfcUnitAssignment xsi:nil="true" ref="i7" />
</UnitsInContext>
</IfcProject>
sono riuscito a generare le classi del modello da XSDObjectGen.exe un utility microsoft.
ho quindi le seguenti classi nell object model:
codice:
[XmlRoot(ElementName="uos",Namespace=Declarations.SchemaVersion,IsNullable=false),Serializable]
[XmlType(TypeName="uos",Namespace=Declarations.SchemaVersion)]
//questa è la classe che non riesco a deserializzare
[XmlInclude(typeof(IFCModel.IfcProject))]
public class uos : ifc_org.uos
{
[System.Runtime.InteropServices.DispIdAttribute(-4)]
public IEnumerator GetEnumerator()
{
return EntityCollection.GetEnumerator();
}
public ifc_org.Entity Add(ifc_org.Entity obj)
{
return EntityCollection.Add(obj);
}
[XmlIgnore]
public ifc_org.Entity this[int index]
{
get { return (ifc_org.Entity) EntityCollection[index]; }
}
[XmlIgnore]
public int Count
{
get { return EntityCollection.Count; }
}
public void Clear()
{
EntityCollection.Clear();
}
public ifc_org.Entity Remove(int index)
{
ifc_org.Entity obj = EntityCollection[index];
EntityCollection.Remove(obj);
return obj;
}
public void Remove(object obj)
{
EntityCollection.Remove(obj);
}
[XmlElement(Type=typeof(ifc_org.Entity),ElementName="Entity",IsNullable=false,Form=XmlSchemaForm.Qualified,Namespace="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public EntityCollection __EntityCollection;
[XmlIgnore]
public EntityCollection EntityCollection
{
get
{
if (__EntityCollection == null) __EntityCollection = new EntityCollection();
return __EntityCollection;
}
set {__EntityCollection = value;}
}
public uos() : base()
{
}
new public void MakeSchemaCompliant()
{
base.MakeSchemaCompliant();
foreach (ifc_org.Entity _c in EntityCollection) _c.MakeSchemaCompliant();
}
new public static event DepthFirstTraversalDelegate DepthFirstTraversalEvent;
new public void DepthFirstTraversal(object parent, object context)
{
if (DepthFirstTraversalEvent != null) DepthFirstTraversalEvent(this, parent, context);
base.DepthFirstTraversal(parent, context);
if (__EntityCollection != null) foreach (ifc_org.Entity _d in __EntityCollection) _d.DepthFirstTraversal(this, context);
}
}
questa è la classe che non riesco a deserializzare:
codice:
[XmlRoot(ElementName="IfcProject",Namespace=Declarations.SchemaVersion,IsNullable=false),Serializable]
[XmlType(TypeName="IfcProject",Namespace=Declarations.SchemaVersion)]
public class IfcProject : IFCModel.IfcObject
{
[XmlElement(ElementName="LongName",IsNullable=true,DataType="string",Namespace=Declarations.SchemaVersion)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string __LongName;
[XmlIgnore]
public string LongName
{
get { return __LongName; }
set { __LongName = value; }
}
[XmlElement(ElementName="Phase",IsNullable=true,DataType="normalizedString",Namespace=Declarations.SchemaVersion)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string __Phase;
[XmlIgnore]
public string Phase
{
get { return __Phase; }
set { __Phase = value; }
}
[XmlElement(Type=typeof(RepresentationContexts),ElementName="RepresentationContexts",IsNullable=false,Namespace=Declarations.SchemaVersion)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public RepresentationContexts __RepresentationContexts;
[XmlIgnore]
public RepresentationContexts RepresentationContexts
{
get
{
if (__RepresentationContexts == null) __RepresentationContexts = new RepresentationContexts();
return __RepresentationContexts;
}
set {__RepresentationContexts = value;}
}
[XmlElement(Type=typeof(UnitsInContext),ElementName="UnitsInContext",IsNullable=false,Namespace=Declarations.SchemaVersion)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public UnitsInContext __UnitsInContext;
[XmlIgnore]
public UnitsInContext UnitsInContext
{
get
{
if (__UnitsInContext == null) __UnitsInContext = new UnitsInContext();
return __UnitsInContext;
}
set {__UnitsInContext = value;}
}
public IfcProject() : base()
{
}
new public void MakeSchemaCompliant()
{
base.MakeSchemaCompliant();
RepresentationContexts.MakeSchemaCompliant();
UnitsInContext.MakeSchemaCompliant();
}
new public static event DepthFirstTraversalDelegate DepthFirstTraversalEvent;
new public void DepthFirstTraversal(object parent, object context)
{
if (DepthFirstTraversalEvent != null) DepthFirstTraversalEvent(this, parent, context);
base.DepthFirstTraversal(parent, context);
if (__RepresentationContexts != null) __RepresentationContexts.DepthFirstTraversal(this, context);
if (__UnitsInContext != null) __UnitsInContext.DepthFirstTraversal(this, context);
}
}
VIene letto tutto tranne IfcProject , e non riesco a capire il perchè.
IfcProject è un attributo di uos , ma in uos non viene letto niente, solo la struttura senza dati .
Inoltre uos ha delle collezioni (arraylist) che sono sempre vuote .
Se io decoro una classe con un attributo come in uos dove ho decorato con ifcproject , per quali motivi puo' non essere letto il blocco xml relativo all'xmlroot(ifcproject)?
grazie.