Forrest
  1. Forrest
  2. FOR-1032

validation problem when using custom DTD for XInclude support

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.9
    • Labels:
      None
    • Urgency:
      Normal

      Description

      I am trying to use a custom DTD to add XInclude support in XDocs source files. My source file, which uses my new doctype and contains an XInclude element, does not validate.

      Please see this thread for more details:
      http://www.mail-archive.com/user@forrest.apache.org/msg02812.html

      The discussion is continued in another thread, so you have to follow my link to the continuing thread.

      David Crossley asked me to create this issue. At his request, I am attaching the following files:
      - my new DTD
      - my project XML Catalog
      - a cut-down example of my index.xml file (the page that does not validate)
      1. index-asf.xml
        0.6 kB
        Brolin Empey
      2. document-v20-xi.dtd
        0.6 kB
        David Crossley
      3. document-v20-jd.dtd
        0.5 kB
        Brolin Empey
      4. catalog.xcat
        1 kB
        Brolin Empey

        Activity

        Hide
        Brolin Empey added a comment -
        My new DTD file.
        Show
        Brolin Empey added a comment - My new DTD file.
        Hide
        Brolin Empey added a comment -
        My project XML Catalog file.
        Show
        Brolin Empey added a comment - My project XML Catalog file.
        Hide
        Brolin Empey added a comment -
        A cut-down example of my index.xml file.

        Validation with Forrest 0.8 fails:

        validate-xdocs:
        /home/brolin/WEB/techsol.ca/forrest/src/documentation/content/xdocs/products/index-asf.xml:19:74: Element type "xi:include" must be declared.
        /home/brolin/WEB/techsol.ca/forrest/src/documentation/content/xdocs/products/index-asf.xml:19:74: The prefix "xi" for element "xi:include" is not bound.
        Show
        Brolin Empey added a comment - A cut-down example of my index.xml file. Validation with Forrest 0.8 fails: validate-xdocs: /home/brolin/WEB/techsol.ca/forrest/src/documentation/content/xdocs/products/index-asf.xml:19:74: Element type "xi:include" must be declared. /home/brolin/WEB/techsol.ca/forrest/src/documentation/content/xdocs/products/index-asf.xml:19:74: The prefix "xi" for element "xi:include" is not bound.
        Hide
        David Crossley added a comment -
        I do not get the errors that you list above. Instead i get errors from parsing the DTD as you described on the user list ... The attribute name must be specified in the attribute-list declaration for element "document".

        Anyway i got it working ...

        1) Added your catalog.xcat to src/documentation/resources/schema/

        2) Added my DTD (see attached document-v20-xi.dtd) to src/documentation/resources/schema/ and re-named to document-v20-jd.dtd (simply to match your configuration).

        The main difference is that i needed to use an xml entity to declare the "xmlns:xi" attribute (not sure why).

        There are also some other fixes, e.g. declare the same entity sets as the main original document-v20.dtd and the common.att that were defined for the original "document" element which is being over-ridden.

        3) Modified your index.xml to use the "cocoon:" protocol to resolve the included file:
        <xi:include href="cocoon://include/techsol_...

        Note that the main document-v20 DTD does not allow xi:include as a child of the "section" element. As a workaround you can re-declare the "local.sections" entity.

        Someone should raise the general issue of XInclude on the dev mail list. Should we create a new DTD? In which elements should xi:include be allowed?

        Another thing: I did expect to need to add another SourceType action to the sitemap to handle this variant of document-v20. However that was not needed.
        Show
        David Crossley added a comment - I do not get the errors that you list above. Instead i get errors from parsing the DTD as you described on the user list ... The attribute name must be specified in the attribute-list declaration for element "document". Anyway i got it working ... 1) Added your catalog.xcat to src/documentation/resources/schema/ 2) Added my DTD (see attached document-v20-xi.dtd) to src/documentation/resources/schema/ and re-named to document-v20-jd.dtd (simply to match your configuration). The main difference is that i needed to use an xml entity to declare the "xmlns:xi" attribute (not sure why). There are also some other fixes, e.g. declare the same entity sets as the main original document-v20.dtd and the common.att that were defined for the original "document" element which is being over-ridden. 3) Modified your index.xml to use the "cocoon:" protocol to resolve the included file: <xi:include href=" cocoon://include/techsol_ ... Note that the main document-v20 DTD does not allow xi:include as a child of the "section" element. As a workaround you can re-declare the "local.sections" entity. Someone should raise the general issue of XInclude on the dev mail list. Should we create a new DTD? In which elements should xi:include be allowed? Another thing: I did expect to need to add another SourceType action to the sitemap to handle this variant of document-v20. However that was not needed.
        Hide
        David Crossley added a comment -
        Attached new DTD document-v20-xi.dtd
        Show
        David Crossley added a comment - Attached new DTD document-v20-xi.dtd
        Hide
        Brolin Empey added a comment -
        XInclude works with your new DTD!

        Thank you!
        Show
        Brolin Empey added a comment - XInclude works with your new DTD! Thank you!
        Hide
        David Crossley added a comment -
        I added this as an optional element to the existing document-v20 DTD rather than create a new DTD.

        That makes it available for forrest-0.9-dev only. If people want use it in forrest-0.8 then you need to copy $FORREST_HOME/main/webapp/resources/schema/dtd/document-v20.mod to the same place in your forrest-0.8 installation.

        Beware. The xml validation only happens on the top-level xml file. The fragments included via XInclude are not validated. So now people have "enough rope".
        Show
        David Crossley added a comment - I added this as an optional element to the existing document-v20 DTD rather than create a new DTD. That makes it available for forrest-0.9-dev only. If people want use it in forrest-0.8 then you need to copy $FORREST_HOME/main/webapp/resources/schema/dtd/document-v20.mod to the same place in your forrest-0.8 installation. Beware. The xml validation only happens on the top-level xml file. The fragments included via XInclude are not validated. So now people have "enough rope".

          People

          • Assignee:
            David Crossley
            Reporter:
            Brolin Empey
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development