Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

well Its in my code

Well, it isn't. Your code builds no data structures, it just print stuff. So which is it, data structures, or print stuff, or what?

You say it doesn't print it all, so what would it print, how would the missing look?

Nevermind ,

#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML 1.70; ## for load_html/load_xml/location use Data::Dump qw/ dd pp /; Main( @ARGV ); exit( 0 ); sub Main { my $loc = shift or die " Usage: $0 ko00010.xml $0\n\n"; my $dom = XML::LibXML->new( qw/ recover 2 / )->load_xml( location => $loc, ); orWhat( $dom -> documentElement ); } sub orWhat { my( $parent, $depth ) = @_; $depth ||= 0; my $dent = ' ' . ' ' x $depth; for my $child ( $parent->getAttributes ){ printf "%s%s[%s]\n", $dent, $child ->getName, $child->getValue +; } for my $kid ( $parent->nonBlankChildNodes ){ printf "%s%s[%s]\n", $dent, $kid->getName, pp( $kid->getValue +); orWhat( $kid, $depth + 1 ); ## recurse } return; } __END__ name[path:ko00010] org[ko] number[00010] title[Glycolysis / Gluconeogenesis] image[http...] link[http...] entry[undef] id[13] name[ko:K01623 ko:K01624 ko:K01622 ko:K16306] link[http...] graphics[undef] name[K01623...] fgcolor[#000000] bgcolor[#BFBFFF] type[rectangle] x[483] y[404] width[46] height[17]

In reply to Re^5: Parsing xml using libXML by Anonymous Monk
in thread Parsing xml using libXML by shaq

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (3)
    As of 2018-05-27 04:01 GMT
    Find Nodes?
      Voting Booth?