joeperl has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using environment variables in xi:include
by zwon (Abbot) on Jan 14, 2010 at 20:16 UTC | |
by joeperl (Acolyte) on Jan 15, 2010 at 03:48 UTC | |
by dHarry (Abbot) on Jan 15, 2010 at 12:09 UTC | |
|
Re: Using environment variables in xi:include
by ikegami (Patriarch) on Feb 19, 2010 at 07:33 UTC | |
by joeperl (Acolyte) on Feb 19, 2010 at 14:18 UTC |