XML::XSLT does not accept an absolute path
XML::XSLT does not accept an absolute path
am 15.11.2007 23:02:18 von Nick Monyatovsky
I've run into a bug in XML::XSLT. If you give it an .xsl file by an
absolute name, it fails with the message:
Error while parsing: no element found at line 1, column 0, byte -1 at
C:/Perl/site/lib/XML/Parser.pm line 185
If you use relative path, no problems.
The line that's casuing the error is this:
my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
There are no spaces anything else "weird" in the absolute path.
But this is on Windows, so it begins with "D:\users".
This looks like a minor omission somewhere in the module.
How can this be corrected?
Thanks,
-- Nick Monyatovsky
Re: XML::XSLT does not accept an absolute path
am 15.11.2007 23:50:43 von Nick Monyatovsky
On Thu, 15 Nov 2007 17:02:18 -0500, Nick Monyatovsky
wrote:
>I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>absolute name, it fails with the message:
>
>Error while parsing: no element found at line 1, column 0, byte -1 at
>C:/Perl/site/lib/XML/Parser.pm line 185
>
>If you use relative path, no problems.
>
>The line that's casuing the error is this:
>
>my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>
>There are no spaces anything else "weird" in the absolute path.
>But this is on Windows, so it begins with "D:\users".
>
>This looks like a minor omission somewhere in the module.
>How can this be corrected?
>
>Thanks,
>-- Nick Monyatovsky
This is what happens under the hood:
creating parser object:
opening xsl...
SOURCE = D:\users\nmw\work\udev_appver\t\portfolio.xsl
opening document
Opening URL
FILENAME 0 = D:\users\nmw\work\udev_appver\t\portfolio.xsl
FILENAME URI:
D:%5Cusers%5Cnmw%5Cwork%5Cudev_appver%5Ct%5Cportfolio.xsl
NEW FILENAME:
*** Error: Could not create an instance of the XSL Processor using
D:\users\nmw\work\udev_appver\t\p
ortfolio.xsl: Error while parsing:
no element found at line 1, column 0, byte -1 at
C:/Perl/site/lib/XML/Parser.pm line 185
So,
either XSL::XSLT is wrong by calling
URI->new_abs( $filename, $base );
or URI is wrong by returning a string that no FileHandle will be able
to open
D:%5Cusers%5Cnmw%5Cwork%5Cudev_appver%5Ct%5Cportfolio.xsl
What do you think?
-- Nick Monyatovsky
Re: XML::XSLT does not accept an absolute path
am 16.11.2007 02:45:47 von paduille.4061.mumia.w+nospam
On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
> absolute name, it fails with the message:
>
> Error while parsing: no element found at line 1, column 0, byte -1 at
> C:/Perl/site/lib/XML/Parser.pm line 185
>
> If you use relative path, no problems.
>
> The line that's casuing the error is this:
>
> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>
> There are no spaces anything else "weird" in the absolute path.
> But this is on Windows, so it begins with "D:\users".
>
> This looks like a minor omission somewhere in the module.
> How can this be corrected?
>
> Thanks,
> -- Nick Monyatovsky
Can't you use forward slashes?
D:/users/thefile.xml
Re: XML::XSLT does not accept an absolute path
am 16.11.2007 16:13:08 von Nick Monyatovsky
On Thu, 15 Nov 2007 19:45:47 -0600, "Mumia W."
wrote:
>On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
>> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>> absolute name, it fails with the message:
>>
>> Error while parsing: no element found at line 1, column 0, byte -1 at
>> C:/Perl/site/lib/XML/Parser.pm line 185
>>
>> If you use relative path, no problems.
>>
>> The line that's casuing the error is this:
>>
>> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>>
>> There are no spaces anything else "weird" in the absolute path.
>> But this is on Windows, so it begins with "D:\users".
>>
>> This looks like a minor omission somewhere in the module.
>> How can this be corrected?
>>
>> Thanks,
>> -- Nick Monyatovsky
>
>Can't you use forward slashes?
>
>D:/users/thefile.xml
>
No, no luck there either. Same error.
Re: XML::XSLT does not accept an absolute path
am 16.11.2007 18:02:39 von Christian Winter
Nick Monyatovsky wrote:
> On Thu, 15 Nov 2007 19:45:47 -0600, "Mumia W."
> wrote:
>
>> On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
>>> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>>> absolute name, it fails with the message:
>>>
>>> Error while parsing: no element found at line 1, column 0, byte -1 at
>>> C:/Perl/site/lib/XML/Parser.pm line 185
>>>
>>> If you use relative path, no problems.
>>>
>>> The line that's casuing the error is this:
>>>
>>> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>>>
>>> There are no spaces anything else "weird" in the absolute path.
>>> But this is on Windows, so it begins with "D:\users".
>>>
>>> This looks like a minor omission somewhere in the module.
>>> How can this be corrected?
>>>
>>
>> Can't you use forward slashes?
>>
>> D:/users/thefile.xml
>>
>
> No, no luck there either. Same error.
Try passing the absolute path as a file URI:
file:///D:/users/thefile.xml
Neither XML::XSLT nor URI make a distinction between
local paths and URLs as their arguments, so to satisfy
LWP::Simple's get() method, one needs to prefix with
the correct scheme.
-Chris
Re: XML::XSLT does not accept an absolute path
am 16.11.2007 22:38:36 von --Nya--
On Fri, 16 Nov 2007 18:02:39 +0100, Christian Winter
wrote:
>Nick Monyatovsky wrote:
>> On Thu, 15 Nov 2007 19:45:47 -0600, "Mumia W."
>> wrote:
>>
>>> On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
>>>> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>>>> absolute name, it fails with the message:
>>>>
>>>> Error while parsing: no element found at line 1, column 0, byte -1 at
>>>> C:/Perl/site/lib/XML/Parser.pm line 185
>>>>
>>>> If you use relative path, no problems.
>>>>
>>>> The line that's casuing the error is this:
>>>>
>>>> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>>>>
>>>> There are no spaces anything else "weird" in the absolute path.
>>>> But this is on Windows, so it begins with "D:\users".
>>>>
>>>> This looks like a minor omission somewhere in the module.
>>>> How can this be corrected?
>>>>
> >>
>>> Can't you use forward slashes?
>>>
>>> D:/users/thefile.xml
>>>
>>
>> No, no luck there either. Same error.
>
>Try passing the absolute path as a file URI:
>file:///D:/users/thefile.xml
>
>Neither XML::XSLT nor URI make a distinction between
>local paths and URLs as their arguments, so to satisfy
>LWP::Simple's get() method, one needs to prefix with
>the correct scheme.
>
>-Chris
Ah! That's the trick!..
"file:///D:\users\thefile.xsl" fixed it.
Many thanks, Chris.