Taking Advantage of XMetaL’s XInclude Support

  • View

  • Download

Embed Size (px)


In XMetaL Author 6.0 we introduced “Support for modular XML documents via W3C XInclude”. Beyond the checkbox on the marketing datasheet, what does this support really mean for partners and customers? As an XMetaL implementer, you can provide your end users with new content reuse capabilities. We take a look at what XMetaL allows, and what you need to do to allow your end users to take advantage of this powerful new feature. A recording of this presentation is available here: http://tinyurl.com/2we2xee

Text of Taking Advantage of XMetaL’s XInclude Support

  • 1. in 37 minutesEpisode 4Taking advantage of XMetaLs XInclude support Tom Magliery, XML Technology Specialist Brought to you by XMetaL Technical Services 2010 JustSystems Inc.

2. Announcements Next time: Su-Laine XMetaL for Simple XMLEditingEditing 2010 JustSystems Inc. 3. Agenda Introduction B i XI l d markupBasic XInclude k XMetaL XInclude APIs 2010 JustSystems Inc. 4. What is XInclude W3C XML standard General purpose inclusion mechanismG li l ih i Including XML inside other XML A general way to achieve content reuse 2010 JustSystems Inc. 5. XMetaLs XInclude support XMetaL automatically recognizes XIncludemarkup XMetaL XInclude APIs allow customizers to addreuse functionality to document customizations 2010 JustSystems Inc. 6. Getting started Step 1: Define XInclude elements in yourDTD/schema St 2: Put XInclude markup in your instanceStep 2 P t XI l d k i i tdocument Step 3: See what happens in XMetaL ... 2010 JustSystems Inc. 7. STEP 1: XINCLUDE IN YOUR DTD OR SCHEMA 2010 JustSystems Inc. 8. XInclude specifies two new elements PlPlaceholder f referenced content h ld for fdt t Pointer to referenced content Put wherever you want to be able to include things Content to be displayed if XInclude resolution fails 2010 JustSystems Inc. 9. Example DTD with XInclude ) ) 2010 JustSystems Inc. 10. STEP 2: XINCLUDE IN YOUR DOCUMENT MARKUP 2010 JustSystems Inc. 11. XInclude markupThis is fallback text. / 2010 JustSystems Inc. 12. Sample document This is my PaperJohn Q. PublicFirst sectionFirst paragraph.Second paragraph.This is fallback text. 2010 JustSystems Inc. 13. STEP 3: SEE WHAT HAPPENS IN XMETAL 2010 JustSystems Inc. 14. STEP 4: DO STUFF WITH SCRIPT 2010 JustSystems Inc. 15. Implementing XML inclusions XMetaL automatically recognizes XIncludemarkup But there is no built-in user interface ThThere are new APIAPIs XInclude-related methods/properties on Document and Application objects Write script using APIs to implement desiredfunctionalityy 2010 JustSystems Inc. 16. Bonus tip: Pasting script (Not related to XML inclusions) C paste executable script code i t thCant t bl i t d into theXMetaL main document window RRequires specific script h d liiifi i t header line://XMetaL Script Language JScript: ActiveDocument.Host.Alert("Hello, world"); 2010 JustSystems Inc. 17. ShowXInclude(node) ShowXInclude(node) Document object method If node i an XI l d the t d is XInclude, th target is displayedt i di l d Else, if node has XInclude ancestor(s), thenearest one is di lt i displayedd Else, if node has XInclude descendants, theyare all displayed ShowXInclude(ActiveDocument.documentElement)will show a inclusions in the docu e s o all c us o s e document NOTE: An XInclude must be updated at leastonce before it can be displayed p y 2010 JustSystems Inc. 18. UpdateXInclude(node) UpdateXInclude(node) Document object method Same rules about which node(s) are affectedS lb t hi h d ( ) ff t d Causes a refresh of the affected node(s) Does not change visibility of the includedcontent 2010 JustSystems Inc. 19. HideXInclude(node) HideXInclude(node) Document object method Same rules about which node(s) are affectedSl b t hi h d ( )ff t d Hides the target content of affected nodes Display reverts to fallback content 2010 JustSystems Inc. 20. OpenXIncludeTarget(node) OpenXIncludeTarget(node) Document object method If node i an XI l d opens the t d isXInclude,th targettdocument (specified in href) El if node h XI l d ancestor(s), opensElse,d has XInclude t ( )the target document of the nearest one 2010 JustSystems Inc. 21. Some other interesting APIs ExportWithXIncludesToFile(strFile) EExportWithXIncludesToXML() tWithXI l d T XML() Returns an XML string Li kR l ti E Li tLinkResolutionErrorList Property, returns ValidationErrorList object ResultsManager object Application.ResultsManager.ShowLinkLogTab() Application ResultsManager HideLinkLogTab()Application.ResultsManager.HideLinkLogTab() 2010 JustSystems Inc. 22. Documentation Full documentation on the XML inclusion APIs isin XMetaL Developer 6.0 docs60 2010 JustSystems Inc. 23. Some possible functionality Menu commands:IInsert XML inclusions t i l i Show or hide all inclusions Context menu commands: Hide or show one XML inclusion Open XML inclusion target Other Combine with Treat as link AI buttonTreatlink Custom dialogs 2010 JustSystems Inc. 24. DocBook sample Included* with XMetaL 6.0 Ill t t several XI l d f t Illustrates l XInclude features (DEMO) * No pun intended 2010 JustSystems Inc. 25. Resources XMetaL Community Forums htt //fhttp://forums.xmetal.com/ t l/ JustSystems Partner Center http://justpartnercenter com/http://justpartnercenter.com/ Ask us for help (partner tech support) partnersupport na@justsystems compartnersupport-na@justsystems.com 2010 JustSystems Inc.