Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different XML files reporting

Status
Not open for further replies.

pinknewyork

Technical User
Aug 18, 2007
1
Sorry for asking an obvious question, since I am new to XML, I have been given a little project and I need some friendly advice and a point in the correct direction.

I have a communications rack that sends individual AT command to individual modems. For each AT command result an XML file is produced. Different and independent XML files will then make up the tests result, the XML files can only be linked by one element in the XML file, <Test Name>.

I have been asked to work out how to report results from Multiple XML files for individual tests. Your help is appricated.
 
Are you saying that you want to merge the multiple xml reports into one final report?

If so, and if the report generated for each modem has a static naming convention, then I think that you would be best to make a master xml which refernced each of the other xml's as entities. you could then reference each report wherever you would like in your master xml file (xml dictionaries is an example of things that are often handled this way). Then entity refs are then available to an xsl doc if you want to transform and display a single formatted xml report(else the refs will show up in IE and the like) or a formatted html report.

so,
if your reports generated to a directory that looked like this
Code:
Report Directory..
-Report1.xml
-Report2.xml
-Report3.xml

you could then merge them like..
Code:
<?xml version="1.0"?>
<!--This is your xsl stylesheet-->
<?xml-stylesheet type="text/xsl" href="Transform.xsl"?> 
<!--Root node must be named according to doctype "report" in my example-->
<!DOCTYPE report [
  <!ENTITY report1 SYSTEM "Report1.xml">
  <!ENTITY report2 SYSTEM "Report2.xml">
  <!ENTITY report3 SYSTEM "Report3.xml">
  ]>
<!--Now you can refernce them however(I made up some names)-->
<report>
<group name="Seattle">&report1;</group>
<group name="New York">&report2;</group>
<group name="London">&report3;</group>
<!--You can also ref them together although the root nodes-->
<group name="Seattle and London">&report1;&report3;</group>
</report>

hope that helps

MCP, .Net Solutions Development <%_%>
 
The best/easiest way for you to achieve this depends on what technologies you are familiar with and what output format you want for the report.

Scripting languages such as PHP and ASP have good XML support, as does Java and .Net. With .Net it would be a fairly simple task to write an executable to report from multiple XML files.

The most elegant solution would be to use XSL, as this language is specifically designed to transform XML. This could be a steep learning curve for you though and would require you to become familiar with XPath. XSL version 2 can deal with multiple input documents.

Post back with your particular skill set and desired report output format.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top