Re: [xml] Confused: Handling relative paths in catalogs



Daniel Veillard <veillard redhat com>:
The problem is that matching in the catalog apparently looks up
/path/to/document/domino.dtd instead of just domino.dtd.  Since only
prefix substitution is allowed, there doesn't seem to be a way to
match <anything>/domino.dtd.

The result is that this works fine:
  [/tmp/xml]0$ xmllint --valid --noout note.xml 

But this doesn't:
  [/tmp/xml]0$ xmllint --valid --noout /tmp/xml/note.xml 
  /tmp/xml/note.xml:3: error: failed to load external entity
  "/tmp/xml/domino.dtd"
  <!DOCTYPE document SYSTEM 'domino.dtd'>
                                        ^

 Can you provide the debugging output of the catalog resolution as explained 
at
   http://xmlsoft.org/catalog.html#validate

Here it is for both cases.

[/tmp/xml]0$ xmllint --noout --valid note.xml 
Resolve: sysID domino.dtd
0 Parsing catalog /local/libxml/etc/catalog
/local/libxml/etc/catalog added to file hash
Found system match domino.dtd
Catalogs cleanup
Free catalog entry domino.dtd
Free catalog entry /local/libxml/etc/catalog
Free catalog entry

[/tmp/xml]0$ xmllint --noout --valid /tmp/xml/note.xml 
Resolve: sysID /tmp/xml/domino.dtd
0 Parsing catalog /local/libxml/etc/catalog
/local/libxml/etc/catalog added to file hash
Resolve URI /tmp/xml/domino.dtd
/tmp/xml/note.xml:3: error: failed to load external entity
"/tmp/xml/domino.dtd"
<!DOCTYPE document SYSTEM 'domino.dtd'>
                                      ^
/tmp/xml/note.xml:5: validity error: Validation failed: no DTD found !
<document xmlns='http://www.lotus.com/dxl' version='1.01' form='Memo'>
                                                                     ^
Catalogs cleanup
Free catalog entry domino.dtd
Free catalog entry /local/libxml/etc/catalog
Free catalog entry

Am I missing something? Is there a different way to handle the case
where the DTD is specified as a relative path?

 I don't have a clear answer, I just pointed Norman Walsh to this
he probably have the answer.

Daniel

I the meantime, I guess changing to the directory where the file
resides is the workaround.  

Thanks for your help.

Steve



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]