Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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 , https://metacpan.org/module/XML::LibXML::Node#nonBlankChildNodes

#!/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 http://example.com/ko00010.xml\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

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (4)
    As of 2014-07-13 04:01 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (245 votes), past polls