version 1.110, 2005/03/09 21:02:26
|
version 1.111, 2005/03/15 05:41:45
|
|
|
// Convert the non-NULL string to a CIMObject (containing either a | // Convert the non-NULL string to a CIMObject (containing either a |
// CIMInstance or a CIMClass). | // CIMInstance or a CIMClass). |
| |
// First we need to create a new "temporary" XMLParser that is |
// First we need to create a new "temporary" XmlParser that is |
// just the value of the Embedded Object in String representation. | // just the value of the Embedded Object in String representation. |
char* tmp_buffer = new char[strlen(valueString) + 1]; | char* tmp_buffer = new char[strlen(valueString) + 1]; |
strcpy(tmp_buffer, valueString); | strcpy(tmp_buffer, valueString); |
XmlParser tmp_parser(tmp_buffer); | XmlParser tmp_parser(tmp_buffer); |
delete [] tmp_buffer; |
|
| |
// The next bit of logic constructs a CIMObject from the Embedded Object String. | // The next bit of logic constructs a CIMObject from the Embedded Object String. |
// It is similar to the method XmlReader::getValueObjectElement(). | // It is similar to the method XmlReader::getValueObjectElement(). |
|
|
throw XmlValidationError(lineNumber, mlParms); | throw XmlValidationError(lineNumber, mlParms); |
| |
} | } |
|
// Ok, now we can delete the storage for the temporary XmlParser. |
|
delete [] tmp_buffer; |
} | } |
return CIMValue(x); | return CIMValue(x); |
} | } |
|
|
| |
XmlEntry entry; | XmlEntry entry; |
if (!testStartTagOrEmptyTag(parser, entry, "VALUE")) | if (!testStartTagOrEmptyTag(parser, entry, "VALUE")) |
return false; |
|
|
|
Boolean empty = entry.type == XmlEntry::EMPTY_TAG; |
|
|
|
// Since stringToValue() takes a char* as input, we handle CIMTYPE_OBJECT separately. |
|
if (type == CIMTYPE_OBJECT) |
|
{ |
|
CIMObject cimObject; |
|
|
|
if (empty) |
|
{ |
|
cimObject = CIMObject(); |
|
} |
|
else |
|
{ |
|
// Convert the non-empty value to a CIMObject (containing either a |
|
// CIMInstance or a CIMClass). |
|
|
|
// The next bit of logic constructs a CIMObject from the Embedded Object String. |
|
// It is similar to the method XmlReader::getValueObjectElement(). |
|
CIMInstance cimInstance; |
|
CIMClass cimClass; |
|
|
|
if (XmlReader::getInstanceElement(parser, cimInstance)) |
|
{ |
|
cimObject = CIMObject(cimInstance); |
|
} |
|
else if (XmlReader::getClassElement(parser, cimClass)) |
|
{ | { |
cimObject = CIMObject(cimClass); |
return false; |
} | } |
else |
|
{ |
|
// l10n |
|
|
|
// throw XmlValidationError(parser.getLine(), |
|
// "Expected INSTANCE or CLASS element"); |
|
| |
MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT", |
Boolean empty = entry.type == XmlEntry::EMPTY_TAG; |
"Expected INSTANCE or CLASS element"); // change "element" to "embedded object" |
|
| |
throw XmlValidationError(parser.getLine(), mlParms); |
|
} |
|
expectEndTag(parser, "VALUE"); |
|
} |
|
value = CIMValue(cimObject); |
|
} |
|
else |
|
{ |
|
const char* valueString = ""; | const char* valueString = ""; |
| |
if (!empty) | if (!empty) |
{ | { |
if (testContentOrCData(parser, entry)) | if (testContentOrCData(parser, entry)) |
|
{ |
valueString = entry.text; | valueString = entry.text; |
|
} |
| |
expectEndTag(parser, "VALUE"); | expectEndTag(parser, "VALUE"); |
} | } |
|
|
if (!empty) | if (!empty) |
#endif | #endif |
value = stringToValue(parser.getLine(), valueString,type); | value = stringToValue(parser.getLine(), valueString,type); |
} |
|
| |
return true; | return true; |
} | } |
|
|
// Get VALUE.ARRAY open tag: | // Get VALUE.ARRAY open tag: |
| |
XmlEntry entry; | XmlEntry entry; |
|
Array<const char*> stringArray; |
| |
// If no VALUE.ARRAY start tag, return false | // If no VALUE.ARRAY start tag, return false |
if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY")) | if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY")) |
|
|
| |
if (entry.type != XmlEntry::EMPTY_TAG) | if (entry.type != XmlEntry::EMPTY_TAG) |
{ | { |
if (type == CIMTYPE_OBJECT) |
|
{ |
|
Array<CIMObject> objectArray; |
|
|
|
// For each VALUE element: | // For each VALUE element: |
while (testStartTagOrEmptyTag(parser, entry, "VALUE")) |
|
{ |
|
CIMObject cimObject; |
|
|
|
if (entry.type == XmlEntry::EMPTY_TAG) |
|
{ |
|
cimObject = CIMObject(); |
|
} |
|
else |
|
{ |
|
// Convert the non-empty value to a CIMObject (containing either a |
|
// CIMInstance or a CIMClass). |
|
| |
// The next bit of logic constructs a CIMObject from the Embedded Object String. |
|
// It is similar to the method XmlReader::getValueObjectElement(). |
|
CIMInstance cimInstance; |
|
CIMClass cimClass; |
|
|
|
if (XmlReader::getInstanceElement(parser, cimInstance)) |
|
{ |
|
cimObject = CIMObject(cimInstance); |
|
} |
|
else if (XmlReader::getClassElement(parser, cimClass)) |
|
{ |
|
cimObject = CIMObject(cimClass); |
|
} |
|
else |
|
{ |
|
// l10n |
|
|
|
// throw XmlValidationError(parser.getLine(), |
|
// "Expected INSTANCE or CLASS element"); |
|
|
|
MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT", |
|
"Expected INSTANCE or CLASS element"); // change "element" to "embedded object" |
|
|
|
throw XmlValidationError(parser.getLine(), mlParms); |
|
} |
|
expectEndTag(parser, "VALUE"); |
|
} |
|
objectArray.append(cimObject); |
|
} |
|
value = CIMValue(objectArray); |
|
} |
|
else |
|
{ |
|
Array<const char*> stringArray; |
|
|
|
// For each VALUE element: |
|
while (testStartTagOrEmptyTag(parser, entry, "VALUE")) | while (testStartTagOrEmptyTag(parser, entry, "VALUE")) |
{ | { |
if (entry.type == XmlEntry::EMPTY_TAG) | if (entry.type == XmlEntry::EMPTY_TAG) |
|
|
| |
expectEndTag(parser, "VALUE"); | expectEndTag(parser, "VALUE"); |
} | } |
value = stringArrayToValue(parser.getLine(), stringArray, type); |
|
} |
|
| |
expectEndTag(parser, "VALUE.ARRAY"); | expectEndTag(parser, "VALUE.ARRAY"); |
} | } |
| |
|
value = stringArrayToValue(parser.getLine(), stringArray, type); |
return true; | return true; |
} | } |
| |
|
|
new_property.addQualifier(property.getQualifier(ix)); | new_property.addQualifier(property.getQualifier(ix)); |
} | } |
| |
value = new_value; // does this leak? |
value = new_value; |
property = new_property; // does this leak? |
property = new_property; |
} | } |
else | else |
{ | { |
|
|
new_property.addQualifier(property.getQualifier(ix)); | new_property.addQualifier(property.getQualifier(ix)); |
} | } |
| |
value = new_value; // does this leak? |
value = new_value; |
property = new_property; // does this leak? |
property = new_property; |
} | } |
else | else |
{ | { |