parsing an xml

S

sp

i have an xml file (an rss file)

<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>CodeGuru.com</title>
<link>http://www.codeguru.com/</link>
<description>The number one developer site!</description>
<language>en-us</language>
<lastBuildDate>Mon, 13 Feb 2006 09:52:05 EST</lastBuildDate>
<copyright>Copyright 1996-2005 Jupitermedia Corporation</copyright>
<managingEditor>[email protected]</managingEditor>
<webMaster>[email protected]</webMaster>
<docs>http://backend.userland.com/rss</docs>
<ttl>60</ttl>
<item>
<title>Matrix-Like Credits for MFC Applications</title>

<link>http://redir.internet.com/rss/click...trols/controls/coolcontrols/article.php/c7343</link>

<description>This simple class displays Matrix-like credits in MFC
applications.</description>
<pubDate>02/13/2006</pubDate>
</item>
<item>
<title>Internationalize and Localize Your C/C++ Code with ICU</title>


<link>http://redir.internet.com/rss/click.../misc/multi-lingualsupport/article.php/c11403</link>

<description>The International Component for Unicode (ICU) library
can save you from being hopelessly mired in numerous character
encodings as your C/C++ application matures into internationalization
and localization.</description>
<pubDate>02/10/2006</pubDate>
</item>
<item>
<title>MFC Extension Classes CListCtrlEx and CListViewEx</title>

<link>http://redir.internet.com/rss/click.../controls/listview/advanced/article.php/c4179</link>

<description>Augmented versions of CListCtrl and CListView with sort
direction indicators, coloring of the sort column, column hiding, and
more.</description>
<pubDate>02/08/2006</pubDate>
</item>
<item>
<title>Mould Text in Any Shape</title>

<link>http://redir.internet.com/rss/click/www.codeguru.com/cpp/misc/misc/graphics/article.php/c10673</link>

<description>Sometimes, putting text in a rectangular block may just
be a little too straight. With the C++ class QEnvelopeText, you can
mould a piece of body type in any shape.</description>
<pubDate>02/07/2006</pubDate>
</item>
<item>
<title>Capturing Windows Regardless of Their Z-Order</title>

<link>http://redir.internet.com/rss/click/www.codeguru.com/cpp/g-m/gdi/capturingimages/article.php/c11231</link>

<description>Capture a top window content to a BMP file, regardless
of the z-order of the window.</description>
<pubDate>02/07/2006</pubDate>
</item>
<item>
<title>Secure C++: Checked Iterators for Safer STL Coding</title>

<link>http://redir.internet.com/rss/click/www.codeguru.com/cpp/com-tech/atl/misc/article.php/c11361</link>

<description>The security issues with Standard C++ aren't as severe
as those of C and the CRT, but a few exploits are possible if you
misuse STL and iterators.</description>
<pubDate>02/03/2006</pubDate>
</item>
<item>
<title>BizTalk 2004 Adapter Alternatives for Handling Web
Services</title>

<link>http://redir.internet.com/rss/click...sc/misc/applicationcontrol/article.php/c11333</link>

<description>Combine BizTalk 2004 with the .NET Framework to overcome
some of BizTalk's limitations in handling Web services.</description>
<pubDate>02/01/2006</pubDate>
</item>
<item>
<title>WinFS Basics: Working with a Data Store</title>

<link>http://redir.internet.com/rss/click..._database/storedprocedures/article.php/c11313</link>

<description>Introducing the next step in information storage on the
Windows platform: WinFS, an active storage platform. Learn the basic
operations that you can perform on a WinFS data store.</description>
<pubDate>01/30/2006</pubDate>
</item>
<item>
<title>Tree Container Library</title>

<link>http://redir.internet.com/rss/click...sc/misc/templatizedclasses/article.php/c11203</link>

<description>The TCL consists of three templatized container classes,
similar to those found in the STL.</description>
<pubDate>01/30/2006</pubDate>
</item>
<item>
<title>TIP: Half Size Triangular Matrix</title>

<link>http://redir.internet.com/rss/click/www.codeguru.com/cpp/cpp/algorithms/general/article.php/c11211</link>

<description>Learn about a technique that allows you to use half the
data storage when you have a symmetric distance matrix or other similar
triangular matrix.</description>
<pubDate>01/18/2006</pubDate>
</item>
</channel>
</rss>

my application processes these xml(rss) files and keeps updating the
user about any change in the news if any thing is changed i have to
reflect it in my application

i parse the xml file and store it in a datastructure which is a
CStringArray (in vc++) while parsing i am comparing the tag of the xml
file to push it in the proper array.

is there any other way to process these xml file such that i dont need
to compare the nodes to push into properdatastructure.

so that that can improve my performance i am using MSXML2 for my
purpose and using SelectNodes i am iterating the list of item tags and
comparing its child tags i am populating it

anyone can help me in providing better implementation

-praveen
 
A

Andy Dingley

sp said:
i have an xml file (an rss file)

Please don't post huge chunks of boilerplate code. Paste a link to it
instead. Many of the problems discussed here can only be seen "in the
wild".

my application processes these xml(rss) files and keeps updating the
user about any change in the news if any thing is changed i have to
reflect it in my application

Files ? Or web documents ? Are you creating these documents or
reading them?

i parse the xml file and store it in a datastructure which is a
CStringArray (in vc++) while parsing i am comparing the tag of the xml
file to push it in the proper array.

The "tag" is always the same - <link> or somesuch. What are you really
comparing here? The content of the <item> ? Or just the URL in the
is there any other way to process these xml file such that i dont need
to compare the nodes to push into properdatastructure.

It's hard to know from your sparse description, but I imagine that
comparing the item URLs (in the <link> element) is both necessary and
sufficient. In a well-run RSS feed these will be stable, simple and
unique to items.

In a poorly run feed then they might have parameters (order is probably
insignificant, but it can confuse the comparator if this changes), they
might have trivial optional parameters and worst of all they might be
of the form "?id=1"... where they change between successive versions of
the feed whilst still referring to the same items. In these cases you
might need to hash the content of the item and compare that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top