|
Home >Online Product Documentation >Table of Contents >Adding an Identity Constraint to an Element Adding an Identity Constraint to an Element
XML Schemas provide a feature that is similar to the DTD You associate an identity constraint with an element.
This section covers the following topics: Example of an Identity ConstraintThis topic provides an example of an element with an identity constraint. Introductory information about identity constraints is in Adding an Identity Constraint to an Element. See also Tree View. Suppose you define the following element in an XML Schema: In an XML document that uses this schema, you could define the following elements:
If you want to enforce that there is just one
The schema validator starts with an initial context set that contains Diagram ViewTo specify an identity constraint:
1. Right-click the element for which you want to specify the identity constraint.
2. Select Add > and then Key, KeyRef, or Unique from the menu.
3. Right-click the new identity constraint, and select Selector.
4. In the Properties window, specify the XPath expression that identifies the set of elements to which the identity constraint applies.
5. Return to step 3 and select Field.
6. In the Properties window, specify the XPath expression that identifies the element or attribute for each element identified by the selector element that has to be unique.
Tree ViewThis topic provides the procedure for specifying an element with an identity constraint. Introductory information about identity constraints is in Adding an Identity Constraint to an Element. See also Example of an Identity Constraint. To specify an identity constraint:
1. Click the element for which you want to specify the identity constraint.
2. In the XML Schema left-side tool bar, click
3. In the drop-down list that Stylus Studio displays, double-click unique, key, or keyref.
4. In the Properties window, double-click the Name field and enter a name for the identity constraint.
5. If you selected keyref, then in the Properties window, double-click the Refer field and enter the name of the key definition.
6. In the tree representation, click the identity constraint you just defined.
7. In the left tool bar, click New Selector/Key
8. In the drop-down list that Stylus Studio displays, double-click selector. You must define exactly one selector for each identity constraint.
9. In the Properties window, double-click the XPath Expression field and enter an XPath expression that returns the element for which you are specifying a constraint.
10. Click the unique, key, or keyref identity constraint you defined in Step 3.
11. In the left tool bar, click New Selector/Key
12. In the drop-down list that Stylus Studio displays, double-click field. You must define one or more fields for each identity constraint. A field can be whatever the XPath expression (defined in the next step) retrieves.
13. In the Properties window, double-click the XPath Expression field and enter an XPath expression that returns the element or attribute that is the key or one of the keys for the constraint. XPath expressions associated with fields return the data that define the key for each element returned by the
selector XPath expression.
|
Medical Companies That Use Stylus Studio
Medical companies can't solve every ache and pain. That's why when it comes to the struggle of data integration, they turn to Stylus Studio to simplify their pains. Come see which medical companies are injecting Stylus Studio into their work load!
Telecommunications Companies That Use Stylus Studio
Can you here me now? When it comes to telecommunications and XML it can get a little fuzzy. That's why these top telecommunication companies turn to Stylus Studio to connect them to their XML needs.
Metals, Mining & Crude-Oil Production
It can be very dark and dreary in a mine. That's why metal, mining & crude-oil production are using Stylus Studio as their light when it comes to data integration. See which of these top companies are using Stylus Studio to show them the way to XML!
Database-to-XML Mapping
Stylus Studio features several database-to-XML mapping tools that allow you to easily query a relational database using SQL/XML or SQL and render the results as XML. Stylus Studio also supports the world's first and only visual SQL/XML Editor!


