Altova StyleVision 2024 Professional Edition

Inserting XML Content as Text

Home Prev Top Next

Data from a node in the XML document is included in the design by dragging the corresponding schema node from the Schema Tree window and dropping it into the design. When the schema node is dropped into the design, a menu pops up with options for how the node is to be created in the design (screenshot below).

 

MnuCreateAs

 

Types of schema nodes

Schema nodes that can be dropped from the Schema Tree sidebar into the design are of three types: (i) element nodes; (ii) attribute nodes; and (iii) datatype nodes.

 

Using the Insert Contents toolbar icon

The Insert Contents icon in the Insert Design Elements toolbar also enables you to insert the contents of a node in the design. Insert contents as follows:

 

1.Select the Insert Contents icon.

2.Click the location in the design where you wish to insert contents. The Insert Contents Selector pops up (screenshot below).

 

InsertContentsSelector

 

3.The context of the insertion location in the design is displayed in the XPath Context field. Select the node for which you wish to create contents.

4.Click OK. The contents placeholder is created. If the node you selected is anything other than the context node, additional template tags with the path to the selected node will be created around the contents placeholder.

 

Outputting text content of nodes

To output the text contents of the node, the node should be created as contents. When a node is created as contents, the node will look something like this in the design document:

 

SSCreateContents

 

In the screenshot above, the Desc element has been created as contents. The output will display the text content of Desc. If Desc has descendant elements, such as Bold and Italic, then the text content of the descendant elements will also be output as part of the contents of Desc. Note that attribute nodes of Desc are not considered its child nodes, and the contents of the attribute nodes will therefore not be output as part of the contents of Desc. Attribute nodes have to be explicitly inserted in order to be processed.

 

CDATA sections

If CDATA sections are present in the XML document they will be output, and in Authentic View, are indicated with tags when markup is switched on (using the menu command Authentic | Markup). CDATA sections can also be inserted in the XML document when editing the document in Authentic View (via the context menu).

 

tag_cdata

 

Note:In Authentic View, CDATA sections cannot be inserted into input fields (that is, in text boxes and multiline text boxes). They can only be entered within elements that are displayed in Authentic View as text content components.

 

In this section

In the sub-sections of this section, we describe other aspects of inserting XML content as text:

 

How the text content of a node can be marked up with a predefined format directly when the node is inserted.

How the structure of the source schema determines the effect of Authentic View usage.

How descendant nodes not explicitly included within a node can be included for processing. See Rest-of-Contents.

 

 

Note:You can create an empty template rule by deleting the (content) placeholder of a node. An empty template rule is useful if you wish to define that some node not be processed, i.e. produce no output.

 

© 2017-2023 Altova GmbH