PDA

View Full Version : Xpath - error in processing external entity reference


ITSAMB
03-23-2009, 09:14 AM
Hi,
I am trying to use XML::Xpath for XML processing. When I try to use it in code, it is throwing an error
501 Protocol scheme 'y' is not supported y:/.../dcr4.5.dtd.
Handler couldn't resolve external entity at line 2, column 36, byte 75
error in processing external entity reference at line 2, column 36, byte 75
The parser is explicitly searching for the dtd where the XML is located and throwing the error.
I do not have any idea about this protocol scheme error. I also tried giving absolute location of the dtd file, but still same result.
If anyone can throw some light on it, will be appreciated.

Snippet of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE record SYSTEM "dcr4.5.dtd">
<record name="TrusteeForm" type="content">
<item name="id_content">
.
.
Perl Version: 5.8.2

Thanks,
Amit

oesxyl
03-23-2009, 09:25 AM
Hi,
I am trying to use XML::Xpath for XML processing. When I try to use it in code, it is throwing an error
501 Protocol scheme 'y' is not supported y:/.../dcr4.5.dtd.
Handler couldn't resolve external entity at line 2, column 36, byte 75
error in processing external entity reference at line 2, column 36, byte 75
The parser is explicitly searching for the dtd where the XML is located and throwing the error.
I do not have any idea about this protocol scheme error. I also tried giving absolute location of the dtd file, but still same result.
If anyone can throw some light on it, will be appreciated.

Snippet of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE record SYSTEM "dcr4.5.dtd">
<record name="TrusteeForm" type="content">
<item name="id_content">
.
.
Perl Version: 5.8.2

Thanks,
Amit
you use somewhere something like this "y:tagname", this is called a qname and "y" must be declared as namespace before you start processing.
I don't know if this is your case until I see some code, it's more a guess.
Post the code please.

best regards

ITSAMB
03-23-2009, 10:01 AM
Hi oesxyl ,
Thanks for your suggestion. could you please elaborate more on this.
I have a virtual drive 'Y:' crated by our CMS product on the server. The XML files are on that Y: drive. And the error given for the DTD,which the parser looks at the same location where the XML file is saved, i.e. on the Y: drive.
I did not get this error, when we use XML::DOM parser.
Following is the code that I tried.

use strict;
use XML::XPath;
open LOG, ">>TestXpath.log";
print LOG "---------------------------\n";
my $xp = XML::XPath->new( filename => "Y:/mhrs/main/MHRSGEO/CANADA/WORKAREA/wa/templatedata/English/Article_Text/data/BHP/contact_us" );
my $value = $xp->findvalue('/record/item[@name="ind_content_type"]');
print LOG "value is $value \n";
exit(0);

oesxyl
03-23-2009, 10:11 AM
Hi oesxyl ,
Thanks for your suggestion. could you please elaborate more on this.
I have a virtual drive 'Y:' crated by our CMS product on the server. The XML files are on that Y: drive. And the error given for the DTD,which the parser looks at the same location where the XML file is saved, i.e. on the Y: drive.
I did not get this error, when we use XML::DOM parser.
Following is the code that I tried.

use strict;
use XML::XPath;
open LOG, ">>TestXpath.log";
print LOG "---------------------------\n";
my $xp = XML::XPath->new( filename => "Y:/mhrs/main/MHRSGEO/CANADA/WORKAREA/wa/templatedata/English/Article_Text/data/BHP/contact_us" );
my $value = $xp->findvalue('/record/item[@name="ind_content_type"]');
print LOG "value is $value \n";
exit(0);
ok, I was wrong, this 501 is a http error:

http://www.checkupdown.com/status/E501.html

I guess after your path that you use windows. I can't help you since I don't use it and I don't have experience with it.
I hope somebody else will help, I'm sorry.

good luck and best regards

KevinADC
03-23-2009, 06:14 PM
http://forums.devshed.com/perl-programming-6/xpath-error-in-processing-external-entity-reference-598801.html