Hi monks,

Im parsing a xml file which has a link to another file which inturn has a link to another file and so on.. This is achieved by using the xi:include tag.

for example...

<xi:include href="$HOME_ROOT/module/module.xml"/>

When i try to invoke the xinclude parser, it is not able to access the file even though i initialize the variable with a pre-determined path.

How to overcome this issue? I couldnt find any modules that support this scenario..

Thanks,
joe

Update

This is the sample code

use XML::DOM; use strict; use File::Find; use XML::SAX; use XML::SAX::Writer; use XML::Filter::XInclude; use File::Copy; use IO::File; my $output = new IO::File "> output.xml"; my $parser = XML::SAX::ParserFactory->parser( Handler => XML::Filter::XInclude->new( Handler => XML::SAX::Writer->new(Output=>$output) ) ); $parser->parse_uri("./project.xml");

file project.xml

<xi:include href="$HOME_ROOT/module/module1.xml"/>

file module1.xml

<xi:include href="$HOME_ROOT/module/module2.xml"/>

so the output file should ideally contain the contents of module1.xml and module2.xml.
I cant modify the ENV variable to $ENV{variable} because for that i'll ve to access the file 1st.


In reply to Using environment variables in xi:include by joeperl

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.