LibraryToggle FramesPrintFeedback

The otherAttributes member of the generated class expects to be populated with a Map object. The map is keyed using QNames. Once you get the map , you can access any attributes set on the object and set new attributes on the object.

Example 13.10 shows sample code for working with undeclared attributes.

Example 13.10. Working with Undeclared Attributes

Arbitter judge = new Arbitter();
Map<QName, String> otherAtts = judge.getOtherAttributes(); 1

QName at1 = new QName("test.apache.org", "house"); 2
QName at2 = new QName("test.apache.org", "veteran");

otherAtts.put(at1, "Cape"); 3
otherAtts.put(at2, "false");

String vetStatus = otherAtts.get(at2); 4

The code in Example 13.10 does the following:

1

Gets the map containing the undeclared attributes.

2

Creates QNames to work with the attributes.

3

Sets the values for the attributes into the map.

2

Retrieves the value for one of the attributes.

Comments powered by Disqus
loading table of contents...