473,414 Members | 1,606 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,414 software developers and data experts.

Finding tags in XML file not used in other files

X-No-Archive: yes
I have an XML file with hundreds of <resource> elements:

<resource name="val">
...
</resource>

There are now tens of files (written in a mix of C, C++ and C#!) in
another directory. I want to find all resources (by "name") in the XML
file that are not referenced anywhere in the files in the other
directory.

For example, if there's a tag <resource
name="RandomResource">...</resource> in the XML file, and the string
"RandomResource" (with or without quotes, as a whole word or not) is
not mentioned anywhere in the *.c and *.cpp and *.cs files in the other
directory, I want to know.

How exactly can I accomplish this? Is it even easy to do this in C#
(1.1 or 2.0)? I'm a newbie when it comes to files and XML in C#, so
specific pointers will be appreciated. If C# is not good for this, I
would at least like to know how I can tackle the problem.

Nov 17 '05 #1
2 1361
Hi,

you can read the xml using something like XmlTextReader and check the file
using Directory.GetFiles

No idea if there is a better solution, but that works .
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Elhurzen" <66*******@sneakemail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
X-No-Archive: yes
I have an XML file with hundreds of <resource> elements:

<resource name="val">
...
</resource>

There are now tens of files (written in a mix of C, C++ and C#!) in
another directory. I want to find all resources (by "name") in the XML
file that are not referenced anywhere in the files in the other
directory.

For example, if there's a tag <resource
name="RandomResource">...</resource> in the XML file, and the string
"RandomResource" (with or without quotes, as a whole word or not) is
not mentioned anywhere in the *.c and *.cpp and *.cs files in the other
directory, I want to know.

How exactly can I accomplish this? Is it even easy to do this in C#
(1.1 or 2.0)? I'm a newbie when it comes to files and XML in C#, so
specific pointers will be appreciated. If C# is not good for this, I
would at least like to know how I can tackle the problem.

Nov 17 '05 #2
As an outline, I would first "scan" all XML files building a table of
resource names (could be multithreaded), then grep the source files in some
way.

"Elhurzen" <66*******@sneakemail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
X-No-Archive: yes
I have an XML file with hundreds of <resource> elements:

<resource name="val">
...
</resource>

There are now tens of files (written in a mix of C, C++ and C#!) in
another directory. I want to find all resources (by "name") in the XML
file that are not referenced anywhere in the files in the other
directory.

For example, if there's a tag <resource
name="RandomResource">...</resource> in the XML file, and the string
"RandomResource" (with or without quotes, as a whole word or not) is
not mentioned anywhere in the *.c and *.cpp and *.cs files in the other
directory, I want to know.

How exactly can I accomplish this? Is it even easy to do this in C#
(1.1 or 2.0)? I'm a newbie when it comes to files and XML in C#, so
specific pointers will be appreciated. If C# is not good for this, I
would at least like to know how I can tackle the problem.

Nov 17 '05 #3

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

Similar topics

4
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of...
1
by: bjam | last post by:
Hi, I am trying to create a sort of include file into my xsl files such that calling the following template will push these xml tags into my document such that the other xsl files can use these...
22
by: Tony Houghton | last post by:
I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documents...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
8
by: Rick Strahl [MVP] | last post by:
Hi all, I'm building an app that uses the ASP.Net runtime... One problem I've run into is that pages running inside of the runtime are not finding DLLs in the GAC. In fact, if I look at the...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
23
by: Big Bill | last post by:
http://www.promcars.co.uk/pages/bonnie.php I don't believe they should be there, can I take them out without stopping the includes from functioning? I'm the (hapless) optimiser on this one... I...
3
by: Paul Moore | last post by:
I'd like to write some scripts to analyze and manipulate my music files. The files themselves are in MP3 and FLAC format (mostly MP3, but FLAC where I ripped original CDs and wanted a lossless...
1
by: jason.cipriani | last post by:
Here is an example with 3 files, containing a template structure and also a template function. The header A.h declares a template structure A with a default (i.e. for any template parameter),...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.