แก้ไข

แชร์ผ่าน


Field Attribute Nodes

Overview

In BizTalk Editor, you use Field Attribute nodes to describe items of information that are simple in nature, such as strings and numbers. Further, they are used when the information in question appears as the value of an attribute in an actual instance of a message, as opposed to appearing as the content of an XML element. For additional information about information that is stored as element content, see Field Element Nodes.

Although the most straightforward use of Field Attribute nodes is as child nodes of Record nodes, they can also be used as child nodes of Attribute Group nodes. In the latter case, the Field Attribute nodes that are children of an Attribute Group node are available as attributes of any Record node that includes that Attribute Group node. For more information about Attribute Group nodes, see Attribute Group Nodes.

Note

In BizTalk Editor, both the element and attribute elements can be represented by a Field node, though they have different icons associated with them in the schema tree view, a different XML representation in the XSD window, and different properties in the Visual Studio Properties window.

For any given item of information in an XML message, where item of information means a single discrete simple type, such as a string or number, there is always a question regarding whether that information should be represented as the attribute of an element, or as a subelement of that element. As a general rule, representing an item of information as an attribute tends to be more appropriate when the possible values are discrete, few in number, and tend to modify the semantics of the element itself. Representing an item of information as a subelement tends to be more appropriate when the possible values can repeat a variable number of times, are likely to have more widely ranging values, might be long, as in long strings, and are one of several sibling values where their order is relevant. If you are creating a schema for an existing type of XML document, your choice of using a Field Element node or a Field Attribute node for a particular item of information has already been made for you, and you must use the node that matches the XML.

Note

Root nodes may not have Field attributes. Field attributes attached to the Root node are not saved with the schema.

XSD representation

When a Field Attribute node is inserted into a Record node, it is inserted at the end of any other child nodes in the Record node. This includes being inserted after the sequence, choice, or all element containing any nonattribute nodes, and after any attribute nodes that were previously inserted. The following example shows a new Field Attribute node, in bold, inserted at the end of a Record node (with nodes named to clarify their identity).

<xs:element name="ContainingRecord">  
    <xs:complexType>  
        <xs:sequence>  
            <xs:element name="FieldElement" type="xs:string" />  
            <xs:element name="EmptyNestedRecord">  
                <xs:complexType />  
            </xs:element>  
        </xs:sequence>  
        <xs:attribute name="ExistingFieldAttribute" type="xs:string" />  

    </xs:complexType>  
</xs:element>  

See Also