Vince R. wrote:

All of my docbook documents contain the following schema reference, but
when I open them xxe does not recognize them as docbook and I can't view
the document in the WYSIWYG view. Any suggestions?
<!DOCTYPE article SYSTEM "http://www.docbook.org/xml/4.4/docbookx.dtd";>

I can see that when you create a docbook file from scratch in xxe, it
uses this schema reference:
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>

I don't want to have to change all the schema references everytime I
want to edit content.


--> My first suggestion would be to fix your <!DOCTYPE> once for all because while valid, your <!DOCTYPE> is likely to cause interchange problems.

A DocBook 4 document conforming to the DocBook 4 DTD is expected to start with:

---
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd";>
---

If you make this simple change (using a text editor), then your problem is solved once for all.



--> If you don't want to do that, then you'll have to change the way XXE detects DocBook 4 documents.

<XXE_install_dir>/addon/config/docbook/docbook.xxe starts with:

---
   <detect>
     <and>
       <rootElementNamespace xsi:nil="true" />
       <dtdPublicId substring="true">DTD DocBook</dtdPublicId>
       <not>
         <dtdPublicId substring="true">Simplified</dtdPublicId>
       </not>
     </and>
   </detect>
---

This element should be changed to:

---
   <detect>
     <and>
       <rootElementNamespace xsi:nil="true" />

       <or>
         <and>
           <dtdPublicId substring="true">DTD DocBook</dtdPublicId>
           <not>
             <dtdPublicId substring="true">Simplified</dtdPublicId>
           </not>
         </and>


<dtdSystemId>http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd</dtdSystemId>

<dtdSystemId>http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd</dtdSystemId>

<dtdSystemId>http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd</dtdSystemId>

<dtdSystemId>http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd</dtdSystemId>

<dtdSystemId>http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd</dtdSystemId>
       </or>
     </and>
   </detect>
---
(A modified docbook.xxe compatible with XXE v5+ is attached to this email.)

More information in:
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/detect.html

After doing this, please do not forget to clear all the caches of XXE. This is done by clicking all the Clear buttons found in Options|Preferences, Advanced|Cached Data.

More information in:
http://www.xmlmind.com/xmleditor/_distrib/doc/help/advancedOptions.html#cacheOptions

Then please restart XXE.

After clearing the cache and restarting XXE, please open your DocBook 4.4 document and notice that opening it will take a while. In fact, XXE is downloading http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd

Fortunately once this initial download is finished, docbookx.dtd is cached in a fast loading binary format.


<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration name="DocBook" mimeType="application/docbook+xml"
  icon="../common/mime_types/docbook.png" extensions="dbk"
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

  <include location="docbook_support.incl" />

  <help location="docbook_help.jar" />

  <detect>
    <and>
      <rootElementNamespace xsi:nil="true" />

      <or>
        <and>
          <dtdPublicId substring="true">DTD DocBook</dtdPublicId>
          <not>
            <dtdPublicId substring="true">Simplified</dtdPublicId>
          </not>
        </and>

        <dtdSystemId>http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd</dtdSystemId>
        <dtdSystemId>http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd</dtdSystemId>
        <dtdSystemId>http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd</dtdSystemId>
        <dtdSystemId>http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd</dtdSystemId>
        <dtdSystemId>http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd</dtdSystemId>
      </or>
    </and>
  </detect>

  <!-- Uncommenting the following include element allows to open 
       DocBook 4 ``modules'' having no <!DOCTYPE> (e.g. a chapter of a book)
       as created using XXE v3. -->

<!--
  <include location="xxe3_compat.incl" />
-->

  <!-- Schematron based on the one coming with DocBook 5 (but rewritten 
       to make use of ISO features such as abstract patterns).
       What follows shows how to specify which schematron to use.
       It also shows how to specify a phase which depends on the contents
       of the document being edited: here, if it is a draft document, no
       real schematron validation (phase=empty) will be attempted. -->

<!--
  <schematron location="docbook.sch"
              phase="if(/*/@status='draft','empty','#ALL')" 
              evaluatePhase="true" />
-->

  <template name="Book" location="template/V4.5/book.xml" />
  <template name="Article" location="template/V4.5/article.xml" />
  <template name="Part" location="template/V4.5/part.xml" />
  <template name="Chapter" location="template/V4.5/chapter.xml" />
  <template name="Refentry" location="template/V4.5/refentry.xml" />
  <template name="Appendix" location="template/V4.5/appendix.xml" />
  <template name="Glossary" location="template/V4.5/glossary.xml" />
  <template name="Section" location="template/V4.5/section.xml" />

  <css name="DocBook" location="css/docbook.css" />
  <css name="Table of contents" alternate="true" location="css/toc.css" />
  <css name="Document structure" alternate="true"
       location="css/structure.css" />
  <!-- In principle, this is used to debug modular documents 
       but we think that some users may also like this way of 
       making documents modules more visible. -->
  <css name="Show info about included elements" alternate="true"
       location="css/visible_inclusions.css" />

  <inclusionScheme name="XInclude">
    <class>com.xmlmind.xml.xinclude.XIncludeScheme</class>
  </inclusionScheme>

  <documentSetFactory>
    <class>com.xmlmind.xmleditapp.docset.modulardoc.ModularDocumentFactory</class>
    <property name="styleSheetURL" type="URL" value="css/toc.css" />
  </documentSetFactory>

  <linkType>
    <!-- link, xref, biblioref -->
    <link match="*[@linkend]" ref="@linkend" />
    <link match="*[@endterm]" ref="@endterm" />

    <!-- area, co -->
    <link match="*[@linkends]" refs="@linkends" />

    <!-- callout -->
    <link match="*[@arearefs]" refs="@arearefs" />

    <!-- glosssee, glossseealso -->
    <link match="*[@otherterm]" ref="@otherterm" />

    <!-- indexterm -->
    <link match="*[@startref]" ref="@startref" />
    <link match="*[@zone]" refs="@zone" />

    <!-- th, td -->
    <link match="*[@headers]" refs="@headers" />

    <!-- Very rarely used and hence removed from DocBook v5:
         olink[@linkmode], 
         setinfo, bookinfo[@contents], 
         article[@parentbook] -->

    <!-- Allows to use xi:include as a link when the transclusion 
         has been turned off. -->
    <link match="xi:include" xmlns:xi="http://www.w3.org/2001/XInclude";
          href="xincl:toHref(.)" 
          xmlns:xincl="java:com.xmlmind.xml.xinclude.XInclude" />

    <anchor match="*[@id]" name="@id" />
  </linkType>

  <linkType name="xml:id">
    <!-- Allows to follow olinks (if the olinkedDocuments command has been 
         used to define the set of olinked documents) -->
    <link match="olink[@targetdoc]" 
          href="od:resolveOlink(string(@targetdoc), string(@targetptr))" 
          xmlns:od="java:com.xmlmind.xmleditext.docbook.OlinkedDocuments" />
  </linkType>

  <validateHook name="checkLinks">
    <class>com.xmlmind.xmleditapp.linktype.LinkChecker</class>
    <!-- Let the DTD check IDs. We'll only check refs. -->
    <property name="checkAnchors" type="boolean" value="false" />
    <property name="replaceDiagnostics" type="boolean" value="true" />
    <!-- When the document is not a member of a set, the DTD is just fine
         to check IDREFs. -->
    <property name="checkIfMemberOfDocSet" type="boolean" value="true" />
    <property name="excludedLinkTypes" type="String" value="xml:id" />
  </validateHook>

  <attributeEditor attribute="linkend" elementMatches="xref|link">
    <class>com.xmlmind.xmleditapp.linktype.RefChoicesFactory</class>
    <property name="listIfMemberOfDocSet" type="boolean" value="true" />
  </attributeEditor>

  <attributeEditor attribute="id" elementMatches="*">
    <class>com.xmlmind.xmleditapp.linktype.RefChoicesFactory</class>
    <property name="listIfMemberOfDocSet" type="boolean" value="true" />
  </attributeEditor>

  <attributeEditor attribute="targetdoc" elementMatches="olink">
    <class>com.xmlmind.xmleditext.docbook.OlinkedDocuments$ChooseTarget</class>
  </attributeEditor>

  <attributeEditor attribute="targetptr" elementMatches="olink[@targetdoc]">
    <class>com.xmlmind.xmleditext.docbook.OlinkedDocuments$ChooseTarget</class>
  </attributeEditor>

<!--
  <windowLayout>
    <left />
    <top css="Document structure" />
    <center css="DocBook" />
  </windowLayout>
-->

<!--
  <windowLayout>
    <center css="DocBook" />
    <bottom css="Document structure" size="0.15" />
  </windowLayout>
-->

  <!-- Menu =============================================================== -->

  <command name="docb.olinkedDocuments">
    <class>com.xmlmind.xmleditext.docbook.OlinkedDocuments</class>
  </command>

  <command name="docb.linkCallouts">
    <class>com.xmlmind.xmleditext.docbook.LinkCallouts</class>
  </command>

  <command name="docb.editIndexTerm">
    <class>com.xmlmind.xmleditext.docbook.EditIndexTerm</class>
  </command>

  <menu label="_DocBook" insert="Move _Up">
    <item label="_Link callouts..."
          command="docb.linkCallouts"/>
    <separator/>
    <item label="Insert or Edit inde_xterm..."
          command="docb.editIndexTerm"/>
    <separator/>
  </menu>

  <menu label="_DocBook">
    <item label="_Set up olinks..."
          command="docb.olinkedDocuments"/>
    <separator/>
    <insert/>
    <item label="Pro_mote"
          icon="../common/icons/left.png"
          command="docb.promote"/>
    <item label="_Demote"
          icon="../common/icons/right.png"
          command="docb.demote"/>
  </menu>

  <include location="xslMenu.incl" />

  <!-- Toolbar ============================================================ -->

  <include location="toolBar.incl" />

  <!-- Bindings =========================================================== -->

  <binding>
    <keyPressed code="F2" />
    <keyPressed code="LEFT" />
    <command name="docb.promote" />
  </binding>

  <binding>
    <keyPressed code="F2" />
    <keyPressed code="RIGHT" />
    <command name="docb.demote" />
  </binding>

  <!-- Element templates ================================================== -->

  <elementTemplate name="para" selectable="override">
    <answer xmlns="">
      <para></para>
    </answer>
  </elementTemplate>

  <elementTemplate name="glossdef" selectable="override">
    <glossentry xmlns="">
      <glossterm></glossterm>
      <glossdef>
        <para></para>
      </glossdef>
    </glossentry>
  </elementTemplate>

  <!-- By default, a part is created containing an empty toc -->

  <elementTemplate name="chapter" selectable="override">
    <part xmlns="">
      <title></title>
      <chapter>
	<title></title>
	<section>
	  <title></title>
	  <para></para>
	</section>
      </chapter>
    </part>
  </elementTemplate>

  <!-- fileref is not a mandatory attribute of graphic and inlinegraphic -->

  <elementTemplate name="simple" selectable="override">
    <graphic xmlns="" fileref="???" />
  </elementTemplate>

  <elementTemplate name="simple" selectable="override">
    <inlinegraphic xmlns="" fileref="???" />
  </elementTemplate>

</configuration>

 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to