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 6083631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:25:32+00:00 2026-05-23T11:25:32+00:00

Possible Duplicate: A simple program to CRUD node and node values of xml file

  • 0

Possible Duplicate:
A simple program to CRUD node and node values of xml file

I am not looking for an exact attribute or and exact node text. Example

<Items>
  <book>
    <title> Beginning Java </title>
  </book>
   <book>
    <title> Beginning ASP </title>
  </book>
  <book>
    <title> Beginning Java </title>
  </book>
  <book>
    <title> Advance Java </title>
  </book>
  <book>
    <title> Advance ASP </title>
  </book>
</items>

What I want to be able too is find all books that has “Beginning” in the title or “Advance” in the title. Sort of wild type search. What do I need, XPATH? Either ASP.NET or PHP code will help.

I am doing this to write a utility to remove broken links in iTunes music library on MAC.

Thank you

Edit: Help needed with the actual XML
I am searching based on the in front of “Location” key. Never came across such an XML which has and .

Thanks again

<key>5175</key>
    <dict>
        <key>Track ID</key><integer>5175</integer>
        <key>Name</key><string>02 - Track 02</string>
        <key>Artist</key><string>Abba</string>
        <key>Album</key><string>Abba Gold</string>
        <key>Genre</key><string>English</string>
        <key>Kind</key><string>MPEG audio file</string>
        <key>Size</key><integer>5816448</integer>
        <key>Total Time</key><integer>242285</integer>
        <key>Track Number</key><integer>2</integer>
        <key>Date Modified</key><date>2003-09-28T14:37:38Z</date>
        <key>Date Added</key><date>2011-06-19T20:30:08Z</date>
        <key>Bit Rate</key><integer>192</integer>
        <key>Sample Rate</key><integer>44100</integer>
        <key>Persistent ID</key><string>9030665BDB2B4A20</string>
        <key>Track Type</key><string>File</string>
        <key>Location</key><string>file://localhost/Users/macbookpro/Music/iTunes/iTunes%20Media/Music/Abba/Abba%20Gold/02%2002%20-%20Track%2002.mp3</string>
        <key>File Folder Count</key><integer>5</integer>
        <key>Library Folder Count</key><integer>1</integer>
    </dict>
  • 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-05-23T11:25:33+00:00Added an answer on May 23, 2026 at 11:25 am

    In terms of XPath (1.0) which ASP.NET and PHP support with the normal installations you can use /Items/book[contains(title, 'Beginning') or contains(title, 'Advance')]. Note that XML node names and therefore XPath expressions are case-sensitive, your sample is not well-formed XML as it has a start tag <Items> but an end tag </items>.

    As for code to remove nodes with ASP.NET, try along the following lines:

    XmlDocument doc = new XmlDocument();
    doc.Load("input.xml");
    XmlNodeList booksToRemove = doc.SelectNodes("/Items/book[contains(title, 'Beginning') or contains(title, 'Advance')]");
    for (int i = booksToRemove.Length - 1; i >= 0; i--) {
      booksToRemove[i].ParentNode.RemoveChild(booksToRemove[i]);
    }
    doc.Save("output.xml");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: A simple program to CRUD node and node values of xml file
Writing a simple program that will find exact duplicate files on my computer, but
Possible Duplicate: What is a simple example of floating point/rounding error? When I execute
Possible Duplicate: Simple C scanf does not work? Why does scanf(%c, &letter); not working.
Possible Duplicate: Why an executable program for a specific CPU does not work on
Possible Duplicate: simple deadlock example in c# I've been dealing with multithreading in my
Possible Duplicate: sqlite example program in android I need to open a database where
Possible Duplicate: byte[] array pattern search I am trying to write a simple compression
Possible Duplicate: How does StackOverflow generate its SEO-friendly URLs? I made a simple form
Possible Duplicate: PHP: Script for generating Crossword game? Does anyone know any PHP-based simple

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.