# Using XML Metadata Properties that Effect XML Generation

The following custom properties effect XML generation when using the writeXML method of a view object or row.

Property Name | Value | Valid For
XML_ELEMENT | a legal element name | view objects and view attributes
XML_ROW_ELEMENT | a legal element name | view objects
XML_CDATA | any value (not empty) | view attributes
XML_EXPLICIT_NULL | any value (not empty) | view objects and view attributes

## XML_ELEMENT

If the XML_ELEMENT custom property is present for a view object, its value is used as the XML element name for the view object in XML, when it is generated using the writeXML method and "consumed" by the readXML method.

If the XML_ELEMENT custom property is present for a view attribute, its value is used as the XML element name for the attribute in XML, when it is generated the writeXML method and "consumed" by the readXML method.

For example, for a view object named DeptView with an attribute named Sal, setting:

- XML_ELEMENT="Departments" in the view object properties

- XML_ELEMENT="Salary" in the view attribute properties for Sal

would produce XML like:

    <Departments>
      <DeptViewRow>
        <Empno>1010</Empno>
        <Ename>Steve</Ename>
        <Salary>1234</Salary>
      </DeptViewRow>
    </Departments>

instead of the default:

    <DeptView>
      <DeptViewRow>
        <Empno>1010</Empno>
        <Ename>Steve</Ename>
        <Sal>1234</Sal>
      </DeptViewRow>
    </DeptView>

## XML_ROW_ELEMENT

If the XML_ROW_ELEMENT custom property is present for a view object, its value is used as the XML element name for each row of query results produced by the view object in XML, when it is generated the writeXML method and "consumed" by the readXML method.

For example, for a view object named DeptView with an attribute named Sal, setting:

- XML_ELEMENT="Departments" in the view object properties

- XML_ROW_ELEMENT="Department" in the view object properties

- XML_ELEMENT="Salary" in the view attribute properties for Sal

would produce XML like:

    <Departments>
      <Department>
        <Empno>1010</Empno>
        <Ename>Steve</Ename>
        <Salary>1234</Salary>
      </Department>
    </Departments>

instead of the default:

    <DeptView>
      <DeptViewRow>
        <Empno>1010</Empno>
        <Ename>Steve</Ename>
        <Sal>1234</Sal>
      </DeptViewRow>
    </DeptView>

## XML_CDATA

If the XML_CDATA custom property is set to a not empty value for a view attribute, then its value will be output as a CDATA section instead of as plain text.

## XML_EXPLICIT_NULL

If the XML_EXPLICIT_NULL custom property is set to a not empty value for a view object, then any attribute with a null value will generate an XML element that looks like:

    <AttributeName null="true"/>

instead of omitting the <AttributeName> element from the XML result, which is the default.

If the XML_EXPLICIT_NULL custom property is set to a not empty value for a view attribute, then in the case that the indicated attribute has a null value, the system will generate an XML element that looks like:

    <AttributeName null="true"/>

instead of omitting the <AttributeName> element from the XML result, which is the default.