On Fri, 15 Apr 2005, BJ wrote:

> I am trying to write a script to aggregate diverse xml documents into 
> tables. The trick is that i dont know the exact stucture of the xml 
> files in advance. [....] I basically want every bit of data from every 
> node in Data. Any ideas on how to do that? I am truely stuck. Thank 
> you for your time and help. ~BJ

In other words, this may be a job for XPath:

    [....] The primary purpose of XPath is to address parts of an XML 
    document. In support of this primary purpose, it also provides basic 
    facilities for manipulation of strings, numbers and booleans. XPath 
    uses a compact, non-XML syntax to facilitate use of XPath within 
    URIs and XML attribute values. XPath operates on the abstract, 
    logical structure of an XML document, rather than its surface 
    syntax. XPath gets its name from its use of a path notation as in 
    URLs for navigating through the hierarchical structure of an XML 
    document.

<http://www.w3.org/TR/xpath>

The main Perl module for this is XML::XPath:

    This module aims to comply exactly to the XPath specification at 
    http://www.w3.org/TR/xpath and yet allow extensions to be added in 
    the form of functions. Modules such as XSLT and XPointer may need to 
    do this as they support functionality beyond XPath.

<http://search.cpan.org/dist/XML-XPath/XPath.pm>

There is a family of related modules as well:

<http://search.cpan.org/dist/XML-XPath/>



Depending on what you want to do with the XML data, XSLT may also help:

    [A] language for transforming XML documents into other XML documents.

<http://www.w3.org/TR/xslt>

It, too, has a Perl module interface:

<http://search.cpan.org/dist/XML-XSLT/lib/XML/XSLT.pm>



I suspect that XPath and XSLT may be the tools you're looking for ...


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to