General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Validation Schema and XInlcude and validation in general

  • Scott Speights

    Validation Schema and XInlcude and validation in general

    Participants 3
    Replies 4
    Last Activity 11 years, 4 months ago

    Hello,

    I am working with Docbook 5.0 and I would like to validate against a schema + support xinclude. My version of XMetal doesn't seem to support this. When I place declare the schema in the root element the docbook menu appear :). but XInclude doesn't seem to be supported. Can someone give me a hint on how to do this?

    Another question that would interest me very much. Is there something like a processing instruction that can be inserted into a document to enable validation against a DTD or schema without actually having to declare the DTD or the Schema in the document?

    Thanks and Best Regards,
    Scott Speights

    Reply

    Derek Read

    Reply to: Validation Schema and XInlcude and validation in general

    We include the DocBook 5.0 DTDs in the sample customizations with both XMetaL Author Essential and Enterprise 6.0. This sample customization includes some XInclude capabilities (though not all the XInclude capabilities the product supports). This is done by calling various APIs at the appropriate time, decided by the person creating the customization. The people that created this particular sample decided that they would expose several of the XInclude functions on the right click context menu, and that these would only be displayed when right clicking on an or element. No XInclude functionality is exposed in the (custom) menu named DocBook.

    To insert an element into a document with this sample you would use the Element List. To set the various attributes for the element you would use the Attribute Inspector. The one thing that has been customized is that a “…” button has been added to the href attribute and clicking will allow you to browse to and select a file.

    These functions (and others related to XInclude) could be enabled on a toolbar, menu, or via other means, by creating a customization for DocBook (which might be based on our sample) or for any other DTD or Schema that defines the required xi:include and xi:fallback elements. A more complex customization might allow users to insert xi:include elements using a form, perhaps restricting selection of only appropriate document types, display a preview, allow them to set attribute values specific to corporate rules, integrate with a CMS workflow, etc.

    For more information on all the APIs that are supported you can refer to the Programmers Guide. There is an entire section devoted to the XInclude APIs called “XInclude interfaces” (there are 16 properties, 2 methods and 2 events that can be used to provide a range of XInclude-related functionality for any given customization).

    Reply

    Derek Read

    Reply to: Validation Schema and XInlcude and validation in general

    Regarding your processing instruction question…

    The answer is that out of the box there is no way to do this (no way to “add a value to a config file” or similar setting) but it might be possible with customization (requiring scripting).

    XMetaL Author locates a DTD using the DOCTYPE declaration's SYSTEM and PUBLIC id values as specified in the XML file. For Schema it uses the schemaLocation and noNamespaceSchemaLocation attributes.

    If a DTD is not located at the location specified by the SYSTEM id then XMetaL checks its catalog files for matches on the PUBLIC id value. Failing to find a match there XMetaL checks in the AuthorRules folder (by default) and failing to find a DTD there the user is then prompted to browse for it.

    However, at the time the SYSTEM id value is being checked it is possible to intercept that value and alter it using script (there's an event for that) and several APIs to override values (for SYSTEM and PUBLIC id) that will ultimately be used. We would want to know more about why your documents might not contain a DOCTYPE declaration or schemaLocation path in order to answer whether these APIs would be appropriate for your particular situation and possibly additional information as well. Most of the time it just makes sense for an XML document to reference the proper DTD or Schema (in order to be compatible with not just our software but all other XML processors). It might be best to contact XMetaL Support directly or have our sales team put you in touch with our Professional Services team in this case (they specialize in creating custom solutions for clients).

    Reply

    Scott Speights

    Reply to: Validation Schema and XInlcude and validation in general

    Hi Derek,

    Thanks for your reply. Well, essentially, my first wish is this: I have implemented DocBook using RelaxNG and schematron to validate, and it would be nice to be able to use XMetal to edit these documents WYSIWYG without giving up the RelaxNG. e.g. Finding a way to build in a RelaxNG validator or validating against a Schema without having to make a declaration in the document. Therefore the question about the processing instruction.

    More realistically, I thought that I could just make use of the existing customization and use the DocBook schema to validate the documents (my preference to DTD) iinstead of the DTD but XMetal responds with a message that the xi:xinclude element is not supported by the schema. And so I am not able to toggle the XInclude funcitonality. What I would like to know is how to get the XInclude functionality working using the existing customization with a schema.

    I will check out the API documentation that you mentioned in your reply. But if you all couldĀ  tell me how to get XInclude working that would be great.

    Regards,
    Scott

    Reply

    Derek Read

    Reply to: Validation Schema and XInlcude and validation in general

    If the schema you are working with does not include element declarations for the necessary XInclude elements then it will need to be modified.
    See: http://www.w3.org/TR/xinclude/

    XMetaL uses either a DTD or W3C Schema not just for validation but for “rules checking” (as well as many other features). Rules checking is essentially “live validation” (I make the distinction because some products do not have the equivalent). If an element is not allowed according to the schema then the product will generally not allow you to insert it, and if it is found (added in Plain Text view or in another application) it will complain. Rules checking can be turned off but doing so disables much of the useful functionality of the product.

    Note: It is possible to extend a DTD when the DTD is first read in using APIs to add elements and attributes, however, the same APIs are not available for W3C Schema so they will not help here unfortunately. This feature is used mainly for integrations with CMS systems where a CMS might add elements or attributes to an XML file that are not really in the DTD (usually for versioning and similar metadata).

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support