Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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),$/;
    Output:
    $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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://933316]
help
Chatterbox?
[marto]: good morning all
[Corion]: Hi marto!
[Corion]: The fun show at $work continues, as The Big Project is now in its second week of frantic live-bugfixing and weekend releases where nobody knows what went live. Nothing has been tested anyway.
erix mutters cantankerously under his breath
Corion watches from the sidelines. Or rather, from behind, as my system only gets output from that process and my programs adhere strictly to the GIGO design principle.
[erix]: ah, that's nice to hear Corion :)
[Corion]: erix: Yeah, the sad thing is that all I can do is document things, so I can point fingers when the auditors come :-/
[Corion]: "I'm here to open tickets and point fingers. And I'm all out of tickets."
[erix]: didn't Sybase have pretty good auditing? :) (this is a vague memory)
[erix]: (culprits often are upstream of db of course)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-03-28 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (328 votes). Check out past polls.