APP in Arbortext Styler > Components of Documents and Templates > Content Types > XML Content Streams
  
XML Content Streams
Introduction
There are two types of XML content stream in Arbortext Advanced Print Publisher:
XML text streams — an editable text stream, much like the standard text streams discussed in Basic Text Streams
XML DOM streams — an XML DOM stream
Both XML text streams and XML DOM streams can be used as frame content and formatted.
Refer to XML in Arbortext Advanced Print Publisher for information about Arbortext Advanced Print Publisher’s XML capabilities.
XML Text Streams
The Arbortext Advanced Print Publisher tag type .xm represents XML text streams. XML content can also be held by other types of tag, for example .tx and .rf, but for purposes of clarity it is useful to always use .xm tags.
The key difference between .xm tags and text stream tags (.tx) is that Arbortext Advanced Print Publisher always tries to parse the content of an .xm tag as XML and create a DOM tree from it. If that is not possible, Arbortext Advanced Print Publisher creates an error tag of type .xe in the xerror namespace. The error tag has the same name as the XML tag containing the error. It contains a description of the error that Arbortext Advanced Print Publisher’s XML parser encountered in the content.
The XML DOM created from these tags is read only. You can perform XPath expressions and run XSLT against the DOM but Arbortext Advanced Print Publisher’s DOM functionality cannot modify it.
XML streams have a number of properties that can make Arbortext Advanced Print Publisher more flexible in its handling of XML text content.
* 
Many of the properties of XML streams are irrelevant for XML DOM streams. They instruct Arbortext Advanced Print Publisher how to parse the XML content to create the DOM tree.
These properties are part of the fStream object — there is no differentiation between Arbortext Advanced Print Publisher’s text streams and XML content streams:
fStream.isXML — specifies whether Arbortext Advanced Print Publisher should consider the content as XML. This is set to on by default only in .xm streams, but can be activated for other content stream types.
fStream.xmlParseError — contains the last parsing error generated if Arbortext Advanced Print Publisher cannot build a tree from the XML in a stream for which the isXML property is true. The error can then be used to test whether a tree has been built from content.
fStream.xmlErrorPosLast and fStream.xmlErrorPosCurrent — provide information about the place in content where errors occurred during parsing
fStream.xmlValidate — instructs Arbortext Advanced Print Publisher that XML content should be validated against a DTD. By default,Arbortext Advanced Print Publisher does not attempt to validate XML content.
fStream.xmlValidError — reports the last of any validation errors generated when Arbortext Advanced Print Publisher tries to validate XML content
fStream.xmlCatalog — specifies the location of the XML catalog to use when validating the XML instance
fStream.xmlBaseURI — sets a base URI for the stream, from which to resolve paths relative to the content source.
Problems can occur in XML instances that contain relative links to external content if the location of the current document or template is not the same as the location of the source of the XML instance.
fStream.xmlLoadExternal — instructs Arbortext Advanced Print Publisher to load content that is referenced in the XML content, for example entities. If the property is set to true, Arbortext Advanced Print Publisher creates document tags for that content. Otherwise it accesses the external file directly.
XML text streams provide a read-only XML DOM that can be accessed through Arbortext Advanced Print Publisher’s DOM implementation.
XML DOM Streams
.xd type tags represent XML DOM streams. They are tags to which a read-write XML DOM can be attached. You cannot edit the DOM tag directly in Arbortext Advanced Print Publisher. If you click into an XML DOM stream a temporary placeholder tag, with the tag type !!!, is generated for edit.
* 
It is not recommended that you make edits to the !!! DOM placeholder tag unless you have extensive experience. If the content is not well formed after edits to the stream, and Arbortext Advanced Print Publisher attempts to recreate the DOM during a reformat action, all the DOM content will be lost, and cannot be retrieved.
As the XML DOM associated with the XML DOM stream is read-write, you can use W3C DOM Level 2 Core JavaScript functionality to manipulate the DOM. Refer to DOM Access from JavaScript for information.
Best Practices
Do not edit XML DOM stream content unless you are wholly confident. The potential to lose all the DOM content is very high.