Associating a RelaxNG schema with a framework by version
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 163
- Joined: Sat Aug 28, 2010 1:23 am
Associating a RelaxNG schema with a framework by version
Hi there,
I've created a customization of the DocBook 5.0 schema and, following the advice of DocBook V5.0, The Transition Guide, http://www.docbook.org/docs/howto/#cust-naming, I'm using the version attribute to distinguish instances of my documents from straight DocBook documents:
In Oxygen, I've copied the DocBook framework and modified it to use my schema instead of the DocBook schema. By moving my new Document Type above the DocBook 5 document type in the list, I can cause my documents to open using my schema, however this also causes ALL DocBook documents to open using my schema. I don't see a way to specify which version attribute a Document Type should apply to. What am I missing?
Thanks,
David
I've created a customization of the DocBook 5.0 schema and, following the advice of DocBook V5.0, The Transition Guide, http://www.docbook.org/docs/howto/#cust-naming, I'm using the version attribute to distinguish instances of my documents from straight DocBook documents:
Code: Select all
<book xmlns="http://docbook.org/ns/docbook" version="5.0-extension BroadBook-2.0">
Thanks,
David
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Associating a RelaxNG schema with a framework by version
Dear David,
To match a framework based on an attribute value (an attribute of the root element) you need to implement a simple Java extension and set that in the Java class entry from an association rule.
Such an extension needs to implement the DocumentTypeCustomRuleMatcher interface that defines only one method:
We have such an extension implemented for DITA that looks for the DITA architecture version attribute. The source is available in the oXygen Author SDK, look for the ro.sync.ecss.extensions.dita.topic.DITATopicCustomRuleMatcher class.
Best regards,
George
To match a framework based on an attribute value (an attribute of the root element) you need to implement a simple Java extension and set that in the Java class entry from an association rule.
Such an extension needs to implement the DocumentTypeCustomRuleMatcher interface that defines only one method:
Code: Select all
/**
* Check if the document type to which this custom rule belongs to
* should be used for the given document properties.
*
* @param systemID The system ID of the current file in an URL format with not allowed characters corrected.
* For example: "file:/C:/path/to/file/file.xml"
* @param rootNamespace The namespace of the root.
* @param rootLocalName The root local name.
* @param doctypePublicID The public id of the specified DTD if any.
* @param rootAttributes The root attributes. The attributes are DOM level 2
* and the namespaces are available for each one.
* @return <code>true</code> if the document type to which this rule belongs to
* will be used for the current file.
*/
boolean matches(
String systemID,
String rootNamespace,
String rootLocalName,
String doctypePublicID,
Attributes rootAttributes);
Best regards,
George
George Cristian Bina
-
- Posts: 163
- Joined: Sat Aug 28, 2010 1:23 am
Re: Associating a RelaxNG schema with a framework by version
I haven't gotten around to trying this yet, but it occurs to me that it would be useful if in the Preferences, Document Type, in the Rules tab, in addition to Namespace, Root local name, etc, there were an "XPath Expression" field which let you put in something like "/*[@version = '5.0-extension BroadBook-2.0']". If that expression evaluates to true, then the schema is used.
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Associating a RelaxNG schema with a framework by version
Hi David,
Thanks for the suggestion.
In the meantime you can try to implement the DocumentTypeCustomRuleMatcher George mentioned and tell us if you run into any problems.
Regards,
Radu
Thanks for the suggestion.
In the meantime you can try to implement the DocumentTypeCustomRuleMatcher George mentioned and tell us if you run into any problems.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service