docbook-apps

  • 1.  xml catalogs

    Posted 08-10-2009 15:36
    is it possible to use Oasis catalogs to rewrite a simple (wrong)
    DTD decl entry?

    Currently reads SYSTEM "A.dtd"

    Can a catalog resolve that to some other path? /files/dtds/erlref.dtd

    Not sure if
    http://www.oasis-open.org/committees/entity/spec-2001-08-06.html#element-rewriteURI
    will work.

    <rewriteURI
    uriStartString="erlref"
    rewritePrefix="/dtds/erlref"/>


    I want to resolve erlref.dtd to dts/erlref.dtd

    It isn't working

    rewriteURI: erlref
    /dtds/erlref
    REWRITE_URI: erlref
    file:/dtds/erlref
    resolveSystem(file:/files/erlang/erlref.dtd)


    for some reason it isn't putting the 'dtds' part in?

    Any suggestions please



    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 2.  Re: [docbook-apps] xml catalogs

    Posted 08-10-2009 17:15
    Hi Dave,

    Monday 10 August 2009

    > is it possible to use Oasis catalogs to rewrite a simple (wrong)
    > DTD decl entry?

    Yes, it is.


    > Currently reads SYSTEM "A.dtd"
    >
    > Can a catalog resolve that to some other path? /files/dtds/erlref.dtd

    Sure. :)


    > Not sure if
    > http://www.oasis-open.org/committees/entity/spec-2001-08-06.html#element-re
    >writeURI will work.
    >
    > <rewriteURI
    > uriStartString="erlref"
    > rewritePrefix="/dtds/erlref"/>

    I think, system should be more useful:

    <system systemId="A.dtd" uri="/files/dtd/erlref.dtd"/>


    > I want to resolve erlref.dtd to dts/erlref.dtd

    Same as the previous example:

    <system systemId="erlref.dtd" uri="dts/erlref.dtd"/>

    If you are unsure, use xmlcatalog from the libxml2 library as debugging tool:


    $ xmlcatalog /tmp/cat.xml A.dtd
    /files/dtds/erlref.dtd


    > [...]


    Tom



  • 3.  Re: [docbook-apps] xml catalogs

    Posted 08-10-2009 17:31
    On 10/08/09 18:14, Thomas Schraitle wrote:


    > I think, system should be more useful:

    >> I want to resolve erlref.dtd to dts/erlref.dtd
    >
    > Same as the previous example:
    >
    > <system systemId="erlref.dtd" uri="dts/erlref.dtd"/>
    >
    > If you are unsure, use xmlcatalog from the libxml2 library as debugging tool:
    >
    >
    > $ xmlcatalog /tmp/cat.xml A.dtd
    > /files/dtds/erlref.dtd


    Risky if I'm using the Java apache resolver?
    Not seen Daniels resolver before though!

    Yes, It is risky!

    [dpawson@marge2 erlang]$ xmlcatalog erlang.catalog.xml erlref.dtd
    /files/erlang/dtds/erlref.dtd


    Yet running the same catalog with resolver.jar

    Parse catalog: erlang.catalog.xml
    Loading catalog: erlang.catalog.xml
    Default BASE: file:////files/erlang/erlang.catalog.xml
    xml:base: /files/erlang
    BASE STR: /files/erlang
    override: no
    OVERRIDE: no
    system: erlref.dtd
    /files/erlang/dtds/erlref.dtd
    SYSTEM: erlref.dtd
    file:/files/erlang/dtds/erlref.dtd
    (reset) xml:base: file:////files/erlang/erlang.catalog.xml
    BASE STR: file:////files/erlang/erlang.catalog.xml
    resolveSystem(file:/files/erlang/erlref.dtd)
    Error on line 0 column 0 of erlang.xml:
    SXXP0003: Error reported by XML parser: File
    "file:/files/erlang/erlref.dtd" not found.
    Transformation failed: Run-time errors were reported


    Mmmm






    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 4.  Re: [docbook-apps] xml catalogs

    Posted 08-10-2009 18:04
    http://www.sagehill.net/docbookxsl/WriteCatalog.html#ResolveDtdLoc

    Ah! Bob says:

    Unfortunately, XML catalog entries that try to use relative system
    identifiers like systemId="docbook4.5.dtd" do not work with the Java
    resolver software currently available. The problem is that when a
    document with the example DOCTYPE is processed, the SAX interface in the
    XML parser resolves such references relative to the current document's
    location before the resolver gets to see it. So the resolver never has a
    chance to match on the original string. If you are going to use catalog
    files, you should probably stick with the recommended value of
    http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd for the SYSTEM
    identifier. Or you could use a phony full path, such as
    file:///docbookx.dtd, which will prevent the SAX interface from changing
    it before the catalog resolver sees it.


    IF that statement is still true,
    that explains why it isn't working.

    Would seem to be so.


    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 5.  Re: [docbook-apps] xml catalogs

    Posted 08-10-2009 19:02
    Hi Dave,

    XML Catalog 1.1 (implemented by the Apache resolver) added support for
    resolving based on a suffix and that should solve the problem as the
    file will end in the same way. Note also that you need a system mapping
    (not a uri mapping) to resolve a DTD reference, something like below:

    <systemSuffix systemIdSuffix="your.dtd" uri="path/to/local/copy.dtd"/>

    Best Regards,
    George
    --
    George Cristian Bina
    <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
    http://www.oxygenxml.com

    Dave Pawson wrote:
    > http://www.sagehill.net/docbookxsl/WriteCatalog.html#ResolveDtdLoc
    >
    > Ah! Bob says:
    >
    > Unfortunately, XML catalog entries that try to use relative system
    > identifiers like systemId="docbook4.5.dtd" do not work with the Java
    > resolver software currently available. The problem is that when a
    > document with the example DOCTYPE is processed, the SAX interface in the
    > XML parser resolves such references relative to the current document's
    > location before the resolver gets to see it. So the resolver never has a
    > chance to match on the original string. If you are going to use catalog
    > files, you should probably stick with the recommended value of
    > http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd for the SYSTEM
    > identifier. Or you could use a phony full path, such as
    > file:///docbookx.dtd, which will prevent the SAX interface from changing
    > it before the catalog resolver sees it.
    >
    >
    > IF that statement is still true,
    > that explains why it isn't working.
    >
    > Would seem to be so.
    >
    >
    > regards
    >



  • 6.  Re: [docbook-apps] xml catalogs

    Posted 08-11-2009 04:19
    On 10/08/09 20:02, George Cristian Bina wrote:
    > Hi Dave,
    >
    > XML Catalog 1.1 (implemented by the Apache resolver) added support for
    > resolving based on a suffix and that should solve the problem as the
    > file will end in the same way. Note also that you need a system mapping
    > (not a uri mapping) to resolve a DTD reference, something like below:
    >
    > <systemSuffix systemIdSuffix="your.dtd" uri="path/to/local/copy.dtd"/>
    >
    > Best Regards,
    > George


    Don't you hate it when they're always right :-)


    Parse catalog: erlang.catalog.xml
    Loading catalog: erlang.catalog.xml
    Default BASE: file:////files/erlang/erlang.catalog.xml
    systemSuffix: erlref.dtd
    /files/erlang/dtds/erlref.dtd
    SYSTEM_SUFFIX: erlref.dtd
    file:/files/erlang/dtds/erlref.dtd
    systemSuffix: xhtml-lat1.ent
    /files/erlang/dtds/xhtml-lat1.ent
    SYSTEM_SUFFIX: xhtml-lat1.ent
    file:/files/erlang/dtds/xhtml-lat1.ent

    Works perfectly, latest Apache resolver.jar

    Many thanks George, Jirka.

    XML question.



    <erlref> </erlref>


    The DTD isn't in the same folder as the instance,
    the parser needs the DTD to resolve the entity,
    Is this instance
    a) Well formed
    b) Invalid
    c) 'Wrong'

    I can't make up my mind.




    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 7.  Re: Re: [docbook-apps] xml catalogs

    Posted 08-11-2009 17:28

    Tuesday 11 August 2009

    > On 10/08/09 20:02, George Cristian Bina wrote:
    > [...]
    > XML question.
    >
    >
    >
    > <erlref> </erlref>
    ^^^^^
    I think, you miss a semikolon here:  


    > The DTD isn't in the same folder as the instance,
    > the parser needs the DTD to resolve the entity,
    > Is this instance
    > a) Well formed

    No, see above.


    > b) Invalid

    Yes, because you need a well-formed XML which is not the case, according to
    your example.


    > c) 'Wrong'

    Only syntactically. :)



    Tom



  • 8.  Re: [docbook-apps] xml catalogs

    Posted 08-11-2009 17:55
    On 11/08/09 18:28, Thomas Schraitle wrote:
    > Tuesday 11 August 2009
    >
    >> On 10/08/09 20:02, George Cristian Bina wrote:
    >> [...]
    >> XML question.
    >>
    >>
    >>
    >> <erlref> </erlref>
    > ^^^^^
    > I think, you miss a semikolon here: 

    Yes Thomas. Just checking :-)

    With



    <erlref> </erlref>


    >
    >
    >> The DTD isn't in the same folder as the instance,
    >> the parser needs the DTD to resolve the entity,
    >> Is this instance
    >> a) Well formed
    >
    > No, see above.

    But it would be, except for my error

    >
    >
    >> b) Invalid
    >
    > Yes, because you need a well-formed XML which is not the case, according to
    > your example.

    And if the ; was there?

    >
    >
    >> c) 'Wrong'
    >
    > Only syntactically. :)






    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 9.  Re: Re: [docbook-apps] xml catalogs

    Posted 08-11-2009 19:12
    Hi Dave,

    Tuesday 11 August 2009

    > On 11/08/09 18:28, Thomas Schraitle wrote:
    > [...]
    > With
    >
    >
    >
    > <erlref> </erlref>
    >
    > >> The DTD isn't in the same folder as the instance,
    > >> the parser needs the DTD to resolve the entity,
    > >> Is this instance
    > >> a) Well formed
    > >
    > > No, see above.
    >
    > But it would be, except for my error

    Yes, if the entity is correct, then the above XML is well-formed.


    > >> b) Invalid
    > >
    > > Yes, because you need a well-formed XML which is not the case, according
    > > to your example.
    >
    > And if the ; was there?

    That depends on your DTD which I don't know. For example, the following lines
    make the above XML valid:





    Tom



  • 10.  Re: [docbook-apps] xml catalogs

    Posted 08-10-2009 19:03
    Dave Pawson wrote:

    > IF that statement is still true,
    > that explains why it isn't working.

    But you should still be able to use systemSuffix in this case?

    http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.suffix

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML consulting and training services
    DocBook customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    ------------------------------------------------------------------