Re: XML::LibXML search path for DTDs

Roger Pepitone <[email protected]> Wed, 3 Oct 2012 12:33:09 -0700 (PDT)
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
I'm having trouble putting everything together with catalogs.

Is there a simple example along the lines of:
- Copy-past this into xml/file.xml
- Copy-past this into dtds/doc.dtd
- Copy-past this into catalogs/catalog.xml
- Run this command
available anywhere?

Rather:  I don't know what to put in the system identifier part of the DOCTYPE tag.  I can't put in an absolute path, because that will vary between computers.  I thought that the point of the catalog was to fill that in.


________________________________
 From: Liam R E Quin <[email protected]>
To: Roger Pepitone <[email protected]> 
Cc: Nick Wellnhofer <[email protected]>; "[email protected]" <[email protected]> 
Sent: Saturday, September 29, 2012 1:08 PM
Subject: Re: XML::LibXML search path for DTDs
 
On Sat, 2012-09-29 at 07:03 -0700, Roger Pepitone wrote:

> 
> Catalogs seem to be what I want, but I they don't seem to have any effect.

> $parser->load_catalog( $catalog_file );
> Loads the XML catalog file $catalog_file.
> 
> That really glosses over things.
> Is there a return value?  If so, what does it mean?


> What sort of values can $catalog_file take?  (Are string containing
> filename, string containing xml, and file handle all acceptable?)

The string should cantain a URI or filename pointing to an OasisOpen XML
Catalog file; look in /etc/xml for examples on most Linux systems.

An XML catalog is an XML file (not a DTD), e.g. "mycatalog.xml".

The load_catalog method doesn't appear to return anything useful, and
it's possible that errors are silently ignored. But you can use xmllint
on the commandline, with
SGML_CATALOG_FILES="mycatalog.xml"
export SGML_CATALOG_FILES
xmllint --catalogs --noout --valid --loaddtd myfile.xml

You could use strace or ltrace to check that the catalog file was
opened, or --load-trace might show them.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
Co-author, 5th edition of "Beginning XML", Wrox, July 2012

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs