RE: "Protocol scheme 'c' is not supported ..."
"Mabry, F. DR EECS" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <7537E9E84ADB7043907093855059B26522846808@USMASVGDOIM214.usma.ds.army.edu> |
Allen >Date: Thu, 1 Oct 2009 11:35:22 -0400 >From: "Allen, Christopher" <[email protected]> >Subject: "Protocol scheme 'c' is not supported ..." >To: <[email protected]> >Message-ID: ><D9DF23CF9A82EA4E84EFD144BEEFC4481DA1AA@maybach.corp.workscape.net> >I have a doc that refers to a DTD like this: > <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> >and the doc's "outer element" is: > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" >debug="false"> > >I'm trying to read the doc with: > $cxml = XML::XPath->new(filename => $cfile); > >and I get this error: > >501 Protocol scheme 'c' is not supported c:/dir/subdir/log4j.dtd >Handler couldn't resolve external entity at line 2, column 48, byte 87 >error in processing external entity reference at line 2, column 48, byte >87: ><?xml version="1.0" encoding="UTF-8"?> ><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> >===============================================^ > ... I believe that you should NOT have the "log4j:" preceding the name ("configuration" in this case). >From the w3c xml document <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> Note: the "greeting" on line 2 matches the element name on line 3. The DTD definition predates the namespace recommendation. The "log4j:" is a reference to the identified namespace within the XML content. I think this is the source of the problem. Note: with some of the Perl XML packages you have to be careful to indicate to the package that you are processing content that is registered against some namespace. Just because there is a namespace identified in the input XML that happens to match the one you may want to reference in your XPATH expressions that does not mean that the intermediate package will know to match the prefix (log4j) in a string constant with the namespace identification ("http://jakarta.apache.org/log4j/") included in the input file. You could be using "LOG4J" as a prefix in your Perl XPATH expressions (or even "perlLOG4J"). If you indicate that you want to use a particular namespace prefix and indicate the mapping of prefix to namespace identification then your program will meet your expectations. Hope this helps. Frank Dr. Frank J. Mabry, Jr., CISSP Associate Professor IT AIAD Coordinator Dept. of EE&CS U.S. Military Academy West Point, New York, 10996 _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs