XMLElement annotation

XMLElement provides details for a Record field that represents an XML element.

EGL package name

eglx.xml.binding.annotation

Example use
See “Correspondence between an XML string and an EGL variable.”
Annotation detail
Record XMLElement type Annotation
   { targets = [ ElementKind.fieldMbr ]}
   name string  = "##default";
   namespace string = "##default";
   nillable boolean = false;
   required boolean = false;
end
Annotation fields
name
The name of the XML element. The default value is the name of the record field.

If you are writing a record to an XML string, the value of the property field is assigned to the element in the XML string. If you are reading an XML string into a record, the EGL Runtime issues an RuntimeException if the name of the topmost XML element does not match the value of the property field.

namespace
The XML namespace (if any) that is associated with the XML element. You must specify the namespace explicitly even if it is a default namespace.
If you specify a namespace, the following statements apply:
  • If you are writing a record to an XML string, a namespace prefix is assigned automatically
  • If you are reading an XML string into a record, an XMLProcessingException occurs if the element is not in the specified namespace
If you do not specify a namespace, the following statements apply:
  • If you are writing a record to an XML string, a namespace prefix is not specified
  • If you are reading an XML string into a record, an XMLProcessingException occurs if the element is in any namespace
nillable
A Boolean value indicates whether the element to be written to an XML string is nillable. The choice is as follows:
  • If the value is false (the default), the EGL Runtime does not write an element to the XML string when the content is null
  • If the value is true, an attempt to write a null from the record to the XML string results in an empty element that includes the attribute value xsi:nil="true" and has no other attributes

The nullable aspect of a record field affects what occurs when the EGL Runtime reads an XML string into a record. For details, see “Copying an XML string to and from an EGL variable.”

required
Indicates whether the element must be specified in the XML.
Comments
Compatibility

Table 1. Compatibility
Target Issue
Java No issues.
JavaScript No issues.