(file) Return to XmlReader.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlReader.cpp between version 1.24.2.7 and 1.77

version 1.24.2.7, 2001/11/08 23:15:30 version 1.77, 2002/10/02 22:40:34
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
 // The Open Group, Tivoli Systems // The Open Group, Tivoli Systems
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
Line 25 
Line 25 
 // //
 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 //              (carolann_graves@hp.com) //              (carolann_graves@hp.com)
 //  
 //              Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) //              Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
   //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
   #include <Pegasus/Common/Config.h>
 #include <cassert>  
 #include <cctype> #include <cctype>
 #include <cstdio> #include <cstdio>
 #include <cstdlib> #include <cstdlib>
   #if defined(PEGASUS_OS_TYPE_UNIX)
   #include <errno.h>
   #endif
 #include "CIMName.h" #include "CIMName.h"
 #include "XmlReader.h" #include "XmlReader.h"
 #include "XmlWriter.h" #include "XmlWriter.h"
Line 43 
Line 45 
 #include "CIMInstance.h" #include "CIMInstance.h"
 #include "CIMObject.h" #include "CIMObject.h"
 #include "CIMParamValue.h" #include "CIMParamValue.h"
   #include "System.h"
   
   #define PEGASUS_SINT64_MIN (-PEGASUS_SINT64_LITERAL(0x8000000000000000))
   #define PEGASUS_UINT64_MAX PEGASUS_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF)
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 51 
Line 57 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // expectXmlDeclaration()  // getXmlDeclaration()
   //
   //     <?xml version="1.0" encoding="utf-8"?>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlReader::expectXmlDeclaration(  void XmlReader::getXmlDeclaration(
     XmlParser& parser,     XmlParser& parser,
     XmlEntry& entry)      const char*& xmlVersion,
       const char*& xmlEncoding)
 { {
       XmlEntry entry;
   
     if (!parser.next(entry) ||     if (!parser.next(entry) ||
         entry.type != XmlEntry::XML_DECLARATION ||         entry.type != XmlEntry::XML_DECLARATION ||
         strcmp(entry.text, "xml") != 0)         strcmp(entry.text, "xml") != 0)
Line 66 
Line 77 
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Expected <?xml ... ?> style declaration");             "Expected <?xml ... ?> style declaration");
     }     }
   
       if (!entry.getAttributeValue("version", xmlVersion))
           throw XmlValidationError(
               parser.getLine(), "missing xml.version attribute");
   
       if (!entry.getAttributeValue("encoding", xmlEncoding))
       {
           // ATTN-RK-P3-20020403:  Is there a default encoding?
       }
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 199 
Line 219 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // testEndTag>()  // testEndTag()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
Line 264 
Line 284 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // testCimStartTag()  // getCimStartTag()
 // //
 //     <!ELEMENT CIM (MESSAGE|DECLARATION)> //     <!ELEMENT CIM (MESSAGE|DECLARATION)>
 //     <!ATTRLIST CIM //     <!ATTRLIST CIM
Line 273 
Line 293 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlReader::testCimStartTag(XmlParser& parser)  void XmlReader::getCimStartTag(
       XmlParser& parser,
       const char*& cimVersion,
       const char*& dtdVersion)
 { {
     XmlEntry entry;     XmlEntry entry;
     XmlReader::expectStartTag(parser, entry, "CIM");     XmlReader::expectStartTag(parser, entry, "CIM");
  
     const char* cimVersion;  
   
     if (!entry.getAttributeValue("CIMVERSION", cimVersion))     if (!entry.getAttributeValue("CIMVERSION", cimVersion))
         throw XmlValidationError(         throw XmlValidationError(
             parser.getLine(), "missing CIM.CIMVERSION attribute");             parser.getLine(), "missing CIM.CIMVERSION attribute");
  
     if (strcmp(cimVersion, "2.0") != 0)  
         throw XmlValidationError(parser.getLine(),  
             "CIM.CIMVERSION attribute must be \"2.0\"");  
   
     const char* dtdVersion;  
   
     if (!entry.getAttributeValue("DTDVERSION", dtdVersion))     if (!entry.getAttributeValue("DTDVERSION", dtdVersion))
         throw XmlValidationError(         throw XmlValidationError(
             parser.getLine(), "missing CIM.DTDVERSION attribute");             parser.getLine(), "missing CIM.DTDVERSION attribute");
   
     if (strcmp(dtdVersion, "2.0") != 0)  
         throw XmlValidationError(parser.getLine(),  
             "CIM.DTDVERSION attribute must be \"2.0\"");  
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 307 
Line 318 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getCimNameAttribute(  CIMName XmlReader::getCimNameAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName,     const char* elementName,
Line 323 
Line 334 
     }     }
  
     if (acceptNull && name.size() == 0)     if (acceptNull && name.size() == 0)
         return name;          return CIMName ();
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
Line 332 
Line 343 
         throw XmlSemanticError(lineNumber, buffer);         throw XmlSemanticError(lineNumber, buffer);
     }     }
  
     return name;      return CIMName (name);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 376 
Line 387 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getClassOriginAttribute(  CIMName XmlReader::getClassOriginAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* tagName)     const char* tagName)
Line 384 
Line 395 
     String name;     String name;
  
     if (!entry.getAttributeValue("CLASSORIGIN", name))     if (!entry.getAttributeValue("CLASSORIGIN", name))
         return String();          return CIMName();
   
       // KS 200209 This may be temp but we are adding test for form
       // CLASSNAME = "" for Wbemservices interoperability.  Returns same
       // as if attribute did not exist.
       if (name.size() == 0)
           return CIMName();
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
Line 405 
Line 422 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getReferenceClassAttribute(  CIMName XmlReader::getReferenceClassAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
Line 413 
Line 430 
     String name;     String name;
  
     if (!entry.getAttributeValue("REFERENCECLASS", name))     if (!entry.getAttributeValue("REFERENCECLASS", name))
         return String();          return CIMName();
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
Line 434 
Line 451 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getSuperClassAttribute(  CIMName XmlReader::getSuperClassAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* tagName)     const char* tagName)
Line 442 
Line 459 
     String superClass;     String superClass;
  
     if (!entry.getAttributeValue("SUPERCLASS", superClass))     if (!entry.getAttributeValue("SUPERCLASS", superClass))
         return String();          return CIMName();
  
     if (!CIMName::legal(superClass))     if (!CIMName::legal(superClass))
     {     {
Line 459 
Line 476 
 // //
 // getCimTypeAttribute() // getCimTypeAttribute()
 // //
   // This method can be used to get a TYPE attribute or a PARAMTYPE attribute.
   // The only significant difference is that PARAMTYPE may specify a value of
   // "reference" type.  This method recognizes these attributes by name, and
   // does not allow a "TYPE" attribute to be of "reference" type.
   //
 //     <!ENTITY % CIMType "TYPE (boolean|string|char16|uint8|sint8|uint16 //     <!ENTITY % CIMType "TYPE (boolean|string|char16|uint8|sint8|uint16
 //         |sint16|uint32|sint32|uint64|sint64|datetime|real32|real64)"> //         |sint16|uint32|sint32|uint64|sint64|datetime|real32|real64)">
 // //
   //     <!ENTITY % ParamType "PARAMTYPE (boolean|string|char16|uint8|sint8
   //         |uint16|sint16|uint32|sint32|uint64|sint64|datetime|real32|real64
   //         |reference)">
   //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMType XmlReader::getCimTypeAttribute(  Boolean XmlReader::getCimTypeAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* tagName)      CIMType& cimType,  // Output parameter
       const char* tagName,
       const char* attributeName,
       Boolean required)
 { {
     const char* typeName;     const char* typeName;
  
     if (!entry.getAttributeValue("TYPE", typeName))      if (!entry.getAttributeValue(attributeName, typeName))
       {
           if (required)
     {     {
         char message[MESSAGE_SIZE];         char message[MESSAGE_SIZE];
         sprintf(message, "missing %s.TYPE attribute", tagName);              sprintf(message, "missing %s.%s attribute", tagName, attributeName);
         throw XmlValidationError(lineNumber, message);         throw XmlValidationError(lineNumber, message);
     }     }
           else
           {
               return false;
           }
       }
  
     CIMType type = CIMType::NONE;      CIMType type = CIMTYPE_BOOLEAN;
       Boolean unrecognizedType = false;
  
     if (strcmp(typeName, "boolean") == 0)     if (strcmp(typeName, "boolean") == 0)
         type = CIMType::BOOLEAN;          type = CIMTYPE_BOOLEAN;
     else if (strcmp(typeName, "string") == 0)     else if (strcmp(typeName, "string") == 0)
         type = CIMType::STRING;          type = CIMTYPE_STRING;
     else if (strcmp(typeName, "char16") == 0)     else if (strcmp(typeName, "char16") == 0)
         type = CIMType::CHAR16;          type = CIMTYPE_CHAR16;
     else if (strcmp(typeName, "uint8") == 0)     else if (strcmp(typeName, "uint8") == 0)
         type = CIMType::UINT8;          type = CIMTYPE_UINT8;
     else if (strcmp(typeName, "sint8") == 0)     else if (strcmp(typeName, "sint8") == 0)
         type = CIMType::SINT8;          type = CIMTYPE_SINT8;
     else if (strcmp(typeName, "uint16") == 0)     else if (strcmp(typeName, "uint16") == 0)
         type = CIMType::UINT16;          type = CIMTYPE_UINT16;
     else if (strcmp(typeName, "sint16") == 0)     else if (strcmp(typeName, "sint16") == 0)
         type = CIMType::SINT16;          type = CIMTYPE_SINT16;
     else if (strcmp(typeName, "uint32") == 0)     else if (strcmp(typeName, "uint32") == 0)
         type = CIMType::UINT32;          type = CIMTYPE_UINT32;
     else if (strcmp(typeName, "sint32") == 0)     else if (strcmp(typeName, "sint32") == 0)
         type = CIMType::SINT32;          type = CIMTYPE_SINT32;
     else if (strcmp(typeName, "uint64") == 0)     else if (strcmp(typeName, "uint64") == 0)
         type = CIMType::UINT64;          type = CIMTYPE_UINT64;
     else if (strcmp(typeName, "sint64") == 0)     else if (strcmp(typeName, "sint64") == 0)
         type = CIMType::SINT64;          type = CIMTYPE_SINT64;
     else if (strcmp(typeName, "datetime") == 0)     else if (strcmp(typeName, "datetime") == 0)
         type = CIMType::DATETIME;          type = CIMTYPE_DATETIME;
     else if (strcmp(typeName, "real32") == 0)     else if (strcmp(typeName, "real32") == 0)
         type = CIMType::REAL32;          type = CIMTYPE_REAL32;
     else if (strcmp(typeName, "real64") == 0)     else if (strcmp(typeName, "real64") == 0)
         type = CIMType::REAL64;          type = CIMTYPE_REAL64;
       else if (strcmp(typeName, "reference") == 0)
     if (type == CIMType::NONE)          type = CIMTYPE_REFERENCE;
       else unrecognizedType = true;
   
       if (unrecognizedType ||
           ((type == CIMTYPE_REFERENCE) &&
            (strcmp(attributeName, "PARAMTYPE") != 0)))
     {     {
         char message[MESSAGE_SIZE];         char message[MESSAGE_SIZE];
         sprintf(message, "Illegal value for %s.TYPE attribute", tagName);          sprintf(message, "Illegal value for %s.%s attribute", tagName,
                   attributeName);
         throw XmlSemanticError(lineNumber, message);         throw XmlSemanticError(lineNumber, message);
     }     }
  
     return type;      cimType = type;
       return true;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 553 
Line 597 
         return false;         return false;
  
     char buffer[62];     char buffer[62];
     sprintf(buffer, "Bad %s.%s attribute value", attributeName, tagName);      sprintf(buffer, "Invalid %s.%s attribute value", attributeName, tagName);
     throw XmlSemanticError(lineNumber, buffer);     throw XmlSemanticError(lineNumber, buffer);
     return false;     return false;
 } }
Line 569 
Line 613 
  
 Boolean XmlReader::stringToReal(const char* stringValue, Real64& x) Boolean XmlReader::stringToReal(const char* stringValue, Real64& x)
 { {
       //
       // Check the string against the DMTF-defined grammar
       //
     const char* p = stringValue;     const char* p = stringValue;
  
     if (!*p)     if (!*p)
Line 625 
Line 672 
     if (*p)     if (*p)
         return false;         return false;
  
       //
       // Do the conversion
       //
     char* end;     char* end;
       errno = 0;
     x = strtod(stringValue, &end);     x = strtod(stringValue, &end);
       if (*end || (errno == ERANGE))
       {
           return false;
       }
   
     return true;     return true;
 } }
  
   inline Uint8 _hexCharToNumeric(const char c)
   {
       Uint8 n;
   
       if (isdigit(c))
           n = (c - '0');
       else if (isupper(c))
           n = (c - 'A' + 10);
       else // if (islower(c))
           n = (c - 'a' + 10);
   
       return n;
   }
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // stringToSignedInteger // stringToSignedInteger
 // //
 //      [ "+" | "-" ] ( positiveDecimalDigit *decimalDigit | "0" ) //      [ "+" | "-" ] ( positiveDecimalDigit *decimalDigit | "0" )
   //    or
   //      [ "+" | "-" ] ( "0x" | "0X" ) 1*hexDigit
 // //
 // ATTN-B: handle conversion from hexadecimal.  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::stringToSignedInteger( Boolean XmlReader::stringToSignedInteger(
Line 646 
Line 717 
     x = 0;     x = 0;
     const char* p = stringValue;     const char* p = stringValue;
  
     if (!*p)      if (!p || !*p)
         return false;         return false;
  
     // Skip optional sign:     // Skip optional sign:
Line 656 
Line 727 
     if (negative || *p == '+')     if (negative || *p == '+')
         p++;         p++;
  
     // If the next thing is a zero, then it must be the last:  
   
     if (*p == '0')     if (*p == '0')
         return p[1] == '\0';      {
           if ( (p[1] == 'x') || (p[1] == 'X') )
     // Expect a positive decimal digit:          {
               // Convert a hexadecimal string
  
     const char* first = p;              // Skip over the "0x"
               p+=2;
  
     if (!isdigit(*p) || *p == '0')              // At least one hexadecimal digit is required
               if (!isxdigit(*p))
         return false;         return false;
  
     p++;              // Build the Sint64 as a negative number, regardless of the
               // eventual sign (negative numbers can be bigger than positive ones)
  
     // Expect zero or more digits:              // Add on each digit, checking for overflow errors
               while (isxdigit(*p))
               {
                   // Make sure we won't overflow when we multiply by 16
                   if (x < PEGASUS_SINT64_MIN/16)
                   {
                       return false;
                   }
                   x = x << 4;
  
     while (isdigit(*p))                  // Make sure we don't overflow when we add the next digit
         p++;                  Sint64 newDigit = Sint64(_hexCharToNumeric(*p++));
                   if (PEGASUS_SINT64_MIN - x > -newDigit)
                   {
                       return false;
                   }
                   x = x - newDigit;
               }
  
               // If we found a non-hexadecimal digit, report an error
     if (*p)     if (*p)
         return false;         return false;
  
     const char* last = p;              // Return the integer to positive, if necessary, checking for an
               // overflow error
               if (!negative)
               {
                   if (x == PEGASUS_SINT64_MIN)
                   {
                       return false;
                   }
                   x = -x;
               }
               return true;
           }
           else
           {
               // A decimal string that starts with '0' must be exactly "0".
               return p[1] == '\0';
           }
       }
  
     while (first != last)      // Expect a positive decimal digit:
         x = 10 * x + (*first++ - '0');  
  
     if (negative)      // At least one decimal digit is required
         x = -x;      if (!isdigit(*p))
           return false;
   
       // Build the Sint64 as a negative number, regardless of the
       // eventual sign (negative numbers can be bigger than positive ones)
  
       // Add on each digit, checking for overflow errors
       while (isdigit(*p))
       {
           // Make sure we won't overflow when we multiply by 10
           if (x < PEGASUS_SINT64_MIN/10)
           {
               return false;
           }
           x = 10 * x;
   
           // Make sure we won't overflow when we add the next digit
           Sint64 newDigit = (*p++ - '0');
           if (PEGASUS_SINT64_MIN - x > -newDigit)
           {
               return false;
           }
           x = x - newDigit;
       }
   
       // If we found a non-decimal digit, report an error
       if (*p)
           return false;
   
       // Return the integer to positive, if necessary, checking for an
       // overflow error
       if (!negative)
       {
           if (x == PEGASUS_SINT64_MIN)
           {
               return false;
           }
           x = -x;
       }
     return true;     return true;
 } }
  
Line 693 
Line 834 
 // //
 // stringToUnsignedInteger // stringToUnsignedInteger
 // //
 //      [ "+" | "-" ] ( positiveDecimalDigit *decimalDigit | "0" )  //      ( positiveDecimalDigit *decimalDigit | "0" )
   //    or
   //      ( "0x" | "0X" ) 1*hexDigit
 // //
 // ATTN-B: handle conversion from hexadecimal.  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::stringToUnsignedInteger( Boolean XmlReader::stringToUnsignedInteger(
Line 705 
Line 847 
     x = 0;     x = 0;
     const char* p = stringValue;     const char* p = stringValue;
  
     if (!*p)      if (!p || !*p)
         return false;         return false;
  
     // Skip optional sign:      if (*p == '0')
       {
           if ( (p[1] == 'x') || (p[1] == 'X') )
           {
               // Convert a hexadecimal string
  
     if (*p == '-')              // Skip over the "0x"
               p+=2;
   
               // At least one hexadecimal digit is required
               if (!*p)
         return false;         return false;
  
     if (*p == '+')              // Add on each digit, checking for overflow errors
         p++;              while (isxdigit(*p))
               {
                   // Make sure we won't overflow when we multiply by 16
                   if (x > PEGASUS_UINT64_MAX/16)
                   {
                       return false;
                   }
                   x = x << 4;
   
                   // We can't overflow when we add the next digit
                   Uint64 newDigit = Uint64(_hexCharToNumeric(*p++));
                   if (PEGASUS_UINT64_MAX - x < newDigit)
                   {
                       return false;
                   }
                   x = x + newDigit;
               }
  
     // If the next thing is a zero, then it must be the last:              // If we found a non-hexadecimal digit, report an error
               if (*p)
                   return false;
  
     if (*p == '0')              return true;
           }
           else
           {
               // A decimal string that starts with '0' must be exactly "0".
         return p[1] == '\0';         return p[1] == '\0';
           }
       }
  
     // Expect a positive decimal digit:     // Expect a positive decimal digit:
  
     const char* first = p;      // Add on each digit, checking for overflow errors
       while (isdigit(*p))
     if (!isdigit(*p) || *p == '0')      {
           // Make sure we won't overflow when we multiply by 10
           if (x > PEGASUS_UINT64_MAX/10)
           {
         return false;         return false;
           }
           x = 10 * x;
  
     p++;          // Make sure we won't overflow when we add the next digit
           Uint64 newDigit = (*p++ - '0');
     // Expect zero or more digits:          if (PEGASUS_UINT64_MAX - x < newDigit)
           {
     while (isdigit(*p))              return false;
         p++;          }
           x = x + newDigit;
       }
  
       // If we found a non-decimal digit, report an error
     if (*p)     if (*p)
         return false;         return false;
  
     const char* last = p;  
   
     while (first != last)  
         x = 10 * x + (*first++ - '0');  
   
     return true;     return true;
 } }
  
Line 750 
Line 927 
 // //
 // stringToValue() // stringToValue()
 // //
 // ATTN-C: note that integers are truncated without warning. What should be  // Return: CIMValue. If the string input is zero length creates a CIMValue
 // done in this case? In C they are truncated without warning by design.  //         with value defined by the type.  Else the value is inserted.
   //
   //         Note that this does not set the CIMValue Null if the string is empty.
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
Line 762 
Line 941 
 { {
     // ATTN-B: accepting only UTF-8 for now! (affects string and char16):     // ATTN-B: accepting only UTF-8 for now! (affects string and char16):
  
     if (strlen(valueString)==0)      // Create value per type
     {  
         switch (type)         switch (type)
         {         {
             case CIMType::BOOLEAN: return CIMValue(false);          case CIMTYPE_BOOLEAN:
             case CIMType::STRING: return CIMValue(valueString);  
             case CIMType::CHAR16: return CIMValue(Char16('\0'));  
             case CIMType::UINT8: return CIMValue(Uint8(0));  
             case CIMType::UINT16: return CIMValue(Uint16(0));  
             case CIMType::UINT32: return CIMValue(Uint32(0));  
             case CIMType::UINT64: return CIMValue(Uint64(0));  
             case CIMType::SINT8: return CIMValue(Sint8(0));  
             case CIMType::SINT16: return CIMValue(Sint16(0));  
             case CIMType::SINT32: return CIMValue(Sint32(0));  
             case CIMType::SINT64: return CIMValue(Sint64(0));  
             case CIMType::REAL32: return CIMValue(Real32(0));  
             case CIMType::REAL64: return CIMValue(Real64(0));  
         }  
     }  
   
     switch (type)  
     {  
         case CIMType::BOOLEAN:  
         {         {
             if (CompareNoCase(valueString, "TRUE") == 0)              if (System::strcasecmp(valueString, "TRUE") == 0)
                 return CIMValue(true);                 return CIMValue(true);
             else if (CompareNoCase(valueString, "FALSE") == 0)              else if (System::strcasecmp(valueString, "FALSE") == 0)
                 return CIMValue(false);                 return CIMValue(false);
             else             else
                 throw XmlSemanticError(                 throw XmlSemanticError(
                     lineNumber, "Bad boolean value");                      lineNumber, "Invalid boolean value");
         }         }
  
         case CIMType::STRING:          case CIMTYPE_STRING:
         {         {
             return CIMValue(valueString);              return CIMValue(String(valueString));
         }         }
  
         case CIMType::CHAR16:          case CIMTYPE_CHAR16:
         {         {
             if (strlen(valueString) != 1)             if (strlen(valueString) != 1)
                 throw XmlSemanticError(lineNumber, "Bad char16 value");                  throw XmlSemanticError(lineNumber, "Invalid char16 value");
  
             return CIMValue(Char16(valueString[0]));             return CIMValue(Char16(valueString[0]));
         }         }
  
         case CIMType::UINT8:          case CIMTYPE_UINT8:
         case CIMType::UINT16:          case CIMTYPE_UINT16:
         case CIMType::UINT32:          case CIMTYPE_UINT32:
         case CIMType::UINT64:          case CIMTYPE_UINT64:
         {         {
             Uint64 x;             Uint64 x;
  
             if (!stringToUnsignedInteger(valueString, x))             if (!stringToUnsignedInteger(valueString, x))
             {             {
                 throw XmlSemanticError(                 throw XmlSemanticError(
                     lineNumber, "Bad unsigned integer value");                      lineNumber, "Invalid unsigned integer value");
             }             }
  
             switch (type)             switch (type)
             {             {
                 case CIMType::UINT8: return CIMValue(Uint8(x));                  case CIMTYPE_UINT8:
                 case CIMType::UINT16: return CIMValue(Uint16(x));                  {
                 case CIMType::UINT32: return CIMValue(Uint32(x));                      if (x >= (Uint64(1)<<8))
                 case CIMType::UINT64: return CIMValue(Uint64(x));                      {
                           throw XmlSemanticError(
                               lineNumber, "Uint8 value out of range");
                       }
                       return CIMValue(Uint8(x));
                   }
                   case CIMTYPE_UINT16:
                   {
                       if (x >= (Uint64(1)<<16))
                       {
                           throw XmlSemanticError(
                               lineNumber, "Uint16 value out of range");
                       }
                       return CIMValue(Uint16(x));
                   }
                   case CIMTYPE_UINT32:
                   {
                       if (x >= (Uint64(1)<<32))
                       {
                           throw XmlSemanticError(
                               lineNumber, "Uint32 value out of range");
                       }
                       return CIMValue(Uint32(x));
                   }
                   case CIMTYPE_UINT64: return CIMValue(Uint64(x));
                 default: break;                 default: break;
             }             }
         }         }
  
         case CIMType::SINT8:          case CIMTYPE_SINT8:
         case CIMType::SINT16:          case CIMTYPE_SINT16:
         case CIMType::SINT32:          case CIMTYPE_SINT32:
         case CIMType::SINT64:          case CIMTYPE_SINT64:
         {         {
             Sint64 x;             Sint64 x;
  
             if (!stringToSignedInteger(valueString, x))             if (!stringToSignedInteger(valueString, x))
             {             {
                 throw XmlSemanticError(                 throw XmlSemanticError(
                     lineNumber, "Bad signed integer value");                      lineNumber, "Invalid signed integer value");
             }             }
  
             switch (type)             switch (type)
             {             {
                 case CIMType::SINT8: return CIMValue(Sint8(x));                  case CIMTYPE_SINT8:
                 case CIMType::SINT16: return CIMValue(Sint16(x));                  {
                 case CIMType::SINT32: return CIMValue(Sint32(x));                      if(  (x >= (Sint64(1)<<7)) || (x < (-(Sint64(1)<<7))) )
                 case CIMType::SINT64: return CIMValue(Sint64(x));                      {
                           throw XmlSemanticError(
                               lineNumber, "Sint8 value out of range");
                       }
                       return CIMValue(Sint8(x));
                   }
                   case CIMTYPE_SINT16:
                   {
                       if(  (x >= (Sint64(1)<<15)) || (x < (-(Sint64(1)<<15))) )
                       {
                           throw XmlSemanticError(
                               lineNumber, "Sint16 value out of range");
                       }
                       return CIMValue(Sint16(x));
                   }
                   case CIMTYPE_SINT32:
                   {
                       if(  (x >= (Sint64(1)<<31)) || (x < (-(Sint64(1)<<31))) )
                       {
                           throw XmlSemanticError(
                               lineNumber, "Sint32 value out of range");
                       }
                       return CIMValue(Sint32(x));
                   }
                   case CIMTYPE_SINT64: return CIMValue(Sint64(x));
                 default: break;                 default: break;
             }             }
         }         }
  
         case CIMType::DATETIME:          case CIMTYPE_DATETIME:
         {         {
             CIMDateTime tmp;             CIMDateTime tmp;
  
             try             try
             {             {
               // KS 20021002 - Exception if no datatime value. Test for
               // zero length and leave the NULL value in the variable
               // Bugzilla 137  Adds the following if line.
   #ifdef PEGASUS_SNIA_INTEROP_TEST
               if (strlen(valueString) != 0)
   #endif
                 tmp.set(valueString);                 tmp.set(valueString);
             }             }
             catch (BadDateTimeFormat&)              catch (InvalidDateTimeFormatException&)
             {             {
                 throw XmlSemanticError(lineNumber, "Bad datetime value");              throw XmlSemanticError(lineNumber, "Invalid datetime value");
             }             }
  
             return CIMValue(tmp);             return CIMValue(tmp);
         }         }
  
         case CIMType::REAL32:          case CIMTYPE_REAL32:
         {         {
             Real64 x;             Real64 x;
  
             if (!stringToReal(valueString, x))             if (!stringToReal(valueString, x))
                 throw XmlSemanticError(lineNumber, "Bad real value");                  throw XmlSemanticError(lineNumber, "Invalid real number value");
  
             return CIMValue(Real32(x));             return CIMValue(Real32(x));
         }         }
  
         case CIMType::REAL64:          case CIMTYPE_REAL64:
         {         {
             Real64 x;             Real64 x;
  
             if (!stringToReal(valueString, x))             if (!stringToReal(valueString, x))
                 throw XmlSemanticError(lineNumber, "Bad real value");                  throw XmlSemanticError(lineNumber, "Invalid real number value");
  
             return CIMValue(x);             return CIMValue(x);
         }         }
Line 904 
Line 1118 
 // //
 //     <!ELEMENT VALUE (#PCDATA)> //     <!ELEMENT VALUE (#PCDATA)>
 // //
   // Return: false if no value element.
   //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::getValueElement( Boolean XmlReader::getValueElement(
Line 911 
Line 1127 
     CIMType type,     CIMType type,
     CIMValue& value)     CIMValue& value)
 { {
     // Get VALUE start tag:      // Get VALUE start tag: Return false if no VALUE start Tag
  
     XmlEntry entry;     XmlEntry entry;
     if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))
Line 975 
Line 1191 
 //---------------------------------------------------------------------------- //----------------------------------------------------------------------------
 // //
 // getPropertyValue // getPropertyValue
 //     Use: Decode property value from getPropertyResponse  //     Use: Decode property value from SetProperty request and
 //     Expect (ERROR|IRETURNVALUE).!ELEMENT VALUE (#PCDATA)>  //     GetProperty response.
   //
   //     PropertyValue is one of:
 // //
 //      PropertyValue:  
 //      <!ELEMENT VALUE>  
 // //
 //      <!ELEMENT VALUE.ARRAY (VALUE*)> //      <!ELEMENT VALUE.ARRAY (VALUE*)>
 // //
 //      <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME| //      <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME|
   //         <!ELEMENT VALUE.ARRAY (VALUE*)>
   //
   //         <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME|
 //                           INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)> //                           INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)>
 // //
   //         <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE*)>
   //
 //---------------------------------------------------------------------------- //----------------------------------------------------------------------------
 Boolean XmlReader::getPropertyValue( Boolean XmlReader::getPropertyValue(
     XmlParser& parser,     XmlParser& parser,
     CIMValue& cimValue)     CIMValue& cimValue)
 { {
     //ATTN: Test for Element value type      // Can not test for value type, so assume String
     CIMType type = CIMType::STRING;      const CIMType type = CIMTYPE_STRING;
  
       // Test for VALUE element
     if (XmlReader::getValueElement(parser, type, cimValue))     if (XmlReader::getValueElement(parser, type, cimValue))
     {     {
         //cout << "DEBUG xmlReader::getPropertyValue " << __LINE__  
         //    << " CimValue = " << cimValue.toString << endl;  
         return true;         return true;
     }     }
  
     //Test for Element.array value      // Test for VALUE.ARRAY element
     if(XmlReader::getValueArrayElement(parser, type, cimValue))     if(XmlReader::getValueArrayElement(parser, type, cimValue))
       {
        return true;        return true;
       }
  
     // Test for Value.reference type      // Test for VALUE.REFERENCE element
     CIMReference reference;      CIMObjectPath reference;
     if(XmlReader::getValueReferenceElement(parser, reference))     if(XmlReader::getValueReferenceElement(parser, reference))
     {     {
         cimValue.set(reference);         cimValue.set(reference);
         return true;         return true;
     }     }
  
       // Test for VALUE.REFARRAY element
       if (XmlReader::getValueReferenceArrayElement(parser, cimValue))
       {
          return true;
       }
   
    return false;    return false;
 } }
  
Line 1051 
Line 1279 
 { {
     switch (type)     switch (type)
     {     {
         case CIMType::BOOLEAN:          case CIMTYPE_BOOLEAN:
             return StringArrayToValueAux(lineNumber, array, type, (Boolean*)0);             return StringArrayToValueAux(lineNumber, array, type, (Boolean*)0);
  
         case CIMType::STRING:          case CIMTYPE_STRING:
             return StringArrayToValueAux(lineNumber, array, type, (String*)0);             return StringArrayToValueAux(lineNumber, array, type, (String*)0);
  
         case CIMType::CHAR16:          case CIMTYPE_CHAR16:
             return StringArrayToValueAux(lineNumber, array, type, (Char16*)0);             return StringArrayToValueAux(lineNumber, array, type, (Char16*)0);
  
         case CIMType::UINT8:          case CIMTYPE_UINT8:
             return StringArrayToValueAux(lineNumber, array, type, (Uint8*)0);             return StringArrayToValueAux(lineNumber, array, type, (Uint8*)0);
  
         case CIMType::UINT16:          case CIMTYPE_UINT16:
             return StringArrayToValueAux(lineNumber, array, type, (Uint16*)0);             return StringArrayToValueAux(lineNumber, array, type, (Uint16*)0);
  
         case CIMType::UINT32:          case CIMTYPE_UINT32:
             return StringArrayToValueAux(lineNumber, array, type, (Uint32*)0);             return StringArrayToValueAux(lineNumber, array, type, (Uint32*)0);
  
         case CIMType::UINT64:          case CIMTYPE_UINT64:
             return StringArrayToValueAux(lineNumber, array, type, (Uint64*)0);             return StringArrayToValueAux(lineNumber, array, type, (Uint64*)0);
  
         case CIMType::SINT8:          case CIMTYPE_SINT8:
             return StringArrayToValueAux(lineNumber, array, type, (Sint8*)0);             return StringArrayToValueAux(lineNumber, array, type, (Sint8*)0);
  
         case CIMType::SINT16:          case CIMTYPE_SINT16:
             return StringArrayToValueAux(lineNumber, array, type, (Sint16*)0);             return StringArrayToValueAux(lineNumber, array, type, (Sint16*)0);
  
         case CIMType::SINT32:          case CIMTYPE_SINT32:
             return StringArrayToValueAux(lineNumber, array, type, (Sint32*)0);             return StringArrayToValueAux(lineNumber, array, type, (Sint32*)0);
  
         case CIMType::SINT64:          case CIMTYPE_SINT64:
             return StringArrayToValueAux(lineNumber, array, type, (Sint64*)0);             return StringArrayToValueAux(lineNumber, array, type, (Sint64*)0);
  
         case CIMType::DATETIME:          case CIMTYPE_DATETIME:
             return StringArrayToValueAux(lineNumber, array, type, (CIMDateTime*)0);             return StringArrayToValueAux(lineNumber, array, type, (CIMDateTime*)0);
  
         case CIMType::REAL32:          case CIMTYPE_REAL32:
             return StringArrayToValueAux(lineNumber, array, type, (Real32*)0);             return StringArrayToValueAux(lineNumber, array, type, (Real32*)0);
  
         case CIMType::REAL64:          case CIMTYPE_REAL64:
             return StringArrayToValueAux(lineNumber, array, type, (Real64*)0);             return StringArrayToValueAux(lineNumber, array, type, (Real64*)0);
  
         default:         default:
Line 1107 
Line 1335 
 // //
 //     <!ELEMENT VALUE.ARRAY (VALUE*)> //     <!ELEMENT VALUE.ARRAY (VALUE*)>
 // //
   //  Return: Boolean. Returns false if there is no VALUE.ARRAY start element
   //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::getValueArrayElement( Boolean XmlReader::getValueArrayElement(
Line 1114 
Line 1344 
     CIMType type,     CIMType type,
     CIMValue& value)     CIMValue& value)
 { {
       // Clears any values from the Array. Assumes this is array CIMValue
     value.clear();     value.clear();
  
     // 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 (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))
         return false;         return false;
  
     if (entry.type == XmlEntry::EMPTY_TAG)      if (entry.type != XmlEntry::EMPTY_TAG)
         return true;      {
   
     // For each VALUE element:     // For each VALUE element:
  
     Array<const char*> stringArray;  
   
     while (testStartTagOrEmptyTag(parser, entry, "VALUE"))     while (testStartTagOrEmptyTag(parser, entry, "VALUE"))
     {     {
         if (entry.type == XmlEntry::EMPTY_TAG)         if (entry.type == XmlEntry::EMPTY_TAG)
Line 1147 
Line 1377 
     }     }
  
     expectEndTag(parser, "VALUE.ARRAY");     expectEndTag(parser, "VALUE.ARRAY");
       }
  
     value = stringArrayToValue(parser.getLine(), stringArray, type);     value = stringArrayToValue(parser.getLine(), stringArray, type);
     return true;     return true;
Line 1164 
Line 1395 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Uint32 XmlReader::getFlavor(  CIMFlavor XmlReader::getFlavor(
     XmlEntry& entry,     XmlEntry& entry,
     Uint32 lineNumber,     Uint32 lineNumber,
     const char* tagName)     const char* tagName)
Line 1189 
Line 1420 
     Boolean translatable = getCimBooleanAttribute(     Boolean translatable = getCimBooleanAttribute(
         lineNumber, entry, tagName, "TRANSLATABLE", false, false);         lineNumber, entry, tagName, "TRANSLATABLE", false, false);
  
     Uint32 flavor = 0;      // Start with CIMFlavor::NONE.  Defaults are specified in the
       // getCimBooleanAttribute() calls above.
       CIMFlavor flavor = CIMFlavor (CIMFlavor::NONE);
  
     if (overridable)     if (overridable)
         flavor |= CIMFlavor::OVERRIDABLE;          flavor.addFlavor (CIMFlavor::OVERRIDABLE);
       else
           flavor.addFlavor (CIMFlavor::DISABLEOVERRIDE);
  
     if (toSubClass)     if (toSubClass)
         flavor |= CIMFlavor::TOSUBCLASS;          flavor.addFlavor (CIMFlavor::TOSUBCLASS);
       else
           flavor.addFlavor (CIMFlavor::RESTRICTED);
  
     if (toInstance)     if (toInstance)
         flavor |= CIMFlavor::TOINSTANCE;          flavor.addFlavor (CIMFlavor::TOINSTANCE);
  
     if (translatable)     if (translatable)
         flavor |= CIMFlavor::TRANSLATABLE;          flavor.addFlavor (CIMFlavor::TRANSLATABLE);
  
     return flavor;     return flavor;
 } }
Line 1223 
Line 1460 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Uint32 XmlReader::getOptionalScope(XmlParser& parser)  CIMScope XmlReader::getOptionalScope(XmlParser& parser)
 { {
     XmlEntry entry;     XmlEntry entry;
       CIMScope scope;
  
     if (!parser.next(entry))     if (!parser.next(entry))
         return false;          return scope;    // No SCOPE element found; return the empty scope
  
     Boolean isEmptyTag = entry.type == XmlEntry::EMPTY_TAG;     Boolean isEmptyTag = entry.type == XmlEntry::EMPTY_TAG;
  
Line 1236 
Line 1474 
         entry.type != XmlEntry::START_TAG) ||         entry.type != XmlEntry::START_TAG) ||
         strcmp(entry.text, "SCOPE") != 0)         strcmp(entry.text, "SCOPE") != 0)
     {     {
           // No SCOPE element found; return the empty scope
         parser.putBack(entry);         parser.putBack(entry);
         return 0;          return scope;
     }     }
  
     Uint32 line = parser.getLine();     Uint32 line = parser.getLine();
     Uint32 scope = 0;  
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "CLASS", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "CLASS", false, false))
         scope |= CIMScope::CLASS;          scope.addScope (CIMScope::CLASS);
  
     if (getCimBooleanAttribute(     if (getCimBooleanAttribute(
         line, entry, "SCOPE", "ASSOCIATION", false, false))         line, entry, "SCOPE", "ASSOCIATION", false, false))
         scope |= CIMScope::ASSOCIATION;          scope.addScope (CIMScope::ASSOCIATION);
  
     if (getCimBooleanAttribute(     if (getCimBooleanAttribute(
         line, entry, "SCOPE", "REFERENCE", false, false))         line, entry, "SCOPE", "REFERENCE", false, false))
         scope |= CIMScope::REFERENCE;          scope.addScope (CIMScope::REFERENCE);
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "PROPERTY", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "PROPERTY", false, false))
         scope |= CIMScope::PROPERTY;          scope.addScope (CIMScope::PROPERTY);
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "METHOD", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "METHOD", false, false))
         scope |= CIMScope::METHOD;          scope.addScope (CIMScope::METHOD);
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "PARAMETER", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "PARAMETER", false, false))
         scope |= CIMScope::PARAMETER;          scope.addScope (CIMScope::PARAMETER);
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "INDICATION",false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "INDICATION",false, false))
         scope |= CIMScope::INDICATION;          scope.addScope (CIMScope::INDICATION);
  
     if (!isEmptyTag)     if (!isEmptyTag)
         expectEndTag(parser, "SCOPE");         expectEndTag(parser, "SCOPE");
Line 1276 
Line 1514 
 // //
 // getQualifierElement() // getQualifierElement()
 // //
 //     <!ELEMENT QUALIFIER (VALUE|VALUE.ARRAY)>  //     <!ELEMENT QUALIFIER (VALUE|VALUE.ARRAY)?>
 //     <!ATTLIST QUALIFIER //     <!ATTLIST QUALIFIER
 //         %CIMName; //         %CIMName;
 //         %CIMType; #REQUIRED //         %CIMType; #REQUIRED
Line 1297 
Line 1535 
  
     // Get QUALIFIER.NAME attribute:     // Get QUALIFIER.NAME attribute:
  
     String name = getCimNameAttribute(parser.getLine(), entry, "QUALIFIER");      CIMName name = getCimNameAttribute(parser.getLine(), entry, "QUALIFIER");
  
     // Get QUALIFIER.TYPE attribute:     // Get QUALIFIER.TYPE attribute:
  
     CIMType type = getCimTypeAttribute(parser.getLine(), entry, "QUALIFIER");      CIMType type;
       getCimTypeAttribute(parser.getLine(), entry, type, "QUALIFIER");
  
     // Get QUALIFIER.PROPAGATED     // Get QUALIFIER.PROPAGATED
  
Line 1310 
Line 1549 
  
     // Get flavor oriented attributes:     // Get flavor oriented attributes:
  
     Uint32 flavor = getFlavor(entry, parser.getLine(), "QUALIFIER");      CIMFlavor flavor = getFlavor(entry, parser.getLine(), "QUALIFIER");
  
     // Get VALUE or VALUE.ARRAY element:     // Get VALUE or VALUE.ARRAY element:
  
Line 1319 
Line 1558 
     if (!getValueElement(parser, type, value) &&     if (!getValueElement(parser, type, value) &&
         !getValueArrayElement(parser, type, value))         !getValueArrayElement(parser, type, value))
     {     {
         throw XmlSemanticError(parser.getLine(),          value.setNullValue(type, false);
             "Expected VALUE or VALUE.ARRAY element");  
     }     }
  
     // Expect </QUALIFIER>:     // Expect </QUALIFIER>:
Line 1350 
Line 1588 
         {         {
             container.addQualifier(qualifier);             container.addQualifier(qualifier);
         }         }
         catch (AlreadyExists&)          catch (AlreadyExistsException&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate qualifier");             throw XmlSemanticError(parser.getLine(), "duplicate qualifier");
         }         }
Line 1381 
Line 1619 
  
     // Get PROPERTY.NAME attribute:     // Get PROPERTY.NAME attribute:
  
     String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");      CIMName name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");
  
     // Get PROPERTY.CLASSORIGIN attribute:     // Get PROPERTY.CLASSORIGIN attribute:
  
     String classOrigin =      CIMName classOrigin =
         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");
  
     // Get PROPERTY.PROPAGATED     // Get PROPERTY.PROPAGATED
Line 1395 
Line 1633 
  
     // Get PROPERTY.TYPE attribute:     // Get PROPERTY.TYPE attribute:
  
     CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY");      CIMType type;
       getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY");
  
     // Create property:      // Create property: Sets type and !isarray
  
     CIMValue value;      CIMValue value(type, false);
     value.setNullValue(type, false);      property = CIMProperty(name, value, 0, CIMName(), classOrigin, propagated);
     property = CIMProperty(  
         name, value, 0, String(), classOrigin, propagated);  
  
     if (!empty)     if (!empty)
     {     {
Line 1410 
Line 1647 
  
         getQualifierElements(parser, property);         getQualifierElements(parser, property);
  
         // Get value:          // Get value:  Insert value if getValueElement exists (returns True)
  
         if (getValueElement(parser, type, value))         if (getValueElement(parser, type, value))
             property.setValue(value);             property.setValue(value);
Line 1485 
Line 1722 
  
     // Get PROPERTY.NAME attribute:     // Get PROPERTY.NAME attribute:
  
     String name =      CIMName name =
         getCimNameAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");         getCimNameAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");
  
     // Get PROPERTY.TYPE attribute:     // Get PROPERTY.TYPE attribute:
  
     CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");      CIMType type;
       getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY.ARRAY");
  
     // Get PROPERTY.ARRAYSIZE attribute:     // Get PROPERTY.ARRAYSIZE attribute:
  
Line 1499 
Line 1737 
  
     // Get PROPERTY.CLASSORIGIN attribute:     // Get PROPERTY.CLASSORIGIN attribute:
  
     String classOrigin      CIMName classOrigin
         = getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");         = getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");
  
     // Get PROPERTY.ARRAY.PROPAGATED     // Get PROPERTY.ARRAY.PROPAGATED
Line 1509 
Line 1747 
  
     // Create property:     // Create property:
  
     CIMValue nullValue;      CIMValue value(type, true, arraySize);
     nullValue.setNullValue(type, true, arraySize);  
     property = CIMProperty(     property = CIMProperty(
         name, nullValue, arraySize, String(), classOrigin, propagated);          name, value, arraySize, CIMName(), classOrigin, propagated);
  
     if (!empty)     if (!empty)
     {     {
Line 1522 
Line 1759 
  
         // Get value:         // Get value:
  
         CIMValue value;  
   
         if (getValueArrayElement(parser, type, value))         if (getValueArrayElement(parser, type, value))
         {         {
             if (arraySize && arraySize != value.getArraySize())             if (arraySize && arraySize != value.getArraySize())
Line 1581 
Line 1816 
  
 Boolean XmlReader::getNameSpaceElement( Boolean XmlReader::getNameSpaceElement(
     XmlParser& parser,     XmlParser& parser,
     String& nameSpaceComponent)      CIMName& nameSpaceComponent)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1616 
Line 1851 
     if (!testStartTag(parser, entry, "LOCALNAMESPACEPATH"))     if (!testStartTag(parser, entry, "LOCALNAMESPACEPATH"))
         return false;         return false;
  
     String nameSpaceComponent;      CIMName nameSpaceComponent;
  
     while (getNameSpaceElement(parser, nameSpaceComponent))     while (getNameSpaceElement(parser, nameSpaceComponent))
     {     {
         if (nameSpace.size())         if (nameSpace.size())
             nameSpace += '/';              nameSpace.append('/');
  
         nameSpace += nameSpaceComponent;          nameSpace.append(nameSpaceComponent.getString());
     }     }
  
     if (!nameSpace.size())     if (!nameSpace.size())
Line 1683 
Line 1918 
  
 Boolean XmlReader::getClassNameElement( Boolean XmlReader::getClassNameElement(
     XmlParser& parser,     XmlParser& parser,
     String& className,      CIMName& className,
     Boolean required)     Boolean required)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 1718 
Line 1953 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 KeyBinding::Type XmlReader::getValueTypeAttribute(  CIMKeyBinding::Type XmlReader::getValueTypeAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
Line 1726 
Line 1961 
     String tmp;     String tmp;
  
     if (!entry.getAttributeValue("VALUETYPE", tmp))     if (!entry.getAttributeValue("VALUETYPE", tmp))
         return KeyBinding::STRING;          return CIMKeyBinding::STRING;
  
     if (String::equal(tmp, "string"))     if (String::equal(tmp, "string"))
         return KeyBinding::STRING;          return CIMKeyBinding::STRING;
     else if (String::equal(tmp, "boolean"))     else if (String::equal(tmp, "boolean"))
         return KeyBinding::BOOLEAN;          return CIMKeyBinding::BOOLEAN;
     else if (String::equal(tmp, "numeric"))     else if (String::equal(tmp, "numeric"))
         return KeyBinding::NUMERIC;          return CIMKeyBinding::NUMERIC;
  
     char buffer[MESSAGE_SIZE];     char buffer[MESSAGE_SIZE];
  
Line 1743 
Line 1978 
         elementName);         elementName);
  
     throw XmlSemanticError(lineNumber, buffer);     throw XmlSemanticError(lineNumber, buffer);
     return KeyBinding::BOOLEAN;      return CIMKeyBinding::BOOLEAN;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 1758 
Line 1993 
  
 Boolean XmlReader::getKeyValueElement( Boolean XmlReader::getKeyValueElement(
     XmlParser& parser,     XmlParser& parser,
     KeyBinding::Type& type,      CIMKeyBinding::Type& type,
     String& value)     String& value)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 1800 
Line 2035 
  
 Boolean XmlReader::getKeyBindingElement( Boolean XmlReader::getKeyBindingElement(
     XmlParser& parser,     XmlParser& parser,
     String& name,      CIMName& name,
     String& value,     String& value,
     KeyBinding::Type& type)      CIMKeyBinding::Type& type)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1813 
Line 2048 
  
     if (!getKeyValueElement(parser, type, value))     if (!getKeyValueElement(parser, type, value))
     {     {
         CIMReference reference;          CIMObjectPath reference;
  
         if (!getValueReferenceElement(parser, reference))         if (!getValueReferenceElement(parser, reference))
         {         {
Line 1821 
Line 2056 
                       "Expected KEYVALUE or VALUE.REFERENCE element");                       "Expected KEYVALUE or VALUE.REFERENCE element");
         }         }
  
         type = KeyBinding::REFERENCE;          type = CIMKeyBinding::REFERENCE;
         value = reference.toString();         value = reference.toString();
     }     }
  
Line 1845 
Line 2080 
 Boolean XmlReader::getInstanceNameElement( Boolean XmlReader::getInstanceNameElement(
     XmlParser& parser,     XmlParser& parser,
     String& className,     String& className,
     Array<KeyBinding>& keyBindings)      Array<CIMKeyBinding>& keyBindings)
 { {
     className.clear();     className.clear();
     keyBindings.clear();     keyBindings.clear();
Line 1864 
Line 2099 
         return true;         return true;
     }     }
  
     String name;      CIMName name;
     KeyBinding::Type type;      CIMKeyBinding::Type type;
     String value;     String value;
     CIMReference reference;      CIMObjectPath reference;
  
     if (getKeyValueElement(parser, type, value))     if (getKeyValueElement(parser, type, value))
     {     {
         // Use empty key name because none was specified         // Use empty key name because none was specified
         keyBindings.append(KeyBinding(name, value, type));          keyBindings.append(CIMKeyBinding(name, value, type));
     }     }
     else if (getValueReferenceElement(parser, reference))     else if (getValueReferenceElement(parser, reference))
     {     {
         // Use empty key name because none was specified         // Use empty key name because none was specified
         type = KeyBinding::REFERENCE;          type = CIMKeyBinding::REFERENCE;
         value = reference.toString();         value = reference.toString();
         keyBindings.append(KeyBinding(name, value, type));          keyBindings.append(CIMKeyBinding(name, value, type));
     }     }
     else     else
     {     {
         while (getKeyBindingElement(parser, name, value, type))         while (getKeyBindingElement(parser, name, value, type))
             keyBindings.append(KeyBinding(name, value, type));              keyBindings.append(CIMKeyBinding(name, value, type));
     }     }
  
     expectEndTag(parser, "INSTANCENAME");     expectEndTag(parser, "INSTANCENAME");
Line 1894 
Line 2129 
  
 Boolean XmlReader::getInstanceNameElement( Boolean XmlReader::getInstanceNameElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& instanceName)      CIMObjectPath& instanceName)
 { {
     String className;     String className;
     Array<KeyBinding> keyBindings;      Array<CIMKeyBinding> keyBindings;
  
     if (!XmlReader::getInstanceNameElement(parser, className, keyBindings))     if (!XmlReader::getInstanceNameElement(parser, className, keyBindings))
         return false;         return false;
  
     instanceName.set(String(), String(), className, keyBindings);      instanceName.set(String(), CIMNamespaceName(), className, keyBindings);
     return true;     return true;
 } }
  
Line 1916 
Line 2151 
  
 Boolean XmlReader::getInstancePathElement( Boolean XmlReader::getInstancePathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1933 
Line 2168 
     }     }
  
     String className;     String className;
     Array<KeyBinding> keyBindings;      Array<CIMKeyBinding> keyBindings;
  
     if (!getInstanceNameElement(parser, className, keyBindings))     if (!getInstanceNameElement(parser, className, keyBindings))
     {     {
Line 1957 
Line 2192 
  
 Boolean XmlReader::getLocalInstancePathElement( Boolean XmlReader::getLocalInstancePathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1973 
Line 2208 
     }     }
  
     String className;     String className;
     Array<KeyBinding> keyBindings;      Array<CIMKeyBinding> keyBindings;
  
     if (!getInstanceNameElement(parser, className, keyBindings))     if (!getInstanceNameElement(parser, className, keyBindings))
     {     {
Line 1997 
Line 2232 
  
 Boolean XmlReader::getClassPathElement( Boolean XmlReader::getClassPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2013 
Line 2248 
             "expected NAMESPACEPATH element");             "expected NAMESPACEPATH element");
     }     }
  
     String className;      CIMName className;
  
     if (!getClassNameElement(parser, className))     if (!getClassNameElement(parser, className))
     {     {
Line 2037 
Line 2272 
  
 Boolean XmlReader::getLocalClassPathElement( Boolean XmlReader::getLocalClassPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2052 
Line 2287 
             "expected LOCALNAMESPACEPATH element");             "expected LOCALNAMESPACEPATH element");
     }     }
  
     String className;      CIMName className;
  
     if (!getClassNameElement(parser, className))     if (!getClassNameElement(parser, className))
     {     {
Line 2079 
Line 2314 
  
 Boolean XmlReader::getValueReferenceElement( Boolean XmlReader::getValueReferenceElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2111 
Line 2346 
     else if (strcmp(entry.text, "CLASSNAME") == 0)     else if (strcmp(entry.text, "CLASSNAME") == 0)
     {     {
         parser.putBack(entry);         parser.putBack(entry);
         String className;          CIMName className;
         getClassNameElement(parser, className);         getClassNameElement(parser, className);
         reference.set(String(), String(), className);          reference.set(String(), CIMNamespaceName(), className);
     }     }
     else if (strcmp(entry.text, "INSTANCEPATH") == 0)     else if (strcmp(entry.text, "INSTANCEPATH") == 0)
     {     {
Line 2129 
Line 2364 
     {     {
         parser.putBack(entry);         parser.putBack(entry);
         String className;         String className;
         Array<KeyBinding> keyBindings;          Array<CIMKeyBinding> keyBindings;
         getInstanceNameElement(parser, className, keyBindings);         getInstanceNameElement(parser, className, keyBindings);
         reference.set(String(), String(), className, keyBindings);          reference.set(String(), CIMNamespaceName(), className, keyBindings);
     }     }
  
     expectEndTag(parser, "VALUE.REFERENCE");     expectEndTag(parser, "VALUE.REFERENCE");
Line 2140 
Line 2375 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
   // getValueReferenceArrayElement()
   //
   //     <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE*)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getValueReferenceArrayElement(
       XmlParser& parser,
       CIMValue& value)
   {
       XmlEntry entry;
       Array<CIMObjectPath> referenceArray;
       CIMObjectPath reference;
   
       value.clear();
   
       // Get VALUE.REFARRAY open tag:
   
       if (!testStartTagOrEmptyTag(parser, entry, "VALUE.REFARRAY"))
           return false;
   
       if (entry.type != XmlEntry::EMPTY_TAG)
       {
           // For each VALUE.REFERENCE element:
   
           while (getValueReferenceElement(parser, reference))
           {
               referenceArray.append(reference);
           }
   
           expectEndTag(parser, "VALUE.REFARRAY");
       }
   
       value.set(referenceArray);
       return true;
   }
   
   //------------------------------------------------------------------------------
   //
 // getPropertyReferenceElement() // getPropertyReferenceElement()
 // //
 //     <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,(VALUE.REFERENCE)?)> //     <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,(VALUE.REFERENCE)?)>
Line 2164 
Line 2438 
  
     // Get PROPERTY.NAME attribute:     // Get PROPERTY.NAME attribute:
  
     String name = getCimNameAttribute(      CIMName name = getCimNameAttribute(
         parser.getLine(), entry, "PROPERTY.REFERENCE");         parser.getLine(), entry, "PROPERTY.REFERENCE");
  
     // Get PROPERTY.REFERENCECLASS attribute:     // Get PROPERTY.REFERENCECLASS attribute:
  
     String referenceClass = getReferenceClassAttribute(      CIMName referenceClass = getReferenceClassAttribute(
         parser.getLine(), entry, "PROPERTY.REFERENCE");         parser.getLine(), entry, "PROPERTY.REFERENCE");
  
     // Get PROPERTY.CLASSORIGIN attribute:     // Get PROPERTY.CLASSORIGIN attribute:
  
     String classOrigin =      CIMName classOrigin =
         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.REFERENCE");         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.REFERENCE");
  
     // Get PROPERTY.PROPAGATED     // Get PROPERTY.PROPAGATED
Line 2184 
Line 2458 
  
     // Create property:     // Create property:
  
     CIMValue value;      CIMValue value = CIMValue(CIMTYPE_REFERENCE, false, 0);
     value.set(CIMReference());  //    value.set(CIMObjectPath());
     property = CIMProperty(     property = CIMProperty(
         name, value, 0, referenceClass, classOrigin, propagated);         name, value, 0, referenceClass, classOrigin, propagated);
  
Line 2193 
Line 2467 
     {     {
         getQualifierElements(parser, property);         getQualifierElements(parser, property);
  
         CIMReference reference;          CIMObjectPath reference;
  
         if (getValueReferenceElement(parser, reference))         if (getValueReferenceElement(parser, reference))
             property.setValue(reference);             property.setValue(reference);
Line 2223 
Line 2497 
         {         {
             container.addProperty(property);             container.addProperty(property);
         }         }
         catch (AlreadyExists&)          catch (AlreadyExistsException&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate property");             throw XmlSemanticError(parser.getLine(), "duplicate property");
         }         }
Line 2254 
Line 2528 
  
     // Get PARAMETER.NAME attribute:     // Get PARAMETER.NAME attribute:
  
     String name = getCimNameAttribute(parser.getLine(), entry, "PARAMETER");      CIMName name = getCimNameAttribute(parser.getLine(), entry, "PARAMETER");
  
     // Get PARAMETER.TYPE attribute:     // Get PARAMETER.TYPE attribute:
  
     CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PARAMETER");      CIMType type;
       getCimTypeAttribute(parser.getLine(), entry, type, "PARAMETER");
  
     // Create parameter:     // Create parameter:
  
Line 2299 
Line 2574 
  
     // Get PARAMETER.ARRAY.NAME attribute:     // Get PARAMETER.ARRAY.NAME attribute:
  
     String name = getCimNameAttribute(      CIMName name = getCimNameAttribute(
         parser.getLine(), entry, "PARAMETER.ARRAY");         parser.getLine(), entry, "PARAMETER.ARRAY");
  
     // Get PARAMETER.ARRAY.TYPE attribute:     // Get PARAMETER.ARRAY.TYPE attribute:
  
     CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PARAMETER.ARRAY");      CIMType type;
       getCimTypeAttribute(parser.getLine(), entry, type, "PARAMETER.ARRAY");
  
     // Get PARAMETER.ARRAYSIZE attribute:     // Get PARAMETER.ARRAYSIZE attribute:
  
Line 2349 
Line 2625 
  
     // Get PARAMETER.NAME attribute:     // Get PARAMETER.NAME attribute:
  
     String name = getCimNameAttribute(      CIMName name = getCimNameAttribute(
         parser.getLine(), entry, "PARAMETER.REFERENCE");         parser.getLine(), entry, "PARAMETER.REFERENCE");
  
     // Get PARAMETER.REFERENCECLASS attribute:     // Get PARAMETER.REFERENCECLASS attribute:
  
     String referenceClass = getReferenceClassAttribute(      CIMName referenceClass = getReferenceClassAttribute(
         parser.getLine(), entry, "PARAMETER.REFERENCE");         parser.getLine(), entry, "PARAMETER.REFERENCE");
  
     // Create parameter:     // Create parameter:
  
     parameter = CIMParameter(name, CIMType::REFERENCE, false, 0, referenceClass);      parameter = CIMParameter(name, CIMTYPE_REFERENCE, false, 0, referenceClass);
  
     if (!empty)     if (!empty)
     {     {
Line 2372 
Line 2648 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
   // getParameterReferenceArrayElement()
   //
   //     <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)>
   //     <!ATTLIST PARAMETER.REFARRAY
   //         %CIMName;
   //         %ReferenceClass;
   //         %ArraySize;>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getParameterReferenceArrayElement(
       XmlParser& parser,
       CIMParameter& parameter)
   {
       XmlEntry entry;
   
       if (!testStartTagOrEmptyTag(parser, entry, "PARAMETER.REFARRAY"))
           return false;
   
       Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
   
       // Get PARAMETER.NAME attribute:
   
       CIMName name = getCimNameAttribute(
           parser.getLine(), entry, "PARAMETER.REFARRAY");
   
       // Get PARAMETER.REFERENCECLASS attribute:
   
       CIMName referenceClass = getReferenceClassAttribute(
           parser.getLine(), entry, "PARAMETER.REFARRAY");
   
       // Get PARAMETER.ARRAYSIZE attribute:
   
       Uint32 arraySize = 0;
       getArraySizeAttribute(parser.getLine(), entry, "PARAMETER.REFARRAY",
                             arraySize);
   
       // Create parameter:
   
       parameter = CIMParameter(name, CIMTYPE_REFERENCE, true, arraySize,
                                referenceClass);
   
       if (!empty)
       {
           getQualifierElements(parser, parameter);
           expectEndTag(parser, "PARAMETER.REFARRAY");
       }
   
       return true;
   }
   
   //------------------------------------------------------------------------------
   //
 // GetParameterElements() // GetParameterElements()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 2383 
Line 2712 
  
     while (XmlReader::getParameterElement(parser, parameter) ||     while (XmlReader::getParameterElement(parser, parameter) ||
         XmlReader::getParameterArrayElement(parser, parameter) ||         XmlReader::getParameterArrayElement(parser, parameter) ||
         XmlReader::getParameterReferenceElement(parser, parameter))          XmlReader::getParameterReferenceElement(parser, parameter) ||
           XmlReader::getParameterReferenceArrayElement(parser, parameter))
     {     {
         try         try
         {         {
             container.addParameter(parameter);             container.addParameter(parameter);
         }         }
         catch (AlreadyExists&)          catch (AlreadyExistsException&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate parameter");             throw XmlSemanticError(parser.getLine(), "duplicate parameter");
         }         }
Line 2423 
Line 2753 
  
     // Get NAME attribute:     // Get NAME attribute:
  
     String name = getCimNameAttribute(      CIMName name = getCimNameAttribute(
         parser.getLine(), entry, "QUALIFIER.DECLARATION");         parser.getLine(), entry, "QUALIFIER.DECLARATION");
  
     // Get TYPE attribute:     // Get TYPE attribute:
  
     CIMType type = getCimTypeAttribute(      CIMType type;
         parser.getLine(), entry, "QUALIFIER.DECLARATION");      getCimTypeAttribute(parser.getLine(), entry, type, "QUALIFIER.DECLARATION");
  
     // Get ISARRAY attribute:     // Get ISARRAY attribute:
  
Line 2445 
Line 2775 
  
     // Get flavor oriented attributes:     // Get flavor oriented attributes:
  
     Uint32 flavor = getFlavor(entry,parser.getLine(), "QUALIFIER.DECLARATION");      CIMFlavor flavor = getFlavor (entry, parser.getLine (),
           "QUALIFIER.DECLARATION");
  
     // No need to look for interior elements if empty tag:     // No need to look for interior elements if empty tag:
  
     Uint32 scope = CIMScope::NONE;      CIMScope scope = CIMScope ();
     CIMValue value;     CIMValue value;
       Boolean gotValue = false;
  
     if (!empty)     if (!empty)
     {     {
Line 2475 
Line 2807 
                     "VALUE.ARRAY size is not the same as "                     "VALUE.ARRAY size is not the same as "
                     "ARRAYSIZE attribute");                     "ARRAYSIZE attribute");
             }             }
   
               gotValue = true;
         }         }
         else if (getValueElement(parser, type, value))         else if (getValueElement(parser, type, value))
         {         {
Line 2483 
Line 2817 
                 throw XmlSemanticError(parser.getLine(),                 throw XmlSemanticError(parser.getLine(),
                     "ISARRAY attribute used but VALUE element encountered");                     "ISARRAY attribute used but VALUE element encountered");
             }             }
   
               gotValue = true;
         }         }
  
         // Now get the closing tag:         // Now get the closing tag:
Line 2490 
Line 2826 
         expectEndTag(parser, "QUALIFIER.DECLARATION");         expectEndTag(parser, "QUALIFIER.DECLARATION");
     }     }
  
     if (value.getType() == CIMType::NONE)      if (!gotValue)
     {     {
         if (isArray)         if (isArray)
             value.setNullValue(type, true, arraySize);             value.setNullValue(type, true, arraySize);
Line 2525 
Line 2861 
  
     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
  
     String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");      CIMName name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");
  
     CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY");      CIMType type;
       getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY");
  
     String classOrigin =      CIMName classOrigin =
         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");
  
     Boolean propagated = getCimBooleanAttribute(     Boolean propagated = getCimBooleanAttribute(
Line 2539 
Line 2876 
  
     if (!empty)     if (!empty)
     {     {
           // ATTN-RK-P2-20020219: Decoding algorithm must not depend on the
           // ordering of qualifiers and parameters.
         getQualifierElements(parser, method);         getQualifierElements(parser, method);
  
         GetParameterElements(parser, method);         GetParameterElements(parser, method);
Line 2565 
Line 2904 
     if (!testStartTag(parser, entry, "CLASS"))     if (!testStartTag(parser, entry, "CLASS"))
         return false;         return false;
  
     String name = getCimNameAttribute(parser.getLine(), entry, "CLASS");      CIMName name = getCimNameAttribute(parser.getLine(), entry, "CLASS");
  
     String superClass = getSuperClassAttribute(parser.getLine(), entry,"CLASS");      CIMName superClass = getSuperClassAttribute(parser.getLine(), entry,"CLASS");
  
     cimClass = CIMClass(name, superClass);     cimClass = CIMClass(name, superClass);
  
Line 2633 
Line 2972 
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
   // getNamedInstanceElement()
   //
   //     <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getNamedInstanceElement(
       XmlParser& parser,
       CIMInstance& namedInstance)
   {
       XmlEntry entry;
   
       if (!testStartTag(parser, entry, "VALUE.NAMEDINSTANCE"))
           return false;
   
       CIMObjectPath instanceName;
   
       // Get INSTANCENAME elements:
   
       if (!getInstanceNameElement(parser, instanceName))
       {
           throw XmlValidationError(parser.getLine(),
               "expected INSTANCENAME element");
       }
   
       // Get INSTANCE elements:
   
       if (!getInstanceElement(parser, namedInstance))
       {
           throw XmlValidationError(parser.getLine(),
               "expected INSTANCE element");
       }
   
       // Get VALUE.NAMEDINSTANCE end tag:
   
       expectEndTag(parser, "VALUE.NAMEDINSTANCE");
   
       namedInstance.setPath (instanceName);
   
       return true;
   }
   
   //------------------------------------------------------------------------------
 // //
 // getObject() // getObject()
 // //
Line 2686 
Line 3068 
 Boolean XmlReader::getMessageStartTag( Boolean XmlReader::getMessageStartTag(
     XmlParser& parser,     XmlParser& parser,
     String& id,     String& id,
     const char*& protocolVersion)      String& protocolVersion)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2697 
Line 3079 
  
     if (!entry.getAttributeValue("ID", id))     if (!entry.getAttributeValue("ID", id))
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Bad or missing MESSAGE.ID attribute");              "Invalid or missing MESSAGE.ID attribute");
  
     // Get MESSAGE.PROTOCOLVERSION:     // Get MESSAGE.PROTOCOLVERSION:
  
     if (!entry.getAttributeValue("PROTOCOLVERSION", protocolVersion))     if (!entry.getAttributeValue("PROTOCOLVERSION", protocolVersion))
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Bad or missing MESSAGE.PROTOCOLVERSION attribute");              "Invalid or missing MESSAGE.PROTOCOLVERSION attribute");
  
     return true;     return true;
 } }
Line 2807 
Line 3189 
  
     expectContentOrCData(parser, entry);     expectContentOrCData(parser, entry);
  
     if (CompareNoCase(entry.text, "TRUE") == 0)      if (System::strcasecmp(entry.text, "TRUE") == 0)
         result = true;         result = true;
     else if (CompareNoCase(entry.text, "FALSE") == 0)      else if (System::strcasecmp(entry.text, "FALSE") == 0)
         result = false;         result = false;
     else     else
         throw XmlSemanticError(parser.getLine(),         throw XmlSemanticError(parser.getLine(),
             "Bad value for VALUE element: must be \"TRUE\" or \"FALSE\"");              "Invalid value for VALUE element: must be \"TRUE\" or \"FALSE\"");
  
     expectEndTag(parser, "VALUE");     expectEndTag(parser, "VALUE");
  
Line 2833 
Line 3215 
  
 Boolean XmlReader::getErrorElement( Boolean XmlReader::getErrorElement(
     XmlParser& parser,     XmlParser& parser,
     CIMStatusCode& code,      CIMException& cimException,
     const char*& description,  
     Boolean required)     Boolean required)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 2856 
Line 3237 
         throw XmlValidationError(         throw XmlValidationError(
             parser.getLine(), "missing ERROR.CODE attribute");             parser.getLine(), "missing ERROR.CODE attribute");
  
     code = CIMStatusCode(tmpCode);  
   
     // Get ERROR.DESCRIPTION:     // Get ERROR.DESCRIPTION:
  
     description = "";      String tmpDescription;
     entry.getAttributeValue("DESCRIPTION", description);  
       entry.getAttributeValue("DESCRIPTION", tmpDescription);
  
     if (!empty)     if (!empty)
         expectEndTag(parser, "ERROR");         expectEndTag(parser, "ERROR");
  
       cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(tmpCode), tmpDescription);
     return true;     return true;
 } }
  
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // getObjectWithPath()  // getValueObjectElement()
   //
   // <!ELEMENT VALUE.OBJECT (CLASS|INSTANCE)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getValueObjectElement(
       XmlParser& parser,
       CIMObject& object)
   {
       XmlEntry entry;
   
       if (!testStartTag(parser, entry, "VALUE.OBJECT"))
           return false;
   
       CIMInstance cimInstance;
       CIMClass cimClass;
   
       if (XmlReader::getInstanceElement(parser, cimInstance))
       {
           object = CIMObject(cimInstance);
       }
       else if (!XmlReader::getClassElement(parser, cimClass))
       {
           object = CIMObject(cimClass);
       }
       else
       {
           throw XmlValidationError(parser.getLine(),
               "Expected INSTANCE or CLASS element");
       }
   
       expectEndTag(parser, "VALUE.OBJECT");
   
       return true;
   }
   
   //------------------------------------------------------------------------------
   // getValueObjectWithPathElement()
 // //
 // <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))> // <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::getObjectWithPath(  Boolean XmlReader::getValueObjectWithPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMObjectWithPath& objectWithPath)      CIMObject& objectWithPath)
 { {
     XmlEntry entry;     XmlEntry entry;
  
     if (!testStartTag(parser, entry, "VALUE.OBJECTWITHPATH"))     if (!testStartTag(parser, entry, "VALUE.OBJECTWITHPATH"))
         return false;         return false;
  
     CIMReference reference;      CIMObjectPath reference;
     Boolean isInstance = false;     Boolean isInstance = false;
  
     if (XmlReader::getInstancePathElement(parser, reference))     if (XmlReader::getInstancePathElement(parser, reference))
Line 2894 
Line 3313 
     else if (!XmlReader::getClassPathElement(parser, reference))     else if (!XmlReader::getClassPathElement(parser, reference))
     {     {
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Expected INSTANCE element");              "Expected INSTANCEPATH or CLASSPATH element");
     }     }
  
     if (isInstance)     if (isInstance)
Line 2904 
Line 3323 
         if (!XmlReader::getInstanceElement(parser, cimInstance))         if (!XmlReader::getInstanceElement(parser, cimInstance))
         {         {
             throw XmlValidationError(parser.getLine(),             throw XmlValidationError(parser.getLine(),
                 "Expected INSTANCEPATH or CLASSPATH element");                  "Expected INSTANCE element");
         }         }
         objectWithPath.set(reference, CIMObject(cimInstance));          objectWithPath = CIMObject (cimInstance);
           objectWithPath.setPath (reference);
     }     }
     else     else
     {     {
Line 2917 
Line 3337 
             throw XmlValidationError(parser.getLine(),             throw XmlValidationError(parser.getLine(),
                 "Expected CLASS element");                 "Expected CLASS element");
         }         }
         objectWithPath.set(reference, CIMObject(cimClass));          objectWithPath = CIMObject (cimClass);
           objectWithPath.setPath (reference);
     }     }
  
     expectEndTag(parser, "VALUE.OBJECTWITHPATH");     expectEndTag(parser, "VALUE.OBJECTWITHPATH");
Line 2926 
Line 3347 
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
   // getValueObjectWithLocalPathElement()
   //
   // <!ELEMENT VALUE.OBJECTWITHLOCALPATH
   //     ((LOCALCLASSPATH,CLASS)|(LOCALINSTANCEPATH,INSTANCE))>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getValueObjectWithLocalPathElement(
       XmlParser& parser,
       CIMObject& objectWithPath)
   {
       XmlEntry entry;
   
       if (!testStartTag(parser, entry, "VALUE.OBJECTWITHLOCALPATH"))
           return false;
   
       CIMObjectPath reference;
       Boolean isInstance = false;
   
       if (XmlReader::getLocalInstancePathElement(parser, reference))
           isInstance = true;
       else if (!XmlReader::getLocalClassPathElement(parser, reference))
       {
           throw XmlValidationError(parser.getLine(),
               "Expected LOCALINSTANCEPATH or LOCALCLASSPATH element");
       }
   
       if (isInstance)
       {
           CIMInstance cimInstance;
   
           if (!XmlReader::getInstanceElement(parser, cimInstance))
           {
               throw XmlValidationError(parser.getLine(),
                   "Expected INSTANCE element");
           }
           objectWithPath = CIMObject (cimInstance);
           objectWithPath.setPath (reference);
       }
       else
       {
           CIMClass cimClass;
   
           if (!XmlReader::getClassElement(parser, cimClass))
           {
               throw XmlValidationError(parser.getLine(),
                   "Expected CLASS element");
           }
           objectWithPath = CIMObject (cimClass);
           objectWithPath.setPath (reference);
       }
   
       expectEndTag(parser, "VALUE.OBJECTWITHLOCALPATH");
   
       return true;
   }
   
   //------------------------------------------------------------------------------
   // getObjectArray()
   //
   // <object>
   //     (VALUE.OBJECT|VALUE.OBJECTWITHLOCALPATH|VALUE.OBJECTWITHPATH)
   //
   //------------------------------------------------------------------------------
   
   void XmlReader::getObjectArray(
       XmlParser& parser,
       Array<CIMObject>& objectArray)
   {
       CIMObject object;
       CIMObject objectWithPath;
   
       objectArray.clear();
   
       if (getValueObjectElement(parser, object))
       {
           objectArray.append(object);
           while (getValueObjectElement(parser, object))
               objectArray.append(object);
       }
       else if (getValueObjectWithPathElement(parser, objectWithPath))
       {
           objectArray.append(objectWithPath);
           while (getValueObjectWithPathElement(parser, objectWithPath))
               objectArray.append(objectWithPath);
       }
       else if (getValueObjectWithLocalPathElement(parser, objectWithPath))
       {
           objectArray.append(objectWithPath);
           while (getValueObjectWithLocalPathElement(parser, objectWithPath))
               objectArray.append(objectWithPath);
       }
   }
   
   //------------------------------------------------------------------------------
 // //
 // <objectName>: (CLASSNAME|INSTANCENAME) // <objectName>: (CLASSNAME|INSTANCENAME)
 // //
Line 2933 
Line 3449 
  
 Boolean XmlReader::getObjectNameElement( Boolean XmlReader::getObjectNameElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& objectName)      CIMObjectPath& objectName)
 { {
     String className;      CIMName className;
     CIMReference instanceName;  
  
     if (getClassNameElement(parser, className, false))     if (getClassNameElement(parser, className, false))
     {     {
         objectName.set(String(), String(), className);          objectName.set(String(), CIMNamespaceName(), className);
         return true;         return true;
     }     }
     else if (getInstanceNameElement(parser, objectName))     else if (getInstanceNameElement(parser, objectName))
Line 2962 
Line 3477 
  
 Boolean XmlReader::getObjectPathElement( Boolean XmlReader::getObjectPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& objectPath)      CIMObjectPath& objectPath)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 3086 
Line 3601 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // getParamValueTag()  // getParamValueElement()
   //
   // <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?>
   // <!ATTLIST PARAMVALUE
   //      %CIMName;
   //      %ParamType;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::getParamValueTag(  Boolean XmlReader::getParamValueElement(
     XmlParser& parser,     XmlParser& parser,
     const char*& name)      CIMParamValue& paramValue)
 { {
     XmlEntry entry;     XmlEntry entry;
       const char* name;
       CIMType type;
       CIMValue value;
  
     if (!testStartTag(parser, entry, "PARAMVALUE"))      if (!testStartTagOrEmptyTag(parser, entry, "PARAMVALUE"))
         return false;         return false;
  
     // Get IPARAMVALUE.NAME attribute:      Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
   
       // Get PARAMVALUE.NAME attribute:
  
     if (!entry.getAttributeValue("NAME", name))     if (!entry.getAttributeValue("NAME", name))
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Missing PARAMVALUE.NAME attribute");             "Missing PARAMVALUE.NAME attribute");
  
       // Get PARAMVALUE.PARAMTYPE attribute:
   
       Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,
                                             "PARAMVALUE", "PARAMTYPE", false);
   
       if (!empty)
       {
           // Parse VALUE.REFERENCE and VALUE.REFARRAY type
           if ( (type == CIMTYPE_REFERENCE) || !gotType )
           {
               CIMObjectPath reference;
               if (XmlReader::getValueReferenceElement(parser, reference))
               {
                   value.set(reference);
                   type = CIMTYPE_REFERENCE;
                   gotType = true;
               }
               else if (XmlReader::getValueReferenceArrayElement(parser, value))
               {
                   type = CIMTYPE_REFERENCE;
                   gotType = true;
               }
               // If type==reference but no VALUE.REFERENCE found, use null value
           }
   
           // Parse non-reference value
           if ( type != CIMTYPE_REFERENCE )
           {
               CIMType effectiveType;
               if (!gotType)
               {
                   // If we don't know what type the value is, read it as a String
                   effectiveType = CIMTYPE_STRING;
               }
               else
               {
                   effectiveType = type;
               }
   
               if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&
                    !XmlReader::getValueElement(parser, effectiveType, value) )
               {
                   value.clear();    // Isn't necessary; should already be cleared
               }
           }
   
           expectEndTag(parser, "PARAMVALUE");
       }
   
       paramValue = CIMParamValue(name, value, gotType);
   
       return true;
   }
   
   //------------------------------------------------------------------------------
   //
   // getReturnValueElement()
   //
   // <!ELEMENT RETURNVALUE (VALUE|VALUE.REFERENCE)>
   // <!ATTLIST RETURNVALUE
   //      %ParamType;>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getReturnValueElement(
       XmlParser& parser,
       CIMValue& returnValue)
   {
       XmlEntry entry;
       CIMType type;
       CIMValue value;
   
       if (!testStartTag(parser, entry, "RETURNVALUE"))
           return false;
   
       // Get RETURNVALUE.PARAMTYPE attribute:
       // NOTE: Array type return values are not allowed (2/20/02)
   
       Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,
                                             "RETURNVALUE", "PARAMTYPE", false);
   
       // Parse VALUE.REFERENCE type
       if ( (type == CIMTYPE_REFERENCE) || !gotType )
       {
           CIMObjectPath reference;
           if (XmlReader::getValueReferenceElement(parser, reference))
           {
               returnValue.set(reference);
               type = CIMTYPE_REFERENCE;
               gotType = true;
           }
           else if (type == CIMTYPE_REFERENCE)
           {
               throw XmlValidationError(parser.getLine(),
                   "expected VALUE.REFERENCE element");
           }
       }
   
       // Parse non-reference return value
       if ( type != CIMTYPE_REFERENCE )
       {
           if (!gotType)
           {
               // If we don't know what type the value is, read it as a String
               type = CIMTYPE_STRING;
           }
   
           if ( !XmlReader::getValueElement(parser, type, returnValue) )
           {
               throw XmlValidationError(parser.getLine(),
                   "expected VALUE element");
           }
       }
   
       expectEndTag(parser, "RETURNVALUE");
   
     return true;     return true;
 } }
  


Legend:
Removed from v.1.24.2.7  
changed lines
  Added in v.1.77

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2