Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: PERL AND XML

by Anonymous Monk
on Jul 30, 2005 at 22:10 UTC ( #479650=note: print w/replies, xml ) Need Help??


in reply to Re: PERL AND XML
in thread PERL AND XML

Hi Everyone,
I want a spread sheet of data.
I did try some xml code of my own but I am not sure ..if this is working.For some reason all the data is coming into 1 cell....
I was the data to appear as
server1 Running 2005-07-24 22:58:06 server2 Running 2005-07-26 13:48:23 server3 Running 2005-07-24 22:51:20
in the spread sheet. I have an immediate deadline...any further help to debug the code will be appreciated.

BTW:Don I did try your suggestion with the XML::Element but I think we need some lib' for that which we dont hv in our prod environment. <

Replies are listed 'Best First'.
Re^3: PERL AND XML
by Anonymous Monk on Jul 30, 2005 at 23:09 UTC
    Here is the code I was trying to work on...but it gets created on 1 cell when I try to open it in a excel spread sheet
    # start an XML worksheet open (my $xmlfl,"+>>$path/$file") or die "$file failed: $!\n" +; print $xmlfl "<?xml version=\"1.0\"?>\n"; print $xmlfl "<Workbook xmlns=\"urn:schemas-microsoft-com:offi +ce:spreadsheet\"\n"; print $xmlfl " xmlns:o=\"urn:schemas-microsoft-com:office:offi +ce\"\n"; print $xmlfl " xmlns:x=\"urn:schemas-microsoft-com:office:exce +l\"\n"; print $xmlfl " xmlns:ss=\"urn:schemas-microsoft-com:office:spr +eadsheet\">\n"; print $xmlfl " <Worksheet ss:Name=\"Policy-Groups\">\n"; print $xmlfl " <Table>\n"; # print $xmlfl the header row # <group> <policy1> <policy2> ... <policyn> print $xmlfl " \n<Row>"; foreach $app(keys %appsrvr) { print $xmlfl " <Cell><Data ss:Type=\"String\">$app< +/Data></Cell>"; print $xmlfl " </Row>"; print $xmlfl " <Row>\n"; foreach $attribute(keys %{ $appsrvr{$app} }) { #print " $appsrvr{$app}{$attribute}"; print $xmlfl " <Row>\n"; print $xmlfl " <Cell><Data ss:Type=\"String\">$appsrvr{$app +}{$attribute}</Data></Cell>\n"; print $xmlfl " </Row>\n"; } # print $xmlfl " </Row>\n" } # print "\n"; # End the XML worksheet print $xmlfl " </Table>\n"; print $xmlfl " </Worksheet>\n"; print $xmlfl "</Workbook>\n"; # close this group file

    CodeTags™ by holli

      First things first, try wrapping code within your posts in a <code> tag, otherwise it all posts as one big sentence and no one can read it.

      Next: your missing a pi tag after the xml declaration.
      <?mso-application progid="Excel.Sheet"?>
      This is neccessary or excel will think it's just text, therefore loading it in one cell.

      What version of Excel? You have to have 2002 0r 2003 for it to read ExcelXML properly, it may work with 200, but I'd have to look that up. Try the 'pi' tag?

      Also grab a spreadsheet and save it a XML, use it as a base to create your spreadsheet.

      Don
      WHITEPAGES.COM | INC
      Everything I've learned in life can be summed up in a small perl script!
Re^3: PERL AND XML
by BaldPenguin (Friar) on Jul 31, 2005 at 04:03 UTC
    HTML::TreeBuilder is required for XML::Element

    Don
    WHITEPAGES.COM | INC
    Everything I've learned in life can be summed up in a small perl script!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://479650]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2023-01-30 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?