Altova StyleVision 2025 Enterprise Edition

User-Defined Schemas

Home Prev Top Next

You can quickly create a user-defined schema in the Schema Tree sidebar. This is useful if you have an XML document that is not based on any schema and you wish to create an SPS for this XML document.

 

To add and create a user-defined schema, in the Schema Tree sidebar, do the following:

 

1.In the Design Overview sidebar, click the Add New Source command (under the Sources heading), and select Add User-Defined Schema (screenshot below).

 

SBDesOviewAddFiles

 

The new schema is created and is indicated with the parameter $USER (screenshot below).

 

WinSchemaSrcCreateUDSchema2

 

2.In the Root Elements tree, there is a single root element (document element) called UserRoot.
3.Double-click UserRoot and rename it to match the document element of the XML document for which you are building this schema.
4.To assign a child element or an attribute to the document element, select the document element (UserRoot), and click, respectively, (i) the drop-Append New Element icon ic_addnewelement in the toolbar of the Schema Tree sidebar; and (ii) the dropdown arrow of the Append New Element icon | the Append New Attribute command. Alternatively, you can right-click and select the required command from the context menu. When an element is selected, appending and inserting an element, adds the new element as a sibling element, respectively, after and before the selected element. You can also add a child element and a child attribute. When an attribute is selected, you can append or insert another attribute, respectively, after and before the selected attribute. After the new element or attribute is added to the tree, type in the desired name. You can also drag nodes to the desired location (described in the next step). In the screenshot below, the Article element is the document element. The elements Title, Para, Bold, and Italic, and the attributes ID and Author have been added at the child level of Article.

 

WinSchemaSrcUserDefined

 

5.To move the elements Bold and Italic, and the attribute ID to the level of children of Para, select each individually and drag to the Para element. When a bent downward-pointing arrow ic_addnodearrow appears, drop the dragged node. It will be created as a "child" of Para (screenshot below).

 

WinSchemaSrcUserDefinedDragElem

 

6.When any element other than the document element is selected, adding a new element or attribute adds the new node at the same level as the selected element. Drag a node (element or attribute) into an element node to create it as a "child" of the element node.

 

Editing node names and deleting nodes

To edit the name of an element or attribute, double-click in the name and edit the name. To delete a node, select it and click the Remove icon ic_delete in the toolbar. Alternatively, select Remove from the context menu.

 

© 2018-2024 Altova GmbH