APP in Arbortext Styler > Components of Documents and Templates > XML > XML Document Preferences
  
XML Document Preferences
Introduction
Document preferences instruct Arbortext Advanced Print Publisher how strict to be when processing XML and how to handle some optional functionality which may affect performance. Preference settings also make it easier to create and use XML dynamically without unnecessary overheads.
* 
When creating an Arbortext Advanced Print Publisher template from scratch, the default settings for handling XML in a document do not support the most common usage. You may need to configure your own settings.
Arbortext Advanced Print Publisher XML Document Preferences
There are two methods for setting XML document preferences:
Access the preferences.xml property set of the fTemplate object with JavaScript
Make changes manually in the document preferences menu in Arbortext Advanced Print Publisher — Desktop product
The following preferences are available. Refer to Best Practices for a list of recommended settings:
Preference: Save parser errors with document
FOM: fTemplate.preferences.xml.saveXMLErrors boolean property
Ensures any parser errors generated in the xerror namespace when trying to parse an XML content stream are kept with the document
This preference only needs to be activated if you want to provide specific information about a problem in parsing, for example to PTC Support.
Preference: Ignore missing <?xml...?> declaration
FOM: fTemplate.preferences.xml.ignoreMissingXMLDecl boolean property
Instructs Arbortext Advanced Print Publisher to build a DOM using the fStream.isXML property, even if the text stream it encounters does not include the XML declaration
Preference: Ignore undefined entity references
FOM: fTemplate.preferences.xml.ignoreUndefinedEntities boolean property
Allows Arbortext Advanced Print Publisher to ignore the presence of undeclared entities in content so the DOM tree can be built
When Arbortext Advanced Print Publisher receives XML content it does not always have a DTD available. It also uses &...; delimited markers in content to apply styling. A lack of entity reference declaration can cause a problem with some parsers.
Preference: Replace undefined entity references
FOM: fTemplate.preferences.xml.replaceUndefinedEntities boolean property
Instructs Arbortext Advanced Print Publisher to leave an entity reference in output, rather than replacing it with its text equivalent
When parsing and/or processing XML using XSLT, if an entity reference is not defined, an attempt to replace it with its text equivalent would insert nothing.
Preference: Validate against internal DTD
FOM: fTemplate.preferences.xml.validateXML boolean property
Instructs Arbortext Advanced Print Publisher to validate XML content when a DTD is referenced from the XML instance
Arbortext Advanced Print Publisher’s libXML library can validate against DTDs (not schemas), but by default it is not necessary. It is assumed that validation occurred during content creation. However, it can be helpful to validate when allowing content editing in a saved document.
Preference: Expand XInclude elements
FOM: fTemplate.preferences.xml.processXInclude boolean property
Allows the resolution of XInclude elements
Preference: Load external files
FOM: fTemplate.preferences.xml.loadExternalFiles boolean property.
Instructs Arbortext Advanced Print Publisher to use external files referenced from an XML instance, for example in entities, when parsing
Preference: Create links to external files
FOM: fTemplate.preferences.xml.createLinksToFiles boolean property
Instructs Arbortext Advanced Print Publisher to create a Arbortext Advanced Print Publisher tag that links to an external content file, if Load external files specifies that they should be used
Preference: Strip whitespace nodes
FOM: fTemplate.preferences.xml.stripWhitespaceNodes boolean property
Strips nodes that only contain whitespace from the resulting tree during parsing
Preference: Add default attributes from DTD
FOM: fTemplate.preferences.xml.addDefaultAttributes boolean property
Ensures that attribute processing is aware of all attributes that should appear on an element
When parsing and validating against a DTD, Arbortext Advanced Print Publisher can add default attributes to the resulting DOM tree if they are specified in the DTD.
Some other document preferences govern XPath behavior particular to Arbortext Advanced Print Publisher:
Allow APP variables — before JavaScript, Arbortext Advanced Print Publisher accessed XPath using show strings. Accessing variables in XPath in show strings was complex before this setting was provided.
Allow APP node tests — activates/deactivatesArbortext Advanced Print Publisher’s node test extensions to XPath
Add APP functions to global namespace and Add APP functions to x3b2 namespaceArbortext Advanced Print Publisher provides a number of extension functions to standard XPath 1.0. These preferences are used to make the extensions available without using a namespace prefix before the function name.
In Arbortext Styler, the x3b2 namespace prefix is required for Arbortext Advanced Print Publisher XPath extension functions.
Refer to XPath in Arbortext Advanced Print Publisher for information on Arbortext Advanced Print Publisher’s XPath support.
Best Practices
The following XML document preference settings are recommended when setting up a native Arbortext Advanced Print Publisher template:
Save parser errors with document / fTemplate.preferences.xml.saveXMLErrors — false
Ignore missing XML <?xml...?> declaration / fTemplate.preferences.xml.ignoreMissingXMLDecl — true
Ignore undefined entity references / fTemplate.preferences.xml.ignoreUndefinedEntities — true
Replace undefined entity references / fTemplate.preferences.xml.replaceUndefinedEntities — false
Validate against DTD / fTemplate.preferences.xml.validateXML — false
Expand XInclude elements / fTemplate.preferences.xml.processXInclude — false
Load external files / fTemplate.preferences.xml.loadExternalFiles — false
Create links to external files / fTemplate.preferences.xml.createLinksToFiles — false
Strip whitespace nodes / fTemplate.preferences.xml.stripWhitespaceNodes — false
Add default attributes from DTD / fTemplate.preferences.xml.addDefaultAttributes — false
Allow APP variables — true
Allow APP node tests — true
Add APP functions to global namespace and Add APP functions to x3b2 namespace — true