(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.38 and 1.74

version 1.38, 2002/03/20 17:47:07 version 1.74, 2002/09/13 21:40:42
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 29 
Line 29 
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@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 42 
Line 44 
 #include "CIMClass.h" #include "CIMClass.h"
 #include "CIMInstance.h" #include "CIMInstance.h"
 #include "CIMObject.h" #include "CIMObject.h"
 #include "CIMNamedInstance.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 52 
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 67 
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 200 
Line 219 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // testEndTag>()  // testEndTag()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
Line 299 
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 315 
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 324 
Line 343 
         throw XmlSemanticError(lineNumber, buffer);         throw XmlSemanticError(lineNumber, buffer);
     }     }
  
     return name;      return CIMName (name);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 368 
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 376 
Line 395 
     String name;     String name;
  
     if (!entry.getAttributeValue("CLASSORIGIN", name))     if (!entry.getAttributeValue("CLASSORIGIN", name))
         return String();          return CIMName();
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
Line 397 
Line 416 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getReferenceClassAttribute(  CIMName XmlReader::getReferenceClassAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
Line 405 
Line 424 
     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 426 
Line 445 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getSuperClassAttribute(  CIMName XmlReader::getSuperClassAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* tagName)     const char* tagName)
Line 434 
Line 453 
     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 465 
Line 484 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMType XmlReader::getCimTypeAttribute(  Boolean XmlReader::getCimTypeAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
       CIMType& cimType,  // Output parameter
     const char* tagName,     const char* tagName,
     const char* attributeName,     const char* attributeName,
     Boolean required)     Boolean required)
Line 484 
Line 504 
         }         }
         else         else
         {         {
             return CIMType::NONE;              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)     else if (strcmp(typeName, "reference") == 0)
         type = CIMType::REFERENCE;          type = CIMTYPE_REFERENCE;
       else unrecognizedType = true;
  
     if ((type == CIMType::NONE) ||      if (unrecognizedType ||
         ((type == CIMType::REFERENCE) &&          ((type == CIMTYPE_REFERENCE) &&
          (strcmp(attributeName, "PARAMTYPE") != 0)))          (strcmp(attributeName, "PARAMTYPE") != 0)))
     {     {
         char message[MESSAGE_SIZE];         char message[MESSAGE_SIZE];
Line 531 
Line 553 
         throw XmlSemanticError(lineNumber, message);         throw XmlSemanticError(lineNumber, message);
     }     }
  
     return type;      cimType = type;
       return true;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 568 
Line 591 
         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 584 
Line 607 
  
 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 640 
Line 666 
     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 661 
Line 711 
     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 671 
Line 721 
     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';
           }
       }
  
     // Build the Sint64 as a negative number, regardless of the eventual sign      // Expect a positive decimal digit:
     x = -(*first++ - '0');  
  
     while (first != last)      // At least one decimal digit is required
       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))
     {     {
         if (x < -922337203685477580LL /* -(1<<63) / 10 */)          // Make sure we won't overflow when we multiply by 10
           if (x < PEGASUS_SINT64_MIN/10)
         {         {
             return false;             return false;
         }         }
         x = 10 * x;         x = 10 * x;
         Sint64 newDigit = (*first++ - '0');  
         if (PEGASUS_LLONG_MIN - x > -newDigit)          // Make sure we won't overflow when we add the next digit
           Sint64 newDigit = (*p++ - '0');
           if (PEGASUS_SINT64_MIN - x > -newDigit)
         {         {
             return false;             return false;
         }         }
         x = x - newDigit;         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 (!negative)
     {     {
         if (x == PEGASUS_LLONG_MIN)          if (x == PEGASUS_SINT64_MIN)
         {         {
             return false;             return false;
         }         }
Line 728 
Line 828 
 // //
 // 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 740 
Line 841 
     x = 0;     x = 0;
     const char* p = stringValue;     const char* p = stringValue;
  
     if (!*p)      if (!p || !*p)
         return false;  
   
     // Skip optional sign:  
   
     if (*p == '-')  
         return false;         return false;
  
     if (*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 (!*p)
         return false;         return false;
  
     p++;              // Add on each digit, checking for overflow errors
               while (isxdigit(*p))
     // Expect zero or more digits:              {
                   // Make sure we won't overflow when we multiply by 16
                   if (x > PEGASUS_UINT64_MAX/16)
                   {
                       return false;
                   }
                   x = x << 4;
  
     while (isdigit(*p))                  // We can't overflow when we add the next digit
         p++;                  Uint64 newDigit = Uint64(_hexCharToNumeric(*p++));
                   if (PEGASUS_UINT64_MAX - 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 true;
           }
           else
           {
               // A decimal string that starts with '0' must be exactly "0".
               return p[1] == '\0';
           }
       }
   
       // Expect a positive decimal digit:
  
     while (first != last)      // Add on each digit, checking for overflow errors
       while (isdigit(*p))
     {     {
         if (x > 1844674407370955161ULL /* (1<<64 - 1) / 10 */)          // Make sure we won't overflow when we multiply by 10
           if (x > PEGASUS_UINT64_MAX/10)
         {         {
             return false;             return false;
         }         }
         x = 10 * x;         x = 10 * x;
         Uint64 newDigit = (*first++ - '0');  
         if (18446744073709551615ULL - x < newDigit)          // Make sure we won't overflow when we add the next digit
           Uint64 newDigit = (*p++ - '0');
           if (PEGASUS_UINT64_MAX - x < newDigit)
         {         {
             return false;             return false;
         }         }
         x = x + newDigit;         x = x + newDigit;
     }     }
  
       // If we found a non-decimal digit, report an error
       if (*p)
           return false;
   
     return true;     return true;
 } }
  
Line 811 
Line 935 
 { {
     // 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 == 0, set to default value for type  
   
     if (strlen(valueString)==0)  
     {  
         switch (type)  
         {  
             case CIMType::BOOLEAN: return CIMValue(false);  
             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));  
         }  
     }  
   
     // Create value per type     // Create value per type
     switch (type)     switch (type)
     {     {
         case CIMType::BOOLEAN:          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:                  case CIMTYPE_UINT8:
                 {                 {
                     if (x >= (Uint64(1)<<8))                     if (x >= (Uint64(1)<<8))
                     {                     {
Line 884 
Line 986 
                     }                     }
                     return CIMValue(Uint8(x));                     return CIMValue(Uint8(x));
                 }                 }
                 case CIMType::UINT16:                  case CIMTYPE_UINT16:
                 {                 {
                     if (x >= (Uint64(1)<<16))                     if (x >= (Uint64(1)<<16))
                     {                     {
Line 893 
Line 995 
                     }                     }
                     return CIMValue(Uint16(x));                     return CIMValue(Uint16(x));
                 }                 }
                 case CIMType::UINT32:                  case CIMTYPE_UINT32:
                 {                 {
                     if (x >= (Uint64(1)<<32))                     if (x >= (Uint64(1)<<32))
                     {                     {
Line 902 
Line 1004 
                     }                     }
                     return CIMValue(Uint32(x));                     return CIMValue(Uint32(x));
                 }                 }
                 case CIMType::UINT64: return CIMValue(Uint64(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:                  case CIMTYPE_SINT8:
                 {                 {
                     if(  (x >= (Sint64(1)<<7)) || (x < (-(Sint64(1)<<7))) )                     if(  (x >= (Sint64(1)<<7)) || (x < (-(Sint64(1)<<7))) )
                     {                     {
Line 931 
Line 1033 
                     }                     }
                     return CIMValue(Sint8(x));                     return CIMValue(Sint8(x));
                 }                 }
                 case CIMType::SINT16:                  case CIMTYPE_SINT16:
                 {                 {
                     if(  (x >= (Sint64(1)<<15)) || (x < (-(Sint64(1)<<15))) )                     if(  (x >= (Sint64(1)<<15)) || (x < (-(Sint64(1)<<15))) )
                     {                     {
Line 940 
Line 1042 
                     }                     }
                     return CIMValue(Sint16(x));                     return CIMValue(Sint16(x));
                 }                 }
                 case CIMType::SINT32:                  case CIMTYPE_SINT32:
                 {                 {
                     if(  (x >= (Sint64(1)<<31)) || (x < (-(Sint64(1)<<31))) )                     if(  (x >= (Sint64(1)<<31)) || (x < (-(Sint64(1)<<31))) )
                     {                     {
Line 949 
Line 1051 
                     }                     }
                     return CIMValue(Sint32(x));                     return CIMValue(Sint32(x));
                 }                 }
                 case CIMType::SINT64: return CIMValue(Sint64(x));                  case CIMTYPE_SINT64: return CIMValue(Sint64(x));
                 default: break;                 default: break;
             }             }
         }         }
  
         case CIMType::DATETIME:          case CIMTYPE_DATETIME:
         {         {
             CIMDateTime tmp;             CIMDateTime tmp;
  
Line 962 
Line 1064 
             {             {
                 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");
  
             // ATTN-RK-P3-20010319: This value gets truncated.  
             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 1100 
Line 1201 
     CIMValue& cimValue)     CIMValue& cimValue)
 { {
     // Can not test for value type, so assume String     // Can not test for value type, so assume String
     const CIMType type = CIMType::STRING;      const CIMType type = CIMTYPE_STRING;
  
     // Test for VALUE element     // Test for VALUE element
     if (XmlReader::getValueElement(parser, type, cimValue))     if (XmlReader::getValueElement(parser, type, cimValue))
Line 1115 
Line 1216 
     }     }
  
     // Test for VALUE.REFERENCE element     // 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);
Line 1166 
Line 1267 
 { {
     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 1243 
Line 1344 
     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))
         return false;         return false;
  
     //ATTN: P1 KS KSTESTNULL - Need to relook at this one.  
     if (entry.type == XmlEntry::EMPTY_TAG)  
         return true;  
   
     if (entry.type != XmlEntry::EMPTY_TAG)     if (entry.type != XmlEntry::EMPTY_TAG)
     {     {
         // For each VALUE element:         // For each VALUE element:
Line 1286 
Line 1383 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Uint32 XmlReader::getFlavor(  CIMFlavor XmlReader::getFlavor(
     XmlEntry& entry,     XmlEntry& entry,
     Uint32 lineNumber,     Uint32 lineNumber,
     const char* tagName)     const char* tagName)
Line 1311 
Line 1408 
     Boolean translatable = getCimBooleanAttribute(     Boolean translatable = getCimBooleanAttribute(
         lineNumber, entry, tagName, "TRANSLATABLE", false, false);         lineNumber, entry, tagName, "TRANSLATABLE", false, false);
  
     // ATTN: KS P1 5 Mar 2002 Should this not be CIMFlavor::DEFAULTS??      // Start with CIMFlavor::NONE.  Defaults are specified in the
     //Uint32 flavor = CIMFlavor::DEFAULTS;      // getCimBooleanAttribute() calls above.
     // ATTN-RK-P1-20020307: No, Karl.  If you initialize to the defaults,      CIMFlavor flavor = CIMFlavor (CIMFlavor::NONE);
     // you have to unset the default flavors that don't apply.  The code  
     // below only adds qualifiers.  
     Uint32 flavor = 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 1350 
Line 1448 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 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 1363 
Line 1462 
         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 1403 
Line 1502 
 // //
 // getQualifierElement() // getQualifierElement()
 // //
 //     <!ELEMENT QUALIFIER (VALUE|VALUE.ARRAY)>  //     <!ELEMENT QUALIFIER (VALUE|VALUE.ARRAY)?>
 //     <!ATTLIST QUALIFIER //     <!ATTLIST QUALIFIER
 //         %CIMName; //         %CIMName;
 //         %CIMType; #REQUIRED //         %CIMType; #REQUIRED
Line 1424 
Line 1523 
  
     // 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 1437 
Line 1537 
  
     // 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:
  
     // ATTN: KS P1 4 March 2002 - Requires either value or array element or  
     // generates exception.  Correct for spec but means no NULL values on qualifier  
     // values. Alternative is to set NULL value and continue  
   
     CIMValue value;     CIMValue value;
  
     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 1481 
Line 1576 
         {         {
             container.addQualifier(qualifier);             container.addQualifier(qualifier);
         }         }
         catch (AlreadyExists&)          catch (AlreadyExistsException&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate qualifier");             throw XmlSemanticError(parser.getLine(), "duplicate qualifier");
         }         }
Line 1512 
Line 1607 
  
     // 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 1526 
Line 1621 
  
     // 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: Sets type and !isarray     // Create property: Sets type and !isarray
     // ATTN: KS P1 change to use the correct constructor  
  
     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 1617 
Line 1710 
  
     // 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 1631 
Line 1725 
  
     // 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 1641 
Line 1735 
  
     // Create property:     // Create property:
  
     // ATTN: KS P1 4 March 2002 Change to use correct constructor.      CIMValue value(type, true, arraySize);
     // ATTN: KS P3 4 March 2002.  Why create extra value. Use same one.  
   
     CIMValue nullValue;  
     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 1657 
Line 1747 
  
         // Get value:         // Get value:
  
         // ATTN: KS P1 4 March 2002. Does not set array type into value.  
         // ATTN: Thus, if it returns false, the CIMValue is nothing.  
         CIMValue value;  
   
         if (getValueArrayElement(parser, type, value))         if (getValueArrayElement(parser, type, value))
         {         {
             if (arraySize && arraySize != value.getArraySize())             if (arraySize && arraySize != value.getArraySize())
Line 1718 
Line 1804 
  
 Boolean XmlReader::getNameSpaceElement( Boolean XmlReader::getNameSpaceElement(
     XmlParser& parser,     XmlParser& parser,
     String& nameSpaceComponent)      CIMName& nameSpaceComponent)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1753 
Line 1839 
     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 1820 
Line 1906 
  
 Boolean XmlReader::getClassNameElement( Boolean XmlReader::getClassNameElement(
     XmlParser& parser,     XmlParser& parser,
     String& className,      CIMName& className,
     Boolean required)     Boolean required)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 1855 
Line 1941 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 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 1863 
Line 1949 
     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 1880 
Line 1966 
         elementName);         elementName);
  
     throw XmlSemanticError(lineNumber, buffer);     throw XmlSemanticError(lineNumber, buffer);
     return KeyBinding::BOOLEAN;      return CIMKeyBinding::BOOLEAN;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 1895 
Line 1981 
  
 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 1937 
Line 2023 
  
 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 1950 
Line 2036 
  
     if (!getKeyValueElement(parser, type, value))     if (!getKeyValueElement(parser, type, value))
     {     {
         CIMReference reference;          CIMObjectPath reference;
  
         if (!getValueReferenceElement(parser, reference))         if (!getValueReferenceElement(parser, reference))
         {         {
Line 1958 
Line 2044 
                       "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 1982 
Line 2068 
 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 2001 
Line 2087 
         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 2031 
Line 2117 
  
 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 2053 
Line 2139 
  
 Boolean XmlReader::getInstancePathElement( Boolean XmlReader::getInstancePathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2070 
Line 2156 
     }     }
  
     String className;     String className;
     Array<KeyBinding> keyBindings;      Array<CIMKeyBinding> keyBindings;
  
     if (!getInstanceNameElement(parser, className, keyBindings))     if (!getInstanceNameElement(parser, className, keyBindings))
     {     {
Line 2094 
Line 2180 
  
 Boolean XmlReader::getLocalInstancePathElement( Boolean XmlReader::getLocalInstancePathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2110 
Line 2196 
     }     }
  
     String className;     String className;
     Array<KeyBinding> keyBindings;      Array<CIMKeyBinding> keyBindings;
  
     if (!getInstanceNameElement(parser, className, keyBindings))     if (!getInstanceNameElement(parser, className, keyBindings))
     {     {
Line 2134 
Line 2220 
  
 Boolean XmlReader::getClassPathElement( Boolean XmlReader::getClassPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2150 
Line 2236 
             "expected NAMESPACEPATH element");             "expected NAMESPACEPATH element");
     }     }
  
     String className;      CIMName className;
  
     if (!getClassNameElement(parser, className))     if (!getClassNameElement(parser, className))
     {     {
Line 2174 
Line 2260 
  
 Boolean XmlReader::getLocalClassPathElement( Boolean XmlReader::getLocalClassPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2189 
Line 2275 
             "expected LOCALNAMESPACEPATH element");             "expected LOCALNAMESPACEPATH element");
     }     }
  
     String className;      CIMName className;
  
     if (!getClassNameElement(parser, className))     if (!getClassNameElement(parser, className))
     {     {
Line 2216 
Line 2302 
  
 Boolean XmlReader::getValueReferenceElement( Boolean XmlReader::getValueReferenceElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& reference)      CIMObjectPath& reference)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2248 
Line 2334 
     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 2266 
Line 2352 
     {     {
         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 2288 
Line 2374 
     CIMValue& value)     CIMValue& value)
 { {
     XmlEntry entry;     XmlEntry entry;
     Array<CIMReference> referenceArray;      Array<CIMObjectPath> referenceArray;
     CIMReference reference;      CIMObjectPath reference;
  
     value.clear();     value.clear();
  
Line 2340 
Line 2426 
  
     // 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 2360 
Line 2446 
  
     // 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 2369 
Line 2455 
     {     {
         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 2399 
Line 2485 
         {         {
             container.addProperty(property);             container.addProperty(property);
         }         }
         catch (AlreadyExists&)          catch (AlreadyExistsException&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate property");             throw XmlSemanticError(parser.getLine(), "duplicate property");
         }         }
Line 2430 
Line 2516 
  
     // 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 2475 
Line 2562 
  
     // 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 2525 
Line 2613 
  
     // 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 2571 
Line 2659 
  
     // Get PARAMETER.NAME attribute:     // Get PARAMETER.NAME attribute:
  
     String name = getCimNameAttribute(      CIMName name = getCimNameAttribute(
         parser.getLine(), entry, "PARAMETER.REFARRAY");         parser.getLine(), entry, "PARAMETER.REFARRAY");
  
     // Get PARAMETER.REFERENCECLASS attribute:     // Get PARAMETER.REFERENCECLASS attribute:
  
     String referenceClass = getReferenceClassAttribute(      CIMName referenceClass = getReferenceClassAttribute(
         parser.getLine(), entry, "PARAMETER.REFARRAY");         parser.getLine(), entry, "PARAMETER.REFARRAY");
  
     // Get PARAMETER.ARRAYSIZE attribute:     // Get PARAMETER.ARRAYSIZE attribute:
Line 2587 
Line 2675 
  
     // Create parameter:     // Create parameter:
  
     parameter = CIMParameter(name, CIMType::REFERENCE, true, arraySize,      parameter = CIMParameter(name, CIMTYPE_REFERENCE, true, arraySize,
                              referenceClass);                              referenceClass);
  
     if (!empty)     if (!empty)
Line 2619 
Line 2707 
         {         {
             container.addParameter(parameter);             container.addParameter(parameter);
         }         }
         catch (AlreadyExists&)          catch (AlreadyExistsException&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate parameter");             throw XmlSemanticError(parser.getLine(), "duplicate parameter");
         }         }
Line 2653 
Line 2741 
  
     // 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 2675 
Line 2763 
  
     // 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 2705 
Line 2795 
                     "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 2713 
Line 2805 
                 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 2720 
Line 2814 
         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 2755 
Line 2849 
  
     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 2797 
Line 2892 
     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 2873 
Line 2968 
  
 Boolean XmlReader::getNamedInstanceElement( Boolean XmlReader::getNamedInstanceElement(
     XmlParser& parser,     XmlParser& parser,
     CIMNamedInstance& namedInstance)      CIMInstance& namedInstance)
 { {
     XmlEntry entry;     XmlEntry entry;
  
     if (!testStartTag(parser, entry, "VALUE.NAMEDINSTANCE"))     if (!testStartTag(parser, entry, "VALUE.NAMEDINSTANCE"))
         return false;         return false;
  
     CIMReference instanceName;      CIMObjectPath instanceName;
  
     // Get INSTANCENAME elements:     // Get INSTANCENAME elements:
  
Line 2890 
Line 2985 
             "expected INSTANCENAME element");             "expected INSTANCENAME element");
     }     }
  
     CIMInstance instance;  
   
     // Get INSTANCE elements:     // Get INSTANCE elements:
  
     if (!getInstanceElement(parser, instance))      if (!getInstanceElement(parser, namedInstance))
     {     {
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "expected INSTANCE element");             "expected INSTANCE element");
Line 2904 
Line 2997 
  
     expectEndTag(parser, "VALUE.NAMEDINSTANCE");     expectEndTag(parser, "VALUE.NAMEDINSTANCE");
  
     namedInstance.set(instanceName, instance);      namedInstance.setPath (instanceName);
  
     return true;     return true;
 } }
Line 2974 
Line 3067 
  
     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 3084 
Line 3177 
  
     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 3110 
Line 3203 
  
 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 3133 
Line 3225 
         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 3171 
Line 3301 
     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 3181 
Line 3311 
         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 3194 
Line 3325 
             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 3203 
Line 3335 
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
   // 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 3210 
Line 3437 
  
 Boolean XmlReader::getObjectNameElement( Boolean XmlReader::getObjectNameElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& objectName)      CIMObjectPath& objectName)
 { {
     String className;      CIMName className;
  
     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 3238 
Line 3465 
  
 Boolean XmlReader::getObjectPathElement( Boolean XmlReader::getObjectPathElement(
     XmlParser& parser,     XmlParser& parser,
     CIMReference& objectPath)      CIMObjectPath& objectPath)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 3393 
Line 3620 
  
     // Get PARAMVALUE.PARAMTYPE attribute:     // Get PARAMVALUE.PARAMTYPE attribute:
  
     type = getCimTypeAttribute(parser.getLine(), entry, "PARAMVALUE",      Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,
                                "PARAMTYPE", false);                                            "PARAMVALUE", "PARAMTYPE", false);
  
     if (!empty)     if (!empty)
     {     {
         // Parse VALUE.REFERENCE and VALUE.REFARRAY type         // Parse VALUE.REFERENCE and VALUE.REFARRAY type
         if ( (type == CIMType::REFERENCE) || (type == CIMType::NONE) )          if ( (type == CIMTYPE_REFERENCE) || !gotType )
         {         {
             CIMReference reference;              CIMObjectPath reference;
             if (XmlReader::getValueReferenceElement(parser, reference))             if (XmlReader::getValueReferenceElement(parser, reference))
             {             {
                 value.set(reference);                 value.set(reference);
                 type = CIMType::REFERENCE;                  type = CIMTYPE_REFERENCE;
                   gotType = true;
             }             }
             else if (XmlReader::getValueReferenceArrayElement(parser, value))             else if (XmlReader::getValueReferenceArrayElement(parser, value))
             {             {
                 type = CIMType::REFERENCE;                  type = CIMTYPE_REFERENCE;
                   gotType = true;
             }             }
             // If type==reference but no VALUE.REFERENCE found, use null value             // If type==reference but no VALUE.REFERENCE found, use null value
         }         }
  
         // Parse non-reference value         // Parse non-reference value
         if ( type != CIMType::REFERENCE )          if ( type != CIMTYPE_REFERENCE )
           {
               CIMType effectiveType;
               if (!gotType)
         {         {
             // If we don't know what type the value is, read it as a String             // If we don't know what type the value is, read it as a String
             CIMType effectiveType = type;                  effectiveType = CIMTYPE_STRING;
             if ( effectiveType == CIMType::NONE)              }
               else
             {             {
                 effectiveType = CIMType::STRING;                  effectiveType = type;
             }             }
  
             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&
Line 3434 
Line 3667 
         expectEndTag(parser, "PARAMVALUE");         expectEndTag(parser, "PARAMVALUE");
     }     }
  
     paramValue = CIMParamValue(name, value, Boolean(type!=CIMType::NONE));      paramValue = CIMParamValue(name, value, gotType);
  
     return true;     return true;
 } }
Line 3463 
Line 3696 
     // Get RETURNVALUE.PARAMTYPE attribute:     // Get RETURNVALUE.PARAMTYPE attribute:
     // NOTE: Array type return values are not allowed (2/20/02)     // NOTE: Array type return values are not allowed (2/20/02)
  
     type = getCimTypeAttribute(parser.getLine(), entry, "RETURNVALUE",      Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,
                                "PARAMTYPE", false);                                            "RETURNVALUE", "PARAMTYPE", false);
  
     // Parse VALUE.REFERENCE type     // Parse VALUE.REFERENCE type
     if ( (type == CIMType::REFERENCE) || (type == CIMType::NONE) )      if ( (type == CIMTYPE_REFERENCE) || !gotType )
     {     {
         CIMReference reference;          CIMObjectPath reference;
         if (XmlReader::getValueReferenceElement(parser, reference))         if (XmlReader::getValueReferenceElement(parser, reference))
         {         {
             returnValue.set(reference);             returnValue.set(reference);
             type = CIMType::REFERENCE;              type = CIMTYPE_REFERENCE;
               gotType = true;
         }         }
         else if (type == CIMType::REFERENCE)          else if (type == CIMTYPE_REFERENCE)
         {         {
             throw XmlValidationError(parser.getLine(),             throw XmlValidationError(parser.getLine(),
                 "expected VALUE.REFERENCE element");                 "expected VALUE.REFERENCE element");
Line 3483 
Line 3717 
     }     }
  
     // Parse non-reference return value     // Parse non-reference return value
     if ( type != CIMType::REFERENCE )      if ( type != CIMTYPE_REFERENCE )
     {     {
         // If we don't know what type the value is, read it as a String          if (!gotType)
         if ( type == CIMType::NONE)  
         {         {
             type = CIMType::STRING;              // If we don't know what type the value is, read it as a String
               type = CIMTYPE_STRING;
         }         }
  
         if ( !XmlReader::getValueElement(parser, type, returnValue) )         if ( !XmlReader::getValueElement(parser, type, returnValue) )


Legend:
Removed from v.1.38  
changed lines
  Added in v.1.74

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2