Open topic with navigation

# _ATTRIBUTES

The `_ATTRIBUTES` (or `_ATTRS`) element is used to retrieve attributes of the current object or relationship that is being retrieved from the Enovia repository. The current object is the last business object in the Enovia repository that was retrieved based on elements further up the `DocumentsXML` XML hierarchy.

The object or relationship attributes are inserted as fields in the document metadata.

The attributes that are retrieved can be specified using one of the following methods:

- Use the `attr_pattern` attribute to specify a comma-separated list of attribute names.
- Use the `attr_regex` attribute to specify a regular expression.
- The `_ATTRIBUTES` element can also contain a comma separated list of object or relationship attributes to retrieve (for an example, see Example: Use the _ATTRIBUTES Element).

Attribute | Description
--- | ---
`attr_pattern` | A comma-separated list of attribute names. Attributes that match one or more of the names are retrieved. The wildcards * and ? can be used.
`attr_regex` | A regular expression to restrict what attributes are retrieved. Attributes with names that match the regular expression are retrieved.
`node_name` | The name of the metadata field created to contain the attribute values. If `node_name` is not specified the child metadata is added at the current depth in the document metadata. `node_name` only adds structure to the metadata and does not affect the metadata itself. When `name_attr` is specified, `node_name` instead specifies the field name to be generated for each object or relationship attribute. No parent field is generated in this case. The object or relationship attribute name is stored as a field attribute value and not as the field name. If `node_name` is not specified, but `name_attr` is specified, the default field name `attr` is used. For an example that uses `name_attr`, see Example: Use name_attr.
`name_attr` | The name of the XML metadata attribute to contain the name of the object or relationship attribute. For an example that uses `name_attr`, see Example: Use name_attr.

## Example: Use the `_ATTRIBUTES` Element

The following examples result in similar output (with attributes from a top-level object, relationship, or other related object):

    <DOCUMENT ...>
       <_ATTRS attr_regex="attr .*" node_name="attributes"/>
    </DOCUMENT>

    <DOCUMENT ...>
       <attributes>
          <_ATTRS attr_pattern="attr *"/>
       </attributes>
    </DOCUMENT>

    <_TO_REL ...>
       <_ATTRS attr_pattern="attr 1,attr 2,attr 3" node_name="attributes"/>
    </_TO_REL>

    <_FROM_REL ...>
       <_ATTRS attr_regex="attr .*" node_name="attributes"/>
    </_FROM_REL>

    <_OBJ ...>
       <_ATTRS attr_pattern="attr *" node_name="attributes"/>
    </_OBJ>

    <_OBJ ...>
       <_ATTRS node_name="attributes"/>attr 1,attr 2,attr 3</_ATTRS>
    </_OBJ>

Result

These examples produce the following output (given attributes `attr 1`, `attr 2` and `attr 3` for each object or relationship):

    <attributes>
       <attr_1>[attr 1 value]</attr_1>
       <attr_2>[attr 2 value]</attr_2>
       <attr_3>[attr 3 value]</attr_3>
    </attributes>

## Example: Use `name_attr`

    <DOCUMENT ...>
       <attributes>
          <_ATTRS attr_pattern="attr *" node_name="attr" name_attr="name"/>
       </attributes>
    </DOCUMENT>

Result

    <attributes>
       <attr name="attr 1">[attr 1 value]</attr>
       <attr name="attr 2">[attr 2 value]</attr>
       <attr name="attr 3">[attr 3 value]</attr>
    </attributes>

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm