Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: errors in printing latex template output

by veerubiji (Sexton)
on Oct 24, 2011 at 08:47 UTC ( #933316=note: print w/replies, xml ) Need Help??

in reply to Re: errors in printing latex template output
in thread errors in printing latex template output

Hi, you modified my XML data and after modifying its working in first model. But I has to keep my XML data as original.

<address> <house_number>12</house_number> <street_name>yyyy</street_name> <kadapa/> </address>
trying like this its working it printing the data. but
<address> <house_number="128"/> <street_name="xxxx"/> <kadapa/> </address>
trying like this its not printing house number and street name. and also I can't understand your code for reading XML data from file. I need to create "t.xml" file separately or I can give my file name directly. because your t.xml file starts with like this
t.xml=............... .......... --end t.xml
my file is not start with like t.xml or not end with --end t.xml like that. I am beginner to perl can you tell me.

Replies are listed 'Best First'.
Re^3: errors in printing latex template output
by keszler (Priest) on Oct 24, 2011 at 11:00 UTC

    The lines t.xml = and -- end t.xml are not in the file t.xml; they were meant to show on screen where the file started and ended.

    I modified your XML data because XML::Fast does not recognize it as XML with a tag and value, or tag, attribute, and value.

    #!/usr/bin/env perl use strict; use warnings; use XML::Fast; use Data::Dumper; my $xml = '<house_number>12</house_number>'; my $xml_hash = xml2hash $xml; print Dumper($xml_hash),$/; $xml = '<house number="12"/>'; $xml_hash = xml2hash $xml; print Dumper($xml_hash),$/; $xml = '<house_number="128"/>'; $xml_hash = xml2hash $xml; print Dumper($xml_hash),$/;
    $VAR1 = { 'house_number' => '12' }; $VAR1 = { 'house' => { '-number' => '12' } }; $VAR1 = { 'house_number="128"' => '' };

    If you must use the XMLdata as given, i.e. <house_number="128"/> you'll probably end up having to write your own parser.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://933316]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-01-21 07:46 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.