473,587 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
<positionRigh t Midfield </position>
</player>
</team>

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

Thanks

Aug 29 '06 #1
2 1222
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
<positionRigh t 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
14591
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 hate microsoft with a passion. I literally just want "compact HTML" - ie just the data,
14
2121
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 <!--/tag:3--> If I only wanted to see the contents of tag 2 for example, how could I strip out 1 and 3?
12
5202
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 style attributes that I don't want to remove.
3
5679
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
2377
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"; $title_key ="#CHANNEL#ITEM#TITLE"; //XML tag keys
0
4673
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"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> </xsl:stylesheet>
2
3371
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: <envelope> <body> <information> <lang>en</lang> </information>
1
2956
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 t In database.Tags _ Where t.TagID = index).Single
11
3305
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 javascript solution to go behind and do a clean up after the page loads. The .NET will leave behind any combination of nested tags. Here is an...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.