1

私のxmlドキュメントは次のように構成されています:

<Root>
  <Word ID="23">
    <Type>auxiliary</Type>
    <English></English>
    <Thai></Thai>
    <Meaning></Meaning>
    <Audio>Dictionary Resources\Sound Files\23.wma</Audio>
    <Picture>Dictionary Resources\Picture Files\23.jpg</Picture>
    <Transliteration></Transliteration>
    <Timestamp />
  </Word>
...
</Root>

各ノードには一意の属性 (ID) があります。私がやりたいことは、属性のユーザー入力 (この場合は int 値 23) を使用して、タイムスタンプの .Value を修正することです。

擬似コードでは、次のようになります。

    Sub Timestamp(ByVal IDChosen As String)
    Dim Dictionary As XDocument = XDocument.Load("Dictionary Resources\Dictionary.xml")
    Dictionary.Root.Elements("Word").Atrribute"ID"(IDChosen).Value = DateTime.Now
    Dictionary.Save("Dictionary Resources\Dictionary.xml")
    End Sub
4

1 に答える 1