problems using XML::XPath to parse an XML document that contains a DTD definition (docbook) 
Author Message
 problems using XML::XPath to parse an XML document that contains a DTD definition (docbook)

Hello All,

I am trying to learn how to use the XML modules and am running into a
problem parsing a document. I have written the
following script and am receiving the error:

 F:\scripts>xml_test.pl
Uncaught exception from user code:
        Uncaught exception from user code:

501 Protocol scheme 'f' is not supported
 f:/docbook/docbookx.dtd
Handler couldn't resolve external entity at line 2, column 90, byte 129
error in processing external entity reference at line 2, column 90, byte
129:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2CR1//EN"
"f:/docbook/doc
bookx.dtd">
============================================================================
====
=========^
<article>
 <articleinfo>
 at F:/Perl/site/lib/XML/Parser.pm line 185
--------------------end
error-----------------------------------------------------------------------
---------------------

from the error it seems that the parser does not like the doctype
decleration. Is there anyway around this?

Thanks

Ron Hill

--------------------start of
script----------------------------------------------------------------------
------------------
use XML::XPath;
use strict;
use diagnostics;
use warnings;
my $tmp_var = $/;
undef $/;
my $string = <DATA>;
$/=$tmp_var;

my $xp = XML::XPath->new(xml => $string);

foreach my $article ($xp->find('//article')->get_nodelist){
    print $article->find('title')->string_value;
    print $article->find('date');
    print "\n";

Quote:
}

__DATA__
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2CR1//EN"
"f:/docbook/docbookx.dtd">
<article>
 <articleinfo>
  <title>Sequences are not being modified by ADJUST</title>
  <author>
   <firstname>LARRY</firstname>
   <surname>CULL</surname>
  </author>
  <keywordset>
   <keyword>UG</keyword>
   <keyword>HPCISC</keyword>
   <keyword>HP-UX</keyword>
   <keyword>8.05</keyword>
   <keyword>V9.1</keyword>
  </keywordset>
  <date>06/21/93</date>
  <invpartnumber>001-0172482</invpartnumber>
  <pubsnumber>0172482</pubsnumber>
 </articleinfo>
 <formalpara>
  <title>HARDWARE/SOFTWARE CONFIGURATION</title>
  <para>

All users of the ADJUST module of ROBOTICS.

</para>
 </formalpara>
 <formalpara>
  <title>SYMPTOM/PROBLEM</title>
  <para>

User runs ADJUST module of ROBOTICS but the cell sequences are not being
transformed thru error matrix.  All TPOINT positions in cell sequences
remain unchanged.

</para>
 </formalpara>
 <formalpara>
  <title>SOLUTION/WORKAROUND</title>
  <para>

The sequence used for measuring the calibration points contained the
command 'Set Device Tool Tpoint'.  Sequences will not be adjusted if
this command exists in the calibration sequence.  This is documented in
in the Robotics/Adjust user guide under the general guidelines for
creating a calibration sequence.

</para>
 </formalpara>
 <formalpara>
  <title>REFERENCES/NOTES</title>
  <para>

For more information see section 4.2 'The Calibration Sequence' of the
Robotics/Adjust User Guide.

</para>
 </formalpara>
</article>



Sun, 19 Sep 2004 23:01:29 GMT  
 problems using XML::XPath to parse an XML document that contains a DTD definition (docbook)

Quote:

> Hello All,

> I am trying to learn how to use the XML modules and am running into a
> problem parsing a document. I have written the
> following script and am receiving the error:

>  F:\scripts>xml_test.pl
> Uncaught exception from user code:
>         Uncaught exception from user code:

> 501 Protocol scheme 'f' is not supported
>  f:/docbook/docbookx.dtd
> Handler couldn't resolve external entity at line 2, column 90, byte 129
> error in processing external entity reference at line 2, column 90, byte
> 129:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2CR1//EN"
> "f:/docbook/docbookx.dtd">
[snip]
> from the error it seems that the parser does not like the doctype
> decleration. Is there anyway around this?

The problem is the colon after "f". Try using the following DOCTYPE
declaration instead:

<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2CR1//EN"
"file:///f:/docbook/docbookx.dtd">

I use this syntax when I make my own (local) HTML files.

Regards, Ren
--
Using Virtual Access
http://www.vamail.com



Mon, 20 Sep 2004 05:53:15 GMT  
 problems using XML::XPath to parse an XML document that contains a DTD definition (docbook)



Quote:

[snipped]
> The problem is the colon after "f". Try using the following DOCTYPE
> declaration instead:

> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2CR1//EN"
> "file:///f:/docbook/docbookx.dtd">

> I use this syntax when I make my own (local) HTML files.

> Regards, Ren

Hi Rene;

That worked Thanks!!

Ron



Mon, 20 Sep 2004 21:13:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. migrating from XML::DOM to XML::XPath

2. Using RE to parse an XML document

3. Puzzling DTD parsing error with XML::Checker

4. XML::Checker::Parser - using external DTD

5. ANNOUNCE: Perl tut # 22 - Using XML::XPath - xpathSplitter[12].pl

6. XML::LibXML: Including xml fragments in a larger document

7. XML::XPath syntax problem

8. ActivePerl with XML::XPath problem: junk after end of expression: at E:/Perl/site/lib/XML/XPath/Parser.pm line 127.

9. parse xml without xml module ?

10. Parsing XML (Not XML::Parser)

11. parse xml without xml module ?

12. XML parsing for large documents

 

 
Powered by phpBB® Forum Software