Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:19:26+00:00 2026-06-07T18:19:26+00:00

I have replacement xml that has placeholder and its value. I have XML string

  • 0

I have replacement xml that has placeholder and its value. I have XML string where I need to search for placeholder and replace that with the value.

for example,

Placeholder XML:

<PlaceHolders>
  <PlaceHolder placeholder="PD1" value="value1" />
</PlaceHolders>

XML

<customers>
  <customer avatarURL="PD1"/>
</customers>

What is the best way to replace “PD1” with value “value1”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:19:28+00:00Added an answer on June 7, 2026 at 6:19 pm

    Here’s one way to do it using XPath. This will replace a single placeholder with its correct value. You would need to loop through and do this once for each placeholder. This will replace the placeholders found in any attribute of any element in the XML:

    Dim doc As New XmlDocument()
    doc.LoadXml("...")
    For Each node As XmlNode In doc.SelectNodes("//@*[.='PD1']")
        node.InnerText = "value1"
    Next
    

    If, however, you also need to replace it in the text value of elements as well (e.g. <customer>PD1</customer>), then you would need to change the XPath to find either attributes or element text values:

    Dim doc As New XmlDocument()
    doc.LoadXml("...")
    For Each node As XmlNode In doc.SelectNodes("//@*[.='PD1'] | //*[text()='PD1']")
        node.InnerText = "value1"
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object that has pairs of replacement values used for simple encoding
I have a little script that replace some text, that come from a xml
I have a replacement problem in VB.NET: I need to replace the character: result
How do you replace an element in jQuery and have the replacement element returned
i have a scene1 that is replaced by scene2 [[ccdirector shareddirector]replacescene:scene2]//scene2 replacement after doing
I have a SOAP Call that looks like this: <?xml version=1.0 encoding=utf-8?><soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/
I have a Silverlight client that I need to call a web service. The
I have been attempting to perform multiple (different) string replacement with recursion and I
I have a WCF application that at present is using XML based file storage
I have a telerik:GridBoundColumn in my telerik:RadGrid as a string type with some XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.