下面是我需要解析的示例XML文件。这只是文件的一部分,原始文件非常大。但是格式总是一样的。如何读取R中xml的特定属性
我只想解析这些值并将其放入数据框中。
<Property Name="Entity1ID" Type="Edm.String">
<Annotation Term="test.Label">
<String>IDENTIFIER</String>
</Annotation>
</Property>
所以在数据帧我应该有这样
Entity1ID -> IDENTIFIER
ID -> FILEID
Entity2ID -> ID
等所有的值...
有大约10的EntityType和1000属性标记,我只需要解析属性标记并映射值。
我无法解析这些值。我知道这将是一个小程序,但是,我对R是新手。
在此先感谢。
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Data>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="test.Models" Alias="test">
<EntityType Name="Entity1">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="Entity1ID" Type="Edm.String">
<Annotation Term="test.Label">
<String>IDENTIFIER</String>
</Annotation>
</Property>
<Property Name="ID" Type="Edm.String">
<Annotation Term="test.Label">
<String>FILEID</String>
</Annotation>
</Property>
<NavigationProperty Name="Subjects" Type="Collection(test.Subjects)"/>
</EntityType>
<EntityType Name="Entity2">
<Key>
<PropertyRef Name="Entity2ID"/>
</Key>
<Property Name="Entity2ID" Type="Edm.String">
<Annotation Term="test.Label">
<String>ID</String>
</Annotation>
</Property>
</EntityType>
<Function Name="GetData" EntitySetPath="asphalt/Entity2" IsBound="true">
<Parameter Name="asphalt" Type="test.asphalt" Nullable="false"/>
<Parameter Name="ID" Type="Edm.String"/>
<ReturnType Type="Collection(test.Entity2)" Nullable="false"/>
</Function>
<Term Name="Label" Type="Edm.String"/>
<EntityContainer Name="API">
<EntitySet Name="Studies" EntityType="test.Entity1"/>
</EntityContainer>
</Schema>
</edmx:Data>
</edmx:Edmx>
那你试试,没有工作?” – hrbrmstr