Hook Output for ‘anyType’ Attribute Implementations
In an on get hook or on set hook for an 'anyType', either the 'isSet' must be set to false and the output must be 0, or the isSet must be true and the output must contain a valid XML where the top-level node uses the attribute name.
For example, in the BID an attribute group 'Group' contains an anyType attribute 'Attribute'. Let’s assume in the BII an on get hook exists for the corresponding Group_Attribute attribute implementation.
In that case the on get hook will have the following parameters:
- ref boolean io.Group_Attribute.isSet (default is true)
- ref long o.Group_Attribute
The following table shows examples of valid and invalid combinations for on get hooks for the Group_Attribute attribute implementation.
Valid | Invalid |
---|---|
io.Group_Attribute.isSet = false o.Group_Attribute = 0 | o.Group_Attribute = 0 |
o.Group_Attribute = xmlNewNode("Attribute") | io.Group_Attribute.isSet = false o.Group_Attribute = xmlNewNode("Attribute") |
o.Group_Attribute = xmlReadFromString("<Attribute><aGroup>” & “<value1>x</value1></aGroup>” & “<value2>y</value2></Attribute>", error.string) | o.Group_Attribute = xmlNewNode("aNode") |
(Of course the hook must also include error handling where applicable and a return statement, as usual.)
If the on get hook returns the following XML in o.Group_Attribute:
<Attribute>
<aGroup>
<value1>x</value1>
</aGroup>
<value2>y</value2>
</Attribute>
then the 'Group' element in the response or event will contain that XML. So the top-level node from the on get hook will be the node representing the ‘anyType’ attribute.