2016-04-04 19 views
1

XDocumentまたはXmlDocumentを使用して行番号を取得する方法を教えてください。 XDocumentでXMLファイルのテキストを含むタグの行番号を取得する

入力:XDocumentはライン情報をサポートしている場合は、check using the HasLineInfo methodにする必要があります

2. <article-title>Education Finance: How It Differs from the and the Analytic and Data Collection Changes It Implies</article-title> 
6. <contrib contrib-type="author"><name><surname>Guthrie</surname><given-names>James W.</given-names></name><aff>Department of Leadership, Policy and Organization, Peabody College of Vanderbil University, 230 Appleton Place, @ Nashville, TN 37203-5721, E-mail: <email xlink="[email protected]">[email protected]</email></aff> 
7. testest</contrib> 
+0

xmlデータを読み取るコードを追加してください。 – Marco

+0

[XElementの行番号を取得する]の可能な複製(0120-919-066) –

+0

[xmlファイルから行番号を含むテキストを取得する] in c#](http://stackoverflow.com/questions/36306857/get-text-with-line-number-from-xml-file-in-c-sharp) – TyrantsBeard

答えて

1

1. <title-group> 
2. <article-title>Education Finance: How It Differs from the and the 
Analytic and Data Collection Changes It Implies</article-title> 
4. </title-group> 
5. <contrib-group> 
6. <contrib contrib-type="author"><name><surname>Guthrie</surname><given-names>James W.</given-names></name><aff>Department of Leadership, Policy and Organization, Peabody College of Vanderbil University, 230 Appleton Place, @ Nashville, TN 37203-5721, E-mail: <email xlink="[email protected]">[email protected]</email></aff> 
7. testest</contrib> 
8. </contrib-group> 

私の出力は次のようになります。 LineNumber propertyのような機能の場合は、IXmlLineInfo Interfaceで使用できます。

関連する問題