in reply to Re: Parsing Data from XML Schemas
in thread Parsing Data from XML Schemas

As far as I understand it, the script returns an XML Schema (I might be off on the terminology here). It starts off with the following:

- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="u +uid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-micro +soft-com:rowset" xmlns:z="#RowsetSchema"> - <s:Schema id="RowsetSchema">
Would I be correct in calling this a schema?

Replies are listed 'Best First'.
Re^3: Parsing Data from XML Schemas
by meetraz (Hermit) on Jun 16, 2004 at 16:52 UTC
    In this case, it's an XML file with the database schema and rowset data embedded within it. If you look at the XML file, it should have <s:Schema> and <rs:data> sections.

    Try something like this.. I've tested it and it works. Note that XML::Simple reads the entire XML file into memory and therefore is not ideal for large datasets.

    use strict; use XML::Simple; my $xs = XML::Simple->new(); my $sqlref = $xs->XMLin('sqldata.xml'); my $rowsref = $sqlref->{'rs:data'}{'z:row'}; foreach my $row (@$rowsref) { print "---------New Row--------\n"; print $row->{'column1'}, "\n"; print $row->{'column2'}, "\n"; print $row->{'column3'}, "\n"; }

      Thanks for the code example, meetraz! However, I receive "Not an ARRAY reference" on the following line:

      foreach my $row (@$rowsref) {

      I'm not sure why I'd be receiving this error, as everything seems to assigned correctly.

        Is there any way you can post a sample of the file you're trying to parse?