Hi, Ikegami:

My code is below - it's not drastically different from yours one. You're right - recursion is unavoidable. I hoped to avoid that with some XML::LibXML options - no way...

Thanks
Alex
my @list = (); my $parser = XML::LibXML->new(); sub Process($) { my $f = shift; if (-f $f and -r $f) { if (scalar(grep($_ eq $f, @list)) == 0) { push @list, $f; my $root = $parser->parse_file($f)->documentElement(); my $prefix = $root->lookupNamespacePrefix('http://www.w3.org/200 +1/XInclude'); if ($prefix) { my $ok = 1; foreach my $xincludeNode ($root->getElementsByTagName("$prefix:inc +lude")) { my $xincludeFilename = File::Spec->rel2abs($xincludeNode->getAtt +ribute('href')); $ok &&= Process($xincludeFilename); } return $ok; } else { return 1; } } else { return 1; } } else { print STDERR "The file '$f' isn't found or not readable\n"; return 0; } } Process(File::Spec->rel2abs($ARGV[0])); my $list = join("\n", @list); print $list, "\n";

In reply to Re^3: XML::LibXML question: How to list XInclude files, which are supposed to be included? by AlexFromNJ
in thread XML::LibXML question: How to list XInclude files, which are supposed to be included? by AlexFromNJ

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!
  • 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, details, 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, summary, 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.