Bonjour,
j'aimerais savoir quelle est la syntaxe XPath pour obtenir la hiérarchie des éléments (avec les noms et valeurs de leurs attributs) à partir de cet élément :
<edmx:ConceptualModels>
dans le fichier suivant (cf PJ pour plus de lisibilité) :
Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199 <?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="NorthwindModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> <EntityContainer Name="NorthwindModelStoreContainer"> <EntitySet Name="Categories" EntityType="NorthwindModel.Store.Categories" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Customers" EntityType="NorthwindModel.Store.Customers" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Orders" EntityType="NorthwindModel.Store.Orders" store:Type="Tables" Schema="dbo" /> <AssociationSet Name="FK_Orders_Customers" Association="NorthwindModel.Store.FK_Orders_Customers"> <End Role="Customers" EntitySet="Customers" /> <End Role="Orders" EntitySet="Orders" /> </AssociationSet> </EntityContainer> <EntityType Name="Categories"> <Key> <PropertyRef Name="CategoryID" /> </Key> <Property Name="CategoryID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" /> <Property Name="Description" Type="ntext" /> <Property Name="Picture" Type="image" /> </EntityType> <EntityType Name="Customers"> <Key> <PropertyRef Name="CustomerID" /> </Key> <Property Name="CustomerID" Type="nchar" Nullable="false" MaxLength="5" /> <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" /> <Property Name="ContactName" Type="nvarchar" MaxLength="30" /> <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" /> <Property Name="Address" Type="nvarchar" MaxLength="60" /> <Property Name="City" Type="nvarchar" MaxLength="15" /> <Property Name="Region" Type="nvarchar" MaxLength="15" /> <Property Name="PostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="Country" Type="nvarchar" MaxLength="15" /> <Property Name="Phone" Type="nvarchar" MaxLength="24" /> <Property Name="Fax" Type="nvarchar" MaxLength="24" /> </EntityType> <EntityType Name="Orders"> <Key> <PropertyRef Name="OrderID" /> </Key> <Property Name="OrderID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nchar" MaxLength="5" /> <Property Name="EmployeeID" Type="int" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <Property Name="ShipVia" Type="int" /> <Property Name="Freight" Type="money" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> <Association Name="FK_Orders_Customers"> <End Role="Customers" Type="NorthwindModel.Store.Customers" Multiplicity="0..1" /> <End Role="Orders" Type="NorthwindModel.Store.Orders" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="Customers"> <PropertyRef Name="CustomerID" /> </Principal> <Dependent Role="Orders"> <PropertyRef Name="CustomerID" /> </Dependent> </ReferentialConstraint> </Association> </Schema></edmx:StorageModels> <!-- CSDL content --> <edmx:ConceptualModels> <Schema Namespace="NorthwindModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm"> <EntityContainer Name="NorthwindEntities"> <EntitySet Name="Customers" EntityType="NorthwindModel.Customers" /> <EntitySet Name="Orders" EntityType="NorthwindModel.Orders" /> <AssociationSet Name="FK_Orders_Customers" Association="NorthwindModel.FK_Orders_Customers"> <End Role="Customers" EntitySet="Customers" /> <End Role="Orders" EntitySet="Orders" /> </AssociationSet> </EntityContainer> <EntityType Name="Customers"> <Key> <PropertyRef Name="CustomerID" /> </Key> <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="true" /> <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" /> <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" /> <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" /> <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" /> <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" /> <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" /> <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" /> <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" /> <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" /> <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" /> <NavigationProperty Name="Orders" Relationship="NorthwindModel.FK_Orders_Customers" FromRole="Customers" ToRole="Orders" /> </EntityType> <EntityType Name="Orders"> <Key> <PropertyRef Name="OrderID" /> </Key> <Property Name="OrderID" Type="Int32" Nullable="false" /> <Property Name="EmployeeID" Type="Int32" /> <Property Name="OrderDate" Type="DateTime" /> <Property Name="RequiredDate" Type="DateTime" /> <Property Name="ShippedDate" Type="DateTime" /> <Property Name="ShipVia" Type="Int32" /> <Property Name="Freight" Type="Decimal" Precision="19" Scale="4" /> <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" /> <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" /> <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" /> <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" /> <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" /> <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" /> <NavigationProperty Name="Customers" Relationship="NorthwindModel.FK_Orders_Customers" FromRole="Orders" ToRole="Customers" /> </EntityType> <Association Name="FK_Orders_Customers"> <End Role="Customers" Type="NorthwindModel.Customers" Multiplicity="0..1" /> <End Role="Orders" Type="NorthwindModel.Orders" Multiplicity="*" /> </Association> </Schema> </edmx:ConceptualModels> <!-- C-S mapping content --> <edmx:Mappings> <Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS"> <EntityContainerMapping StorageEntityContainer="NorthwindModelStoreContainer" CdmEntityContainer="NorthwindEntities"> <EntitySetMapping Name="Customers"> <EntityTypeMapping TypeName="IsTypeOf(NorthwindModel.Customers)"> <MappingFragment StoreEntitySet="Customers"> <ScalarProperty Name="CustomerID" ColumnName="CustomerID" /> <ScalarProperty Name="CompanyName" ColumnName="CompanyName" /> <ScalarProperty Name="ContactName" ColumnName="ContactName" /> <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" /> <ScalarProperty Name="Address" ColumnName="Address" /> <ScalarProperty Name="City" ColumnName="City" /> <ScalarProperty Name="Region" ColumnName="Region" /> <ScalarProperty Name="PostalCode" ColumnName="PostalCode" /> <ScalarProperty Name="Country" ColumnName="Country" /> <ScalarProperty Name="Phone" ColumnName="Phone" /> <ScalarProperty Name="Fax" ColumnName="Fax" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <EntitySetMapping Name="Orders"> <EntityTypeMapping TypeName="IsTypeOf(NorthwindModel.Orders)"> <MappingFragment StoreEntitySet="Orders"> <ScalarProperty Name="OrderID" ColumnName="OrderID" /> <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" /> <ScalarProperty Name="OrderDate" ColumnName="OrderDate" /> <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" /> <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" /> <ScalarProperty Name="ShipVia" ColumnName="ShipVia" /> <ScalarProperty Name="Freight" ColumnName="Freight" /> <ScalarProperty Name="ShipName" ColumnName="ShipName" /> <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" /> <ScalarProperty Name="ShipCity" ColumnName="ShipCity" /> <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" /> <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" /> <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <AssociationSetMapping Name="FK_Orders_Customers" TypeName="NorthwindModel.FK_Orders_Customers" StoreEntitySet="Orders"> <EndProperty Name="Customers"> <ScalarProperty Name="CustomerID" ColumnName="CustomerID" /> </EndProperty> <EndProperty Name="Orders"> <ScalarProperty Name="OrderID" ColumnName="OrderID" /> </EndProperty> <Condition ColumnName="CustomerID" IsNull="false" /> </AssociationSetMapping> </EntityContainerMapping> </Mapping> </edmx:Mappings> </edmx:Runtime> <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:Connection> <DesignerInfoPropertySet> <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /> </DesignerInfoPropertySet> </edmx:Connection> <edmx:Options> <DesignerInfoPropertySet> <DesignerProperty Name="ValidateOnBuild" Value="true" /> </DesignerInfoPropertySet> </edmx:Options> <edmx:Diagrams > <Diagram Name="Northwind"> <EntityTypeShape EntityType="NorthwindModel.Customers" PointX="0.75" PointY="1.25" Width="1.5" Height="3.3263964843749996" IsExpanded="true" /> <EntityTypeShape EntityType="NorthwindModel.Orders" PointX="3" PointY="1" Width="1.5" Height="3.7109993489583331" IsExpanded="true" /> <AssociationConnector Association="NorthwindModel.FK_Orders_Customers" ManuallyRouted="false"> <ConnectorPoint PointX="2.25" PointY="2.9131982421875" /> <ConnectorPoint PointX="3" PointY="2.9131982421875" /></AssociationConnector> </Diagram></edmx:Diagrams> </edmx:Designer> </edmx:Edmx>
Je connais mal XPath, et surtout je me demande quelle influence ont les namespaces dans les requêtes XPath.
Merci pour votre aide.
Partager