0

I have XML file where some elements are resources inside. like

<cim:BusbarSection rdf:ID="Busbar_05" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"       xmlns:cim="http://iec.ch/TC57/2001/CIM-schema-cim10#">
<cim:Naming.name>30189P0205_Busbar_01</cim:Naming.name>
<cim:Equipment.MemberOf_EquipmentContainter rdf:resource="#VL_05" />
</cim:BusbarSection>

See the Equipment.Equipment.MemberOf_EquipmentContainter is a resource define in a same XML file but somewhere else like

<cim:VoltageLevel rdf:ID="VL_05" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:cim="http://iec.ch/TC57/2001/CIM-schema-cim10#">
<cim:Naming.name>VL_0.22_1</cim:Naming.name>
<cim:VoltageLevel.MemberOf_Substation rdf:resource="#Substation_01" />
<cim:VoltageLevel.BaseVoltage rdf:resource="#BaseVoltage_02" /></cim:VoltageLevel>

In my C# code, i have class structure Like

  [XmlType("BusbarSection", Namespace = "http://iec.ch/TC57/2001/CIM-schema-cim10#")] 
   public class BusbarSection:Connector 
   {
       public BusbarSection()
       {
       }

   }
    public class Connector:Core.ConductingEquipment
   {

      public Connector()
      {
      }

   }
   public class ConductingEquipment:Equipment 
    {
        //functions and constcturess...
    }
    public class Equipment:PowerSystemResource
   {
       [XmlElement("Equipment.MemberOf_EquipmentContainer")]
       public EquipmentContainer MemberOf_EquipmentContainer; 

       public Equipment()
       {
       }

   }

public class EquipmentContainer:PowerSystemResource
{

    public Topology.ConnectivityNode[] ConnectivityNodes;
    public Equipment[] Contains_Equipments; 

    public EquipmentContainer()
    {

    }

}

I am trying to serialize the xml file, it is working good but the elements with as resource EquipmentContainer is coming null.

I am not sure how to serialize xml elements that are as resources in xml. I am missing some concepts in serialization of xmls in c# , i couldn't find how to look for help / Google this question.

4

1 回答 1

0

如果您正在使用 RDF,为什么不使用 RDF 库呢?RDF 可以被序列化为 XML,但正如例如this中所描述的,有几种方法可以做到这一点。例如,rdf:ID属性可以替换为rdf:about- 这可能会破坏您的解析器。

您可能会对使用 RDF dotnetRDF的 .Net 库感兴趣。

于 2013-03-22T09:29:06.173 回答