Decorators
TypeSpec.Xml
@attribute
Specify that the target property should be encoded as an XML attribute instead of node.
Target
ModelProperty
Parameters
None
Examples
Default
With @attribute
@name
Provide the name of the XML element or attribute. This means the same thing as
@encodedName("application/xml", value)
Target
unknown
Parameters
Name | Type | Description |
---|---|---|
name | valueof string | The name of the XML element or attribute |
Examples
@ns
Specify the XML namespace for this element. It can be used in 2 different ways:
@ns("http://www.example.com/namespace", "ns1")
- specify both namespace and prefix@Xml.ns(Namespaces.ns1)
- pass a member of an enum decorated with@nsDeclaration
Target
unknown
Parameters
Name | Type | Description |
---|---|---|
ns | string | EnumMember | The namespace URI or a member of an enum decorated with @nsDeclaration . |
prefix | valueof string | The namespace prefix. Required if the namespace parameter was passed as a string. |
Examples
With strings
With enum
@nsDeclarations
Mark an enum as declaring XML namespaces. See @ns
Target
Enum
Parameters
None
@unwrapped
Specify that the target property shouldn’t create a wrapper node. This can be used to flatten list nodes into the model node or to include raw text in the model node.
It cannot be used with @attribute
.
Target
ModelProperty
Parameters
None