Google Answers Logo
View Question
 
Q: parsing xml file with xerces (a c++ XML parser) ( No Answer,   3 Comments )
Question  
Subject: parsing xml file with xerces (a c++ XML parser)
Category: Computers > Programming
Asked by: dreamlax-ga
List Price: $10.00
Posted: 25 Jun 2005 10:17 PDT
Expires: 25 Jul 2005 10:17 PDT
Question ID: 536950
What is the best way to parse an xml file in linux using C++. I should
be able to extract the records that satisfy certain criterian.
Answer  
There is no answer at this time.

Comments  
Subject: Re: parsing xml file with xerces (a c++ XML parser)
From: mathtalk-ga on 25 Jun 2005 23:34 PDT
 
It might be helpful to see a brief example to illustrate what is meant
by "extract the records that satisfy certain [criteria]."  Your
programming model may be quite different from what I'm thinking about.

I come at this from a "Windows" perspective, using the MSXML parser,
and applying XSLT transforms to one XML document to obtain another one
with the required extracts, etc. might be needed.

From what I see, I don't think this programming model would translate
directly to Xerces.  Although Xerces-C++ evidently supports the DOM
specification(s) to a fair extent, I don't see anything about support
for XPath, which is critical to applying XSLT.

On the other hand I'm seeing those sorts of things claimed for Xalan. 
See here for a brief write-up and links to more extensive
documentation (and code):

[Xalan-C++ version 1.9]
http://xml.apache.org/xalan-c/


regards, mathtalk-ga
Subject: Re: parsing xml file with xerces (a c++ XML parser)
From: dreamlax-ga on 26 Jun 2005 11:24 PDT
 
The xml file looks somewhat like this.  

<?xml version="1.0" encoding="UTF-8" ?> 
- <pems coordinate_system="Geographic NAD 83" date="09/07/2004 16:05:22">
<vds_types>
   <vds_type id="CD" description="Collector/Distributor" /> 
   ........
   </vds_types>
<district id="1" name="Northwest">
  <counties>
  <county id = "15" name="Something">
     <cities>
     <city id= "17033" name="Cresent City">
      ...
     </cities>
     <detector_stations>
     <vds id="312134" name="Elk Grove Blvd" type="ML" county_id="67"
city_i   d="" freeway_id="5" freeway_dir="N" lanes="2" cal_pm="11.09"
abs_pm="506.383" latitude="38.412414" longitude="-121.48428"
last_modified="04/03/2003" />

     <vds id="401455" name="" type="ML" county_id="13" city_id="16000"
freeway_id="4" freeway_dir="E" lanes="2" cal_pm="14.9" abs_pm="14.739"
latitude="38.007486" longitude="-122.032525"
last_modified="08/01/2001" />

     .....
     ....
    </detector_stations>
 </distric>
</pems>

I would like a parser that recongnizes each attribue of
detector_stations, record by record. Imagine that i want to store
vds_id in one file, its name in another file, type in another file and
so on.

I am not aware of jargons in this domain so if possible prefer to avoid them. 

thanks
dreamlax
Subject: Re: parsing xml file with xerces (a c++ XML parser)
From: mathtalk-ga on 26 Jun 2005 12:54 PDT
 
Hi, dreamlax-ga:

Thanks for the courtesy of the prompt reply.  I take your caution to
avoid jargon as an indication that I've already trespassed the bounds
to some extent.

To me, the list price you offered for the Question was an indication
that you had a clear idea how to perform the task you want to do on a
non-Linux platform and were seeking advice on how to translate such an
approach to a Linux plaform.

My impression now is that you would like a Researcher to explain in
detail, without "jargon", how to extract the attribute information of
XML elements of a particular type from an existing XML document into
one or more new XML documents.  This is largely based on the example
you've given above.

Is it possible that, for the list price you've offered, you would be
satisfied with some links to Linux-oriented XML tutorials?


regards, mathtalk-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy