);
XSDHelper xsdHelper = getScope().getXSDHelper();
incrementIndent();
for(Iterator it=dataObject.getInstanceProperties().iterator(); it.hasNext();) {
Property property = (Property)it.next();
if (xsdHelper.isAttribute(property)) {
indent();
buf.append("Property (XML Attribute): ").append(property.getName()).append(" - ").append(dataObject.get(property));
lineBreak();
}
}
decrementIndent();
Sequence seq = dataObject.getSequence();
commentary(
"The Property/Value pairs of a Sequence can be accessed via the getProperty(int) and getValue(int)\n"
+ "accessor methods of the Sequence interface. The size() method of the Sequence tells us how many there are.\n"
+ "If the getProperty(int) method retunes null, then the value is text. These text values may be encountered\n"
+ "when the DataObject's type is 'mixed' (dataObject.getType().isMixed() == true). A typical example of this\n"
+ "is when the data graph represents a form letter.",
"Inspecting the Property/Value pairs of another Sequence");
incrementIndent();
indent();
buf.append("Sequence: {\n");
incrementIndent();
for (int i = 0; i < seq.size(); i++) {
Property p = seq.getProperty(i);
if (p == null) {
indent();
buf.append("text: ").append(seq.getValue(i));
lineBreak();
} else if(!xsdHelper.isAttribute(p)){
printPropertyValuePair(p, seq.getValue(i));
}
}
decrementIndent();
indent();
buf.append("}\n");
decrementIndent();
} else {
incrementIndent();
commentary(
COMMENTARY_FOR_INTERMEDIATE,
"We access the Property values of this DataObject by first getting the list of 'Instance Properties'\n"
+ "from the DataObject. For many DataObjects, this will be the same set of Properties that are defined\n"
+ "by the DataObject's Type. However, if the DataObject's type is 'Open' then an instance of that Type\n"
+ "may contain more Properties than the type itself. The list of Instance Properties will always include\n"
+ "the Properties defined in the Type, but will also include any Properties that the instance has values for\n"
+ "by virtue of it's type being 'Open'\n\n"
+ "for (int i = 0; i < dataObject.getInstanceProperties().size(); i++) {\n"
+ " Property p = (Property) dataObject.getInstanceProperties().get(i);",
"Traversing the instance Properties of this DataObject\n"
+ "for (int i = 0; i < dataObject.getInstanceProperties().size(); i++) {\n"
+ " Property p = (Property) dataObject.getInstanceProperties().get(i);"
);
for (int i = 0; i < dataObject.getInstanceProperties().size(); i++) {
Property p = (Property) dataObject.getInstanceProperties().get(i);
indent();
printValueOfProperty(dataObject, p);
}
decrementIndent();