(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.75 and 1.75.2.1

version 1.75, 2002/09/25 18:47:24 version 1.75.2.1, 2002/10/28 15:43:24
Line 45 
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 318 
Line 314 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMName XmlReader::getCimNameAttribute(  String XmlReader::getCimNameAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName,     const char* elementName,
Line 334 
Line 330 
     }     }
  
     if (acceptNull && name.size() == 0)     if (acceptNull && name.size() == 0)
         return CIMName ();          return name;
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
Line 343 
Line 339 
         throw XmlSemanticError(lineNumber, buffer);         throw XmlSemanticError(lineNumber, buffer);
     }     }
  
     return CIMName (name);      return name;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 387 
Line 383 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMName XmlReader::getClassOriginAttribute(  String XmlReader::getClassOriginAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* tagName)     const char* tagName)
Line 395 
Line 391 
     String name;     String name;
  
     if (!entry.getAttributeValue("CLASSORIGIN", name))     if (!entry.getAttributeValue("CLASSORIGIN", name))
         return CIMName();          return String();
   
     // 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 422 
Line 412 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMName XmlReader::getReferenceClassAttribute(  String XmlReader::getReferenceClassAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
Line 430 
Line 420 
     String name;     String name;
  
     if (!entry.getAttributeValue("REFERENCECLASS", name))     if (!entry.getAttributeValue("REFERENCECLASS", name))
         return CIMName();          return String();
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
Line 451 
Line 441 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMName XmlReader::getSuperClassAttribute(  String XmlReader::getSuperClassAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* tagName)     const char* tagName)
Line 459 
Line 449 
     String superClass;     String superClass;
  
     if (!entry.getAttributeValue("SUPERCLASS", superClass))     if (!entry.getAttributeValue("SUPERCLASS", superClass))
         return CIMName();          return String();
  
     if (!CIMName::legal(superClass))     if (!CIMName::legal(superClass))
     {     {
Line 490 
Line 480 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::getCimTypeAttribute(  CIMType 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 510 
Line 499 
         }         }
         else         else
         {         {
             return false;              return CIMTYPE_NONE;
         }         }
     }     }
  
     CIMType type = CIMTYPE_BOOLEAN;      CIMType type = CIMTYPE_NONE;
     Boolean unrecognizedType = false;  
  
     if (strcmp(typeName, "boolean") == 0)     if (strcmp(typeName, "boolean") == 0)
         type = CIMTYPE_BOOLEAN;         type = CIMTYPE_BOOLEAN;
Line 547 
Line 535 
         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 (unrecognizedType ||      if ((type == CIMTYPE_NONE) ||
         ((type == CIMTYPE_REFERENCE) &&         ((type == CIMTYPE_REFERENCE) &&
          (strcmp(attributeName, "PARAMTYPE") != 0)))          (strcmp(attributeName, "PARAMTYPE") != 0)))
     {     {
Line 559 
Line 546 
         throw XmlSemanticError(lineNumber, message);         throw XmlSemanticError(lineNumber, message);
     }     }
  
     cimType = type;      return type;
     return true;  
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 597 
Line 583 
         return false;         return false;
  
     char buffer[62];     char buffer[62];
     sprintf(buffer, "Invalid %s.%s attribute value", attributeName, tagName);      sprintf(buffer, "Bad %s.%s attribute value", attributeName, tagName);
     throw XmlSemanticError(lineNumber, buffer);     throw XmlSemanticError(lineNumber, buffer);
     return false;     return false;
 } }
Line 747 
Line 733 
             while (isxdigit(*p))             while (isxdigit(*p))
             {             {
                 // Make sure we won't overflow when we multiply by 16                 // Make sure we won't overflow when we multiply by 16
                 if (x < PEGASUS_SINT64_MIN/16)                  if (x < PEGASUS_LLONG_MIN/16)
                 {                 {
                     return false;                     return false;
                 }                 }
Line 755 
Line 741 
  
                 // Make sure we don't overflow when we add the next digit                 // Make sure we don't overflow when we add the next digit
                 Sint64 newDigit = Sint64(_hexCharToNumeric(*p++));                 Sint64 newDigit = Sint64(_hexCharToNumeric(*p++));
                 if (PEGASUS_SINT64_MIN - x > -newDigit)                  if (PEGASUS_LLONG_MIN - x > -newDigit)
                 {                 {
                     return false;                     return false;
                 }                 }
Line 770 
Line 756 
             // overflow error             // overflow error
             if (!negative)             if (!negative)
             {             {
                 if (x == PEGASUS_SINT64_MIN)                  if (x == PEGASUS_LLONG_MIN)
                 {                 {
                     return false;                     return false;
                 }                 }
Line 798 
Line 784 
     while (isdigit(*p))     while (isdigit(*p))
     {     {
         // Make sure we won't overflow when we multiply by 10         // Make sure we won't overflow when we multiply by 10
         if (x < PEGASUS_SINT64_MIN/10)          if (x < PEGASUS_LLONG_MIN/10)
         {         {
             return false;             return false;
         }         }
Line 806 
Line 792 
  
         // Make sure we won't overflow when we add the next digit         // Make sure we won't overflow when we add the next digit
         Sint64 newDigit = (*p++ - '0');         Sint64 newDigit = (*p++ - '0');
         if (PEGASUS_SINT64_MIN - x > -newDigit)          if (PEGASUS_LLONG_MIN - x > -newDigit)
         {         {
             return false;             return false;
         }         }
Line 821 
Line 807 
     // overflow error     // overflow error
     if (!negative)     if (!negative)
     {     {
         if (x == PEGASUS_SINT64_MIN)          if (x == PEGASUS_LLONG_MIN)
         {         {
             return false;             return false;
         }         }
Line 867 
Line 853 
             while (isxdigit(*p))             while (isxdigit(*p))
             {             {
                 // Make sure we won't overflow when we multiply by 16                 // Make sure we won't overflow when we multiply by 16
                 if (x > PEGASUS_UINT64_MAX/16)                  if (x > PEGASUS_ULLONG_MAX/16)
                 {                 {
                     return false;                     return false;
                 }                 }
Line 875 
Line 861 
  
                 // We can't overflow when we add the next digit                 // We can't overflow when we add the next digit
                 Uint64 newDigit = Uint64(_hexCharToNumeric(*p++));                 Uint64 newDigit = Uint64(_hexCharToNumeric(*p++));
                 if (PEGASUS_UINT64_MAX - x < newDigit)                  if (PEGASUS_ULLONG_MAX - x < newDigit)
                 {                 {
                     return false;                     return false;
                 }                 }
Line 901 
Line 887 
     while (isdigit(*p))     while (isdigit(*p))
     {     {
         // Make sure we won't overflow when we multiply by 10         // Make sure we won't overflow when we multiply by 10
         if (x > PEGASUS_UINT64_MAX/10)          if (x > PEGASUS_ULLONG_MAX/10)
         {         {
             return false;             return false;
         }         }
Line 909 
Line 895 
  
         // Make sure we won't overflow when we add the next digit         // Make sure we won't overflow when we add the next digit
         Uint64 newDigit = (*p++ - '0');         Uint64 newDigit = (*p++ - '0');
         if (PEGASUS_UINT64_MAX - x < newDigit)          if (PEGASUS_ULLONG_MAX - x < newDigit)
         {         {
             return false;             return false;
         }         }
Line 946 
Line 932 
     {     {
         case CIMTYPE_BOOLEAN:         case CIMTYPE_BOOLEAN:
         {         {
             if (System::strcasecmp(valueString, "TRUE") == 0)              if (CompareNoCase(valueString, "TRUE") == 0)
                 return CIMValue(true);                 return CIMValue(true);
             else if (System::strcasecmp(valueString, "FALSE") == 0)              else if (CompareNoCase(valueString, "FALSE") == 0)
                 return CIMValue(false);                 return CIMValue(false);
             else             else
                 throw XmlSemanticError(                 throw XmlSemanticError(
                     lineNumber, "Invalid boolean value");                      lineNumber, "Bad boolean value");
         }         }
  
         case CIMTYPE_STRING:         case CIMTYPE_STRING:
Line 963 
Line 949 
         case CIMTYPE_CHAR16:         case CIMTYPE_CHAR16:
         {         {
             if (strlen(valueString) != 1)             if (strlen(valueString) != 1)
                 throw XmlSemanticError(lineNumber, "Invalid char16 value");                  throw XmlSemanticError(lineNumber, "Bad char16 value");
  
             return CIMValue(Char16(valueString[0]));             return CIMValue(Char16(valueString[0]));
         }         }
Line 978 
Line 964 
             if (!stringToUnsignedInteger(valueString, x))             if (!stringToUnsignedInteger(valueString, x))
             {             {
                 throw XmlSemanticError(                 throw XmlSemanticError(
                     lineNumber, "Invalid unsigned integer value");                      lineNumber, "Bad unsigned integer value");
             }             }
  
             switch (type)             switch (type)
Line 1025 
Line 1011 
             if (!stringToSignedInteger(valueString, x))             if (!stringToSignedInteger(valueString, x))
             {             {
                 throw XmlSemanticError(                 throw XmlSemanticError(
                     lineNumber, "Invalid signed integer value");                      lineNumber, "Bad signed integer value");
             }             }
  
             switch (type)             switch (type)
Line 1070 
Line 1056 
             {             {
                 tmp.set(valueString);                 tmp.set(valueString);
             }             }
             catch (InvalidDateTimeFormatException&)              catch (BadDateTimeFormat&)
             {             {
                 throw XmlSemanticError(lineNumber, "Invalid datetime value");                  throw XmlSemanticError(lineNumber, "Bad datetime value");
             }             }
  
             return CIMValue(tmp);             return CIMValue(tmp);
Line 1083 
Line 1069 
             Real64 x;             Real64 x;
  
             if (!stringToReal(valueString, x))             if (!stringToReal(valueString, x))
                 throw XmlSemanticError(lineNumber, "Invalid real number value");                  throw XmlSemanticError(lineNumber, "Bad real number value");
  
             return CIMValue(Real32(x));             return CIMValue(Real32(x));
         }         }
Line 1093 
Line 1079 
             Real64 x;             Real64 x;
  
             if (!stringToReal(valueString, x))             if (!stringToReal(valueString, x))
                 throw XmlSemanticError(lineNumber, "Invalid real number value");                  throw XmlSemanticError(lineNumber, "Bad real number value");
  
             return CIMValue(x);             return CIMValue(x);
         }         }
Line 1389 
Line 1375 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMFlavor XmlReader::getFlavor(  Uint32 XmlReader::getFlavor(
     XmlEntry& entry,     XmlEntry& entry,
     Uint32 lineNumber,     Uint32 lineNumber,
     const char* tagName)     const char* tagName)
Line 1416 
Line 1402 
  
     // Start with CIMFlavor::NONE.  Defaults are specified in the     // Start with CIMFlavor::NONE.  Defaults are specified in the
     // getCimBooleanAttribute() calls above.     // getCimBooleanAttribute() calls above.
     CIMFlavor flavor = CIMFlavor (CIMFlavor::NONE);      Uint32 flavor = CIMFlavor::NONE;
  
     if (overridable)     if (overridable)
         flavor.addFlavor (CIMFlavor::OVERRIDABLE);          flavor |= CIMFlavor::OVERRIDABLE;
     else     else
         flavor.addFlavor (CIMFlavor::DISABLEOVERRIDE);                  flavor |= CIMFlavor::DISABLEOVERRIDE;
  
     if (toSubClass)     if (toSubClass)
         flavor.addFlavor (CIMFlavor::TOSUBCLASS);          flavor |= CIMFlavor::TOSUBCLASS;
     else     else
         flavor.addFlavor (CIMFlavor::RESTRICTED);                  flavor |= CIMFlavor::RESTRICTED;
  
     if (toInstance)     if (toInstance)
         flavor.addFlavor (CIMFlavor::TOINSTANCE);          flavor |= CIMFlavor::TOINSTANCE;
  
     if (translatable)     if (translatable)
         flavor.addFlavor (CIMFlavor::TRANSLATABLE);          flavor |= CIMFlavor::TRANSLATABLE;
  
     return flavor;     return flavor;
 } }
Line 1454 
Line 1440 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMScope XmlReader::getOptionalScope(XmlParser& parser)  Uint32 XmlReader::getOptionalScope(XmlParser& parser)
 { {
     XmlEntry entry;     XmlEntry entry;
     CIMScope scope;  
  
     if (!parser.next(entry))     if (!parser.next(entry))
         return scope;    // No SCOPE element found; return the empty scope          return false;
  
     Boolean isEmptyTag = entry.type == XmlEntry::EMPTY_TAG;     Boolean isEmptyTag = entry.type == XmlEntry::EMPTY_TAG;
  
Line 1468 
Line 1453 
         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 scope;          return 0;
     }     }
  
     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.addScope (CIMScope::CLASS);          scope |= CIMScope::CLASS;
  
     if (getCimBooleanAttribute(     if (getCimBooleanAttribute(
         line, entry, "SCOPE", "ASSOCIATION", false, false))         line, entry, "SCOPE", "ASSOCIATION", false, false))
         scope.addScope (CIMScope::ASSOCIATION);          scope |= CIMScope::ASSOCIATION;
  
     if (getCimBooleanAttribute(     if (getCimBooleanAttribute(
         line, entry, "SCOPE", "REFERENCE", false, false))         line, entry, "SCOPE", "REFERENCE", false, false))
         scope.addScope (CIMScope::REFERENCE);          scope |= CIMScope::REFERENCE;
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "PROPERTY", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "PROPERTY", false, false))
         scope.addScope (CIMScope::PROPERTY);          scope |= CIMScope::PROPERTY;
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "METHOD", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "METHOD", false, false))
         scope.addScope (CIMScope::METHOD);          scope |= CIMScope::METHOD;
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "PARAMETER", false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "PARAMETER", false, false))
         scope.addScope (CIMScope::PARAMETER);          scope |= CIMScope::PARAMETER;
  
     if (getCimBooleanAttribute(line, entry, "SCOPE", "INDICATION",false, false))     if (getCimBooleanAttribute(line, entry, "SCOPE", "INDICATION",false, false))
         scope.addScope (CIMScope::INDICATION);          scope |= CIMScope::INDICATION;
  
     if (!isEmptyTag)     if (!isEmptyTag)
         expectEndTag(parser, "SCOPE");         expectEndTag(parser, "SCOPE");
Line 1529 
Line 1514 
  
     // Get QUALIFIER.NAME attribute:     // Get QUALIFIER.NAME attribute:
  
     CIMName name = getCimNameAttribute(parser.getLine(), entry, "QUALIFIER");      String name = getCimNameAttribute(parser.getLine(), entry, "QUALIFIER");
  
     // Get QUALIFIER.TYPE attribute:     // Get QUALIFIER.TYPE attribute:
  
     CIMType type;      CIMType type = getCimTypeAttribute(parser.getLine(), entry, "QUALIFIER");
     getCimTypeAttribute(parser.getLine(), entry, type, "QUALIFIER");  
  
     // Get QUALIFIER.PROPAGATED     // Get QUALIFIER.PROPAGATED
  
Line 1543 
Line 1527 
  
     // Get flavor oriented attributes:     // Get flavor oriented attributes:
  
     CIMFlavor flavor = getFlavor(entry, parser.getLine(), "QUALIFIER");      Uint32 flavor = getFlavor(entry, parser.getLine(), "QUALIFIER");
  
     // Get VALUE or VALUE.ARRAY element:     // Get VALUE or VALUE.ARRAY element:
  
Line 1582 
Line 1566 
         {         {
             container.addQualifier(qualifier);             container.addQualifier(qualifier);
         }         }
         catch (AlreadyExistsException&)          catch (AlreadyExists&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate qualifier");             throw XmlSemanticError(parser.getLine(), "duplicate qualifier");
         }         }
Line 1613 
Line 1597 
  
     // Get PROPERTY.NAME attribute:     // Get PROPERTY.NAME attribute:
  
     CIMName name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");      String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");
  
     // Get PROPERTY.CLASSORIGIN attribute:     // Get PROPERTY.CLASSORIGIN attribute:
  
     CIMName classOrigin =      String classOrigin =
         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");
  
     // Get PROPERTY.PROPAGATED     // Get PROPERTY.PROPAGATED
Line 1627 
Line 1611 
  
     // Get PROPERTY.TYPE attribute:     // Get PROPERTY.TYPE attribute:
  
     CIMType type;      CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY");
     getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY");  
  
     // Create property: Sets type and !isarray     // Create property: Sets type and !isarray
  
     CIMValue value(type, false);     CIMValue value(type, false);
     property = CIMProperty(name, value, 0, CIMName(), classOrigin, propagated);      property = CIMProperty(name, value, 0, String(), classOrigin, propagated);
  
     if (!empty)     if (!empty)
     {     {
Line 1716 
Line 1699 
  
     // Get PROPERTY.NAME attribute:     // Get PROPERTY.NAME attribute:
  
     CIMName name =      String name =
         getCimNameAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");         getCimNameAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");
  
     // Get PROPERTY.TYPE attribute:     // Get PROPERTY.TYPE attribute:
  
     CIMType type;      CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");
     getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY.ARRAY");  
  
     // Get PROPERTY.ARRAYSIZE attribute:     // Get PROPERTY.ARRAYSIZE attribute:
  
Line 1731 
Line 1713 
  
     // Get PROPERTY.CLASSORIGIN attribute:     // Get PROPERTY.CLASSORIGIN attribute:
  
     CIMName classOrigin      String classOrigin
         = getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");         = getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.ARRAY");
  
     // Get PROPERTY.ARRAY.PROPAGATED     // Get PROPERTY.ARRAY.PROPAGATED
Line 1743 
Line 1725 
  
     CIMValue value(type, true, arraySize);     CIMValue value(type, true, arraySize);
     property = CIMProperty(     property = CIMProperty(
         name, value, arraySize, CIMName(), classOrigin, propagated);          name, value, arraySize, String(), classOrigin, propagated);
  
     if (!empty)     if (!empty)
     {     {
Line 1810 
Line 1792 
  
 Boolean XmlReader::getNameSpaceElement( Boolean XmlReader::getNameSpaceElement(
     XmlParser& parser,     XmlParser& parser,
     CIMName& nameSpaceComponent)      String& nameSpaceComponent)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1845 
Line 1827 
     if (!testStartTag(parser, entry, "LOCALNAMESPACEPATH"))     if (!testStartTag(parser, entry, "LOCALNAMESPACEPATH"))
         return false;         return false;
  
     CIMName nameSpaceComponent;      String nameSpaceComponent;
  
     while (getNameSpaceElement(parser, nameSpaceComponent))     while (getNameSpaceElement(parser, nameSpaceComponent))
     {     {
         if (nameSpace.size())         if (nameSpace.size())
             nameSpace.append('/');              nameSpace += '/';
  
         nameSpace.append(nameSpaceComponent.getString());          nameSpace += nameSpaceComponent;
     }     }
  
     if (!nameSpace.size())     if (!nameSpace.size())
Line 1912 
Line 1894 
  
 Boolean XmlReader::getClassNameElement( Boolean XmlReader::getClassNameElement(
     XmlParser& parser,     XmlParser& parser,
     CIMName& className,      String& className,
     Boolean required)     Boolean required)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 1947 
Line 1929 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 CIMKeyBinding::Type XmlReader::getValueTypeAttribute(  KeyBinding::Type XmlReader::getValueTypeAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
Line 1955 
Line 1937 
     String tmp;     String tmp;
  
     if (!entry.getAttributeValue("VALUETYPE", tmp))     if (!entry.getAttributeValue("VALUETYPE", tmp))
         return CIMKeyBinding::STRING;          return KeyBinding::STRING;
  
     if (String::equal(tmp, "string"))     if (String::equal(tmp, "string"))
         return CIMKeyBinding::STRING;          return KeyBinding::STRING;
     else if (String::equal(tmp, "boolean"))     else if (String::equal(tmp, "boolean"))
         return CIMKeyBinding::BOOLEAN;          return KeyBinding::BOOLEAN;
     else if (String::equal(tmp, "numeric"))     else if (String::equal(tmp, "numeric"))
         return CIMKeyBinding::NUMERIC;          return KeyBinding::NUMERIC;
  
     char buffer[MESSAGE_SIZE];     char buffer[MESSAGE_SIZE];
  
Line 1972 
Line 1954 
         elementName);         elementName);
  
     throw XmlSemanticError(lineNumber, buffer);     throw XmlSemanticError(lineNumber, buffer);
     return CIMKeyBinding::BOOLEAN;      return KeyBinding::BOOLEAN;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 1987 
Line 1969 
  
 Boolean XmlReader::getKeyValueElement( Boolean XmlReader::getKeyValueElement(
     XmlParser& parser,     XmlParser& parser,
     CIMKeyBinding::Type& type,      KeyBinding::Type& type,
     String& value)     String& value)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 2029 
Line 2011 
  
 Boolean XmlReader::getKeyBindingElement( Boolean XmlReader::getKeyBindingElement(
     XmlParser& parser,     XmlParser& parser,
     CIMName& name,      String& name,
     String& value,     String& value,
     CIMKeyBinding::Type& type)      KeyBinding::Type& type)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 2050 
Line 2032 
                       "Expected KEYVALUE or VALUE.REFERENCE element");                       "Expected KEYVALUE or VALUE.REFERENCE element");
         }         }
  
         type = CIMKeyBinding::REFERENCE;          type = KeyBinding::REFERENCE;
         value = reference.toString();         value = reference.toString();
     }     }
  
Line 2074 
Line 2056 
 Boolean XmlReader::getInstanceNameElement( Boolean XmlReader::getInstanceNameElement(
     XmlParser& parser,     XmlParser& parser,
     String& className,     String& className,
     Array<CIMKeyBinding>& keyBindings)      Array<KeyBinding>& keyBindings)
 { {
     className.clear();     className.clear();
     keyBindings.clear();     keyBindings.clear();
Line 2093 
Line 2075 
         return true;         return true;
     }     }
  
     CIMName name;      String name;
     CIMKeyBinding::Type type;      KeyBinding::Type type;
     String value;     String value;
     CIMObjectPath 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(CIMKeyBinding(name, value, type));          keyBindings.append(KeyBinding(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 = CIMKeyBinding::REFERENCE;          type = KeyBinding::REFERENCE;
         value = reference.toString();         value = reference.toString();
         keyBindings.append(CIMKeyBinding(name, value, type));          keyBindings.append(KeyBinding(name, value, type));
     }     }
     else     else
     {     {
         while (getKeyBindingElement(parser, name, value, type))         while (getKeyBindingElement(parser, name, value, type))
             keyBindings.append(CIMKeyBinding(name, value, type));              keyBindings.append(KeyBinding(name, value, type));
     }     }
  
     expectEndTag(parser, "INSTANCENAME");     expectEndTag(parser, "INSTANCENAME");
Line 2126 
Line 2108 
     CIMObjectPath& instanceName)     CIMObjectPath& instanceName)
 { {
     String className;     String className;
     Array<CIMKeyBinding> keyBindings;      Array<KeyBinding> keyBindings;
  
     if (!XmlReader::getInstanceNameElement(parser, className, keyBindings))     if (!XmlReader::getInstanceNameElement(parser, className, keyBindings))
         return false;         return false;
  
     instanceName.set(String(), CIMNamespaceName(), className, keyBindings);      instanceName.set(String(), String(), className, keyBindings);
     return true;     return true;
 } }
  
Line 2162 
Line 2144 
     }     }
  
     String className;     String className;
     Array<CIMKeyBinding> keyBindings;      Array<KeyBinding> keyBindings;
  
     if (!getInstanceNameElement(parser, className, keyBindings))     if (!getInstanceNameElement(parser, className, keyBindings))
     {     {
Line 2202 
Line 2184 
     }     }
  
     String className;     String className;
     Array<CIMKeyBinding> keyBindings;      Array<KeyBinding> keyBindings;
  
     if (!getInstanceNameElement(parser, className, keyBindings))     if (!getInstanceNameElement(parser, className, keyBindings))
     {     {
Line 2242 
Line 2224 
             "expected NAMESPACEPATH element");             "expected NAMESPACEPATH element");
     }     }
  
     CIMName className;      String className;
  
     if (!getClassNameElement(parser, className))     if (!getClassNameElement(parser, className))
     {     {
Line 2281 
Line 2263 
             "expected LOCALNAMESPACEPATH element");             "expected LOCALNAMESPACEPATH element");
     }     }
  
     CIMName className;      String className;
  
     if (!getClassNameElement(parser, className))     if (!getClassNameElement(parser, className))
     {     {
Line 2340 
Line 2322 
     else if (strcmp(entry.text, "CLASSNAME") == 0)     else if (strcmp(entry.text, "CLASSNAME") == 0)
     {     {
         parser.putBack(entry);         parser.putBack(entry);
         CIMName className;          String className;
         getClassNameElement(parser, className);         getClassNameElement(parser, className);
         reference.set(String(), CIMNamespaceName(), className);          reference.set(String(), String(), className);
     }     }
     else if (strcmp(entry.text, "INSTANCEPATH") == 0)     else if (strcmp(entry.text, "INSTANCEPATH") == 0)
     {     {
Line 2358 
Line 2340 
     {     {
         parser.putBack(entry);         parser.putBack(entry);
         String className;         String className;
         Array<CIMKeyBinding> keyBindings;          Array<KeyBinding> keyBindings;
         getInstanceNameElement(parser, className, keyBindings);         getInstanceNameElement(parser, className, keyBindings);
         reference.set(String(), CIMNamespaceName(), className, keyBindings);          reference.set(String(), String(), className, keyBindings);
     }     }
  
     expectEndTag(parser, "VALUE.REFERENCE");     expectEndTag(parser, "VALUE.REFERENCE");
Line 2432 
Line 2414 
  
     // Get PROPERTY.NAME attribute:     // Get PROPERTY.NAME attribute:
  
     CIMName name = getCimNameAttribute(      String name = getCimNameAttribute(
         parser.getLine(), entry, "PROPERTY.REFERENCE");         parser.getLine(), entry, "PROPERTY.REFERENCE");
  
     // Get PROPERTY.REFERENCECLASS attribute:     // Get PROPERTY.REFERENCECLASS attribute:
  
     CIMName referenceClass = getReferenceClassAttribute(      String referenceClass = getReferenceClassAttribute(
         parser.getLine(), entry, "PROPERTY.REFERENCE");         parser.getLine(), entry, "PROPERTY.REFERENCE");
  
     // Get PROPERTY.CLASSORIGIN attribute:     // Get PROPERTY.CLASSORIGIN attribute:
  
     CIMName classOrigin =      String classOrigin =
         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.REFERENCE");         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY.REFERENCE");
  
     // Get PROPERTY.PROPAGATED     // Get PROPERTY.PROPAGATED
Line 2491 
Line 2473 
         {         {
             container.addProperty(property);             container.addProperty(property);
         }         }
         catch (AlreadyExistsException&)          catch (AlreadyExists&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate property");             throw XmlSemanticError(parser.getLine(), "duplicate property");
         }         }
Line 2522 
Line 2504 
  
     // Get PARAMETER.NAME attribute:     // Get PARAMETER.NAME attribute:
  
     CIMName name = getCimNameAttribute(parser.getLine(), entry, "PARAMETER");      String name = getCimNameAttribute(parser.getLine(), entry, "PARAMETER");
  
     // Get PARAMETER.TYPE attribute:     // Get PARAMETER.TYPE attribute:
  
     CIMType type;      CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PARAMETER");
     getCimTypeAttribute(parser.getLine(), entry, type, "PARAMETER");  
  
     // Create parameter:     // Create parameter:
  
Line 2568 
Line 2549 
  
     // Get PARAMETER.ARRAY.NAME attribute:     // Get PARAMETER.ARRAY.NAME attribute:
  
     CIMName name = getCimNameAttribute(      String name = getCimNameAttribute(
         parser.getLine(), entry, "PARAMETER.ARRAY");         parser.getLine(), entry, "PARAMETER.ARRAY");
  
     // Get PARAMETER.ARRAY.TYPE attribute:     // Get PARAMETER.ARRAY.TYPE attribute:
  
     CIMType type;      CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PARAMETER.ARRAY");
     getCimTypeAttribute(parser.getLine(), entry, type, "PARAMETER.ARRAY");  
  
     // Get PARAMETER.ARRAYSIZE attribute:     // Get PARAMETER.ARRAYSIZE attribute:
  
Line 2619 
Line 2599 
  
     // Get PARAMETER.NAME attribute:     // Get PARAMETER.NAME attribute:
  
     CIMName name = getCimNameAttribute(      String name = getCimNameAttribute(
         parser.getLine(), entry, "PARAMETER.REFERENCE");         parser.getLine(), entry, "PARAMETER.REFERENCE");
  
     // Get PARAMETER.REFERENCECLASS attribute:     // Get PARAMETER.REFERENCECLASS attribute:
  
     CIMName referenceClass = getReferenceClassAttribute(      String referenceClass = getReferenceClassAttribute(
         parser.getLine(), entry, "PARAMETER.REFERENCE");         parser.getLine(), entry, "PARAMETER.REFERENCE");
  
     // Create parameter:     // Create parameter:
Line 2665 
Line 2645 
  
     // Get PARAMETER.NAME attribute:     // Get PARAMETER.NAME attribute:
  
     CIMName name = getCimNameAttribute(      String name = getCimNameAttribute(
         parser.getLine(), entry, "PARAMETER.REFARRAY");         parser.getLine(), entry, "PARAMETER.REFARRAY");
  
     // Get PARAMETER.REFERENCECLASS attribute:     // Get PARAMETER.REFERENCECLASS attribute:
  
     CIMName referenceClass = getReferenceClassAttribute(      String referenceClass = getReferenceClassAttribute(
         parser.getLine(), entry, "PARAMETER.REFARRAY");         parser.getLine(), entry, "PARAMETER.REFARRAY");
  
     // Get PARAMETER.ARRAYSIZE attribute:     // Get PARAMETER.ARRAYSIZE attribute:
Line 2713 
Line 2693 
         {         {
             container.addParameter(parameter);             container.addParameter(parameter);
         }         }
         catch (AlreadyExistsException&)          catch (AlreadyExists&)
         {         {
             throw XmlSemanticError(parser.getLine(), "duplicate parameter");             throw XmlSemanticError(parser.getLine(), "duplicate parameter");
         }         }
Line 2747 
Line 2727 
  
     // Get NAME attribute:     // Get NAME attribute:
  
     CIMName name = getCimNameAttribute(      String name = getCimNameAttribute(
         parser.getLine(), entry, "QUALIFIER.DECLARATION");         parser.getLine(), entry, "QUALIFIER.DECLARATION");
  
     // Get TYPE attribute:     // Get TYPE attribute:
  
     CIMType type;      CIMType type = getCimTypeAttribute(
     getCimTypeAttribute(parser.getLine(), entry, type, "QUALIFIER.DECLARATION");          parser.getLine(), entry, "QUALIFIER.DECLARATION");
  
     // Get ISARRAY attribute:     // Get ISARRAY attribute:
  
Line 2769 
Line 2749 
  
     // Get flavor oriented attributes:     // Get flavor oriented attributes:
  
     CIMFlavor flavor = getFlavor (entry, parser.getLine (),      Uint32 flavor = getFlavor(entry,parser.getLine(), "QUALIFIER.DECLARATION");
         "QUALIFIER.DECLARATION");  
  
     // No need to look for interior elements if empty tag:     // No need to look for interior elements if empty tag:
  
     CIMScope scope = CIMScope ();      Uint32 scope = CIMScope::NONE;
     CIMValue value;     CIMValue value;
     Boolean gotValue = false;  
  
     if (!empty)     if (!empty)
     {     {
Line 2801 
Line 2779 
                     "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 2811 
Line 2787 
                 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 2820 
Line 2794 
         expectEndTag(parser, "QUALIFIER.DECLARATION");         expectEndTag(parser, "QUALIFIER.DECLARATION");
     }     }
  
     if (!gotValue)      if (value.getType() == CIMTYPE_NONE)
     {     {
         if (isArray)         if (isArray)
             value.setNullValue(type, true, arraySize);             value.setNullValue(type, true, arraySize);
Line 2855 
Line 2829 
  
     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
  
     CIMName name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");      String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY");
  
     CIMType type;      CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY");
     getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY");  
  
     CIMName classOrigin =      String classOrigin =
         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");         getClassOriginAttribute(parser.getLine(), entry, "PROPERTY");
  
     Boolean propagated = getCimBooleanAttribute(     Boolean propagated = getCimBooleanAttribute(
Line 2898 
Line 2871 
     if (!testStartTag(parser, entry, "CLASS"))     if (!testStartTag(parser, entry, "CLASS"))
         return false;         return false;
  
     CIMName name = getCimNameAttribute(parser.getLine(), entry, "CLASS");      String name = getCimNameAttribute(parser.getLine(), entry, "CLASS");
  
     CIMName superClass = getSuperClassAttribute(parser.getLine(), entry,"CLASS");      String superClass = getSuperClassAttribute(parser.getLine(), entry,"CLASS");
  
     cimClass = CIMClass(name, superClass);     cimClass = CIMClass(name, superClass);
  
Line 3073 
Line 3046 
  
     if (!entry.getAttributeValue("ID", id))     if (!entry.getAttributeValue("ID", id))
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Invalid or missing MESSAGE.ID attribute");              "Bad 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(),
             "Invalid or missing MESSAGE.PROTOCOLVERSION attribute");              "Bad or missing MESSAGE.PROTOCOLVERSION attribute");
  
     return true;     return true;
 } }
Line 3183 
Line 3156 
  
     expectContentOrCData(parser, entry);     expectContentOrCData(parser, entry);
  
     if (System::strcasecmp(entry.text, "TRUE") == 0)      if (CompareNoCase(entry.text, "TRUE") == 0)
         result = true;         result = true;
     else if (System::strcasecmp(entry.text, "FALSE") == 0)      else if (CompareNoCase(entry.text, "FALSE") == 0)
         result = false;         result = false;
     else     else
         throw XmlSemanticError(parser.getLine(),         throw XmlSemanticError(parser.getLine(),
             "Invalid value for VALUE element: must be \"TRUE\" or \"FALSE\"");              "Bad value for VALUE element: must be \"TRUE\" or \"FALSE\"");
  
     expectEndTag(parser, "VALUE");     expectEndTag(parser, "VALUE");
  
Line 3445 
Line 3418 
     XmlParser& parser,     XmlParser& parser,
     CIMObjectPath& objectName)     CIMObjectPath& objectName)
 { {
     CIMName className;      String className;
  
     if (getClassNameElement(parser, className, false))     if (getClassNameElement(parser, className, false))
     {     {
         objectName.set(String(), CIMNamespaceName(), className);          objectName.set(String(), String(), className);
         return true;         return true;
     }     }
     else if (getInstanceNameElement(parser, objectName))     else if (getInstanceNameElement(parser, objectName))
Line 3626 
Line 3599 
  
     // Get PARAMVALUE.PARAMTYPE attribute:     // Get PARAMVALUE.PARAMTYPE attribute:
  
     Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,      type = getCimTypeAttribute(parser.getLine(), entry, "PARAMVALUE",
                                           "PARAMVALUE", "PARAMTYPE", false);                                 "PARAMTYPE", false);
  
     if (!empty)     if (!empty)
     {     {
         // Parse VALUE.REFERENCE and VALUE.REFARRAY type         // Parse VALUE.REFERENCE and VALUE.REFARRAY type
         if ( (type == CIMTYPE_REFERENCE) || !gotType )          if ( (type == CIMTYPE_REFERENCE) || (type == CIMTYPE_NONE) )
         {         {
             CIMObjectPath 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
         }         }
Line 3652 
Line 3623 
         // 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
                 effectiveType = CIMTYPE_STRING;              CIMType effectiveType = type;
             }              if ( effectiveType == CIMTYPE_NONE)
             else  
             {             {
                 effectiveType = type;                  effectiveType = CIMTYPE_STRING;
             }             }
  
             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&
Line 3673 
Line 3640 
         expectEndTag(parser, "PARAMVALUE");         expectEndTag(parser, "PARAMVALUE");
     }     }
  
     paramValue = CIMParamValue(name, value, gotType);      paramValue = CIMParamValue(name, value, Boolean(type!=CIMTYPE_NONE));
  
     return true;     return true;
 } }
Line 3702 
Line 3669 
     // 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)
  
     Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,      type = getCimTypeAttribute(parser.getLine(), entry, "RETURNVALUE",
                                           "RETURNVALUE", "PARAMTYPE", false);                                 "PARAMTYPE", false);
  
     // Parse VALUE.REFERENCE type     // Parse VALUE.REFERENCE type
     if ( (type == CIMTYPE_REFERENCE) || !gotType )      if ( (type == CIMTYPE_REFERENCE) || (type == CIMTYPE_NONE) )
     {     {
         CIMObjectPath 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)
         {         {
Line 3725 
Line 3691 
     // Parse non-reference return value     // Parse non-reference return value
     if ( type != CIMTYPE_REFERENCE )     if ( type != CIMTYPE_REFERENCE )
     {     {
         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
           if ( type == CIMTYPE_NONE)
           {
             type = CIMTYPE_STRING;             type = CIMTYPE_STRING;
         }         }
  


Legend:
Removed from v.1.75  
changed lines
  Added in v.1.75.2.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2