hi,

i tried extracting the "editor" for the specified xml file using the XPath tutorials as suggested.Im supposed to do it with XPATH only . cannot use TWIG. the xml file is

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE TEI.2 SYSTEM "tei-epidoc.dtd" > <TEI.2 lang="eng" id="eAla001"> <teiHeader status="new" type="text"> <fileDesc> <titleStmt> <title type="main" level="m">1. Letter of Valerian and Gallien +us</title> <editor role="editor">Joyce M. Reynolds</editor> </titleStmt> <publicationStmt> <date>2004</date> </publicationStmt> <sourceDesc default="NO"> <p><!-- to be added --></p> </sourceDesc> </fileDesc> <profileDesc> <langUsage default="NO"> <language id="eng">English</language> <language id="fre">French</language> <language id="ger">German</language> <language id="grc">Ancient Greek</language> <language id="gre">Modern Greek</language> <language id="ita">Italian</language> <language id="lat">Latin</language> <language id="spa">Spanish</language> <language id="tur">Turkish</language> </langUsage> </profileDesc> </body> </text> </TEI.2>

the perl xpath script i used is

#!/usr/bin/perl use warnings; use strict; use XML::XPath; use XML::XPath::XMLParser; my $xp = XML::XPath->new(filename => 'E:\xmlfiles\eAla001.xml'); my $nodeset = $xp->find('//@editor role'); # find all editors foreach my $node ($nodeset->get_nodelist) { print XML::XPath::XMLParser::as_string($node), "\n\n"; }

Im getting this error

:
501 Protocol scheme 'e' is not supported e:/tei-epidoc.dtd Handler couldn't resolve external entity at line 2, column 40, byte 80 error in processing external entity reference at line 2, column 40, by +te 80: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE TEI.2 SYSTEM "tei-epidoc.dtd" > =======================================^ <TEI.2 lang="eng" id="eAla224"> <teiHeader status="new" type="text"> at C:/Perl/lib/XML/Parser.pm line 187

please help me out :(


In reply to Re: perl xpath extraction by lionofmasses
in thread perl xpath extraction by lionofmasses

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.