version 1.3, 2001/02/19 01:47:16
|
version 1.9, 2001/04/25 22:20:56
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM | // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// | // |
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. |
// | // |
//END_LICENSE |
//============================================================================== |
//BEGIN_HISTORY |
|
// | // |
// Author: |
// Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// $Log$ |
// Modified By: |
// Revision 1.3 2001/02/19 01:47:16 mike |
|
// Renamed names of the form CIMConst to ConstCIM. |
|
// | // |
// Revision 1.2 2001/02/16 02:06:07 mike |
//%///////////////////////////////////////////////////////////////////////////// |
// Renamed many classes and headers. |
|
// |
|
// Revision 1.1.1.1 2001/01/14 19:53:32 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
| |
#include <cassert> | #include <cassert> |
#include <cctype> | #include <cctype> |
|
|
#include "CIMInstance.h" | #include "CIMInstance.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
//debug |
|
#include <iostream> |
|
using namespace std; |
| |
static const Uint32 MESSAGE_SIZE = 128; | static const Uint32 MESSAGE_SIZE = 128; |
| |
|
|
// Get VALUE start tag: | // Get VALUE start tag: |
| |
XmlEntry entry; | XmlEntry entry; |
|
|
if (!testStartTagOrEmptyTag(parser, entry, "VALUE")) | if (!testStartTagOrEmptyTag(parser, entry, "VALUE")) |
return false; | return false; |
| |
|
|
// Get VALUE content: | // Get VALUE content: |
| |
const char* valueString = ""; | const char* valueString = ""; |
|
// cout << "DEBUG XMLReader:getValueElement " << __LINE__ ; |
| |
if (!empty) | if (!empty) |
{ | { |
if (testContentOrCData(parser, entry)) | if (testContentOrCData(parser, entry)) |
valueString = entry.text; | valueString = entry.text; |
|
//cout << "DEBUG XMLReader:getValueElement " << __LINE__ |
|
// << " valueString " << valueString ; |
| |
expectEndTag(parser, "VALUE"); | expectEndTag(parser, "VALUE"); |
} | } |
| |
value = stringToValue(parser.getLine(), valueString,type); | value = stringToValue(parser.getLine(), valueString,type); |
|
//cout << "DEBUG XMLReader:getValueElement " << __LINE__ |
|
// << " value " << value; |
|
return true; |
|
} |
|
|
|
|
|
//---------------------------------------------------------------------------- |
|
// |
|
// getPropertyValue |
|
// Use: Decode property value from getPropertyResponse |
|
// Expect (ERROR|IRETURNVALUE).!ELEMENT VALUE (#PCDATA)> |
|
// |
|
// PropertyValue: |
|
// <!ELEMENT VALUE> |
|
// |
|
// <!ELEMENT VALUE.ARRAY (VALUE*)> |
|
// |
|
// <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME| |
|
// INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)> |
|
// |
|
//---------------------------------------------------------------------------- |
|
Boolean XmlReader::getPropertyValue( |
|
XmlParser& parser, |
|
CIMValue& cimValue) |
|
{ |
|
//Test for Element value type |
|
CIMType type = CIMType::STRING; |
|
|
|
if (XmlReader::getValueElement(parser, type, cimValue)) |
|
{ |
|
//cout << "DEBUG xmlReader::getPropertyValue " << __LINE__ |
|
// << " CimValue = " << cimValue.toString << endl; |
return true; | return true; |
} | } |
| |
|
//Test for Element.array value |
|
if(XmlReader::getValueArrayElement(parser, type, cimValue)) |
|
return true; |
|
|
|
// Test for Value.reference type |
|
// ATTN:This returns a different type (CIMReference) |
|
// ATTN: Possibly change to simply return result after |
|
// we figure out the type differences. |
|
|
|
CIMReference reference; |
|
if(XmlReader::getValueReferenceElement(parser, reference)) |
|
return true; |
|
|
|
return false; |
|
} |
|
|
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// stringArrayToValue() | // stringArrayToValue() |
|
|
if (!entry.getAttributeValue("VALUETYPE", tmp)) | if (!entry.getAttributeValue("VALUETYPE", tmp)) |
return KeyBinding::STRING; | return KeyBinding::STRING; |
| |
if (tmp == "string") |
if (String::equal(tmp, "string")) |
return KeyBinding::STRING; | return KeyBinding::STRING; |
else if (tmp == "boolean") |
else if (String::equal(tmp, "boolean")) |
return KeyBinding::BOOLEAN; | return KeyBinding::BOOLEAN; |
else if (tmp == "numeric") |
else if (String::equal(tmp, "numeric")) |
return KeyBinding::NUMERIC; | return KeyBinding::NUMERIC; |
| |
char buffer[MESSAGE_SIZE]; | char buffer[MESSAGE_SIZE]; |
|
|
return true; | return true; |
} | } |
| |
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// getErrorElement() | // getErrorElement() |
|
|
| |
Boolean XmlReader::getErrorElement( | Boolean XmlReader::getErrorElement( |
XmlParser& parser, | XmlParser& parser, |
CimException::Code& code, |
CIMException::Code& code, |
const char*& description, | const char*& description, |
Boolean required) | Boolean required) |
{ | { |
|
|
throw XmlValidationError( | throw XmlValidationError( |
parser.getLine(), "missing ERROR.CODE attribute"); | parser.getLine(), "missing ERROR.CODE attribute"); |
| |
code = CimException::Code(tmpCode); |
code = CIMException::Code(tmpCode); |
| |
// Get ERROR.DESCRIPTION: | // Get ERROR.DESCRIPTION: |
| |