473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

remove extraenious information between XML tags

I was editing a huge XML file that a friend of mine had made and I
didn't need some of the tags. WHen I was finished editing it, I
realised I had a lot of information between tags, in no man's land. eg:
<team>
<player>
<name>David Beckham</nameREAL MADRID
<positionRight Midfield </position>
</player>
</team>

How would I remove the Real Madrid type text on thousand of entries?

Thanks

Aug 29 '06 #1
2 1208
Jarry wrote:
I was editing a huge XML file that a friend of mine had made and I
didn't need some of the tags. WHen I was finished editing it, I
realised I had a lot of information between tags, in no man's land. eg:
<team>
<player>
<name>David Beckham</nameREAL MADRID
<positionRight Midfield </position>
</player>
</team>

How would I remove the Real Madrid type text on thousand of entries?
Select the player element, then remove all non-whitespace text child
nodes (or text child nodes containing 'REAL MADRID').
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 29 '06 #2

Jarry wrote:
I was editing a huge XML file that a friend of mine had made and I
didn't need some of the tags. WHen I was finished editing it, I
realised I had a lot of information between tags, in no man's land. eg:
They're not in "no man's land", they're text children of the <player>
element that aren't children of another element.

You've already had one good answer to this, but my personal choice
would be to use XSLT.

First of all, find the XSLT "identity" stylesheet (web search, I'm too
lazy). This copies input documents exactly, without changing them. Then
(a very useful general XSLT technique) add particular template rules to
this to cope with the situations where you don't want a simple identity
copy. In your case this would be something like this

<xsl:template match="player" >
<player>
<xsl:apply-templates select="*" />
</player>
</xsl:template>

Aug 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

163
by: Shiperton Henethe | last post by:
Hi Know any good utilities to help me strip out the tags that Microsoft Excel 2002 leaved behind when you try and export an HTML format file? This is driving me NUTS. And really makes me...
14
by: j1c | last post by:
How can I remove the content in between tags? I have a page that has several custom tags: <!--tag:1--> Content 1 <!--/tag:1--> <br> <!--tag:2--> Content 2 <!--/tag:2--> <br> <!--tag:3--> Content 3...
12
by: Oberon | last post by:
I have a large HTML document. It has hundreds of <span>s which have no attributes so these <span>s are redundant. How can I remove these tags automatically? The document also has <span>s with...
3
by: ad | last post by:
I have a string , it is make up of html tag and some text, like: <font color=red>Town </font></strong<strong>... How can I remove the html tag form this string with C#
1
by: prakash280681 | last post by:
how to get the correct result when we parse the xml code.Because in parsing when it get the syntax like < and & it break it and forward.. i use the code---- <?php $xml_file = "news.xml"; ...
0
by: peter pilsl | last post by:
For feeding the content of an xml-file to a search-indexer I need to remove all tags and extract the plaintext out of a xml-file. I use the null-xls-stylesheet <?xml version="1.0"?>...
2
by: James Equalizer | last post by:
hello all, In XSL what would be the easiest way to remove only the <information> element of my xml file, but at the same time keeping the child elements and its contents? Source xml file:...
1
by: shapper | last post by:
Hello, I was using LINQ with VS 2008 Beta 2 and suddenly after installed VS2008 final version I get an error. My code is really simple: Dim database As New MyDbDataContext Dim tag = (From...
11
by: David | last post by:
Hi All, I am working on a script that is theoreticaly simple but I can not get it to work completely. I am dealing with a page spit out by .NET that leaves empty tags in the markup. I need a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.