Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. best way to replace placeholder with value in xml string
  2. <PlaceHolders>
  3.   <PlaceHolder placeholder="PD1" value="value1" />
  4. </PlaceHolders>
  5.        
  6. <customers>
  7.   <customer avatarURL="PD1"/>
  8. </customers>
  9.        
  10. Dim doc As New XmlDocument()
  11. doc.LoadXml("...")
  12. For Each node As XmlNode In doc.SelectNodes("//@*[.='PD1']")
  13.     node.InnerText = "value1"
  14. Next
  15.        
  16. Dim doc As New XmlDocument()
  17. doc.LoadXml("...")
  18. For Each node As XmlNode In doc.SelectNodes("//@*[.='PD1'] | //*[text()='PD1']")
  19.     node.InnerText = "value1"
  20. Next