(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.127.4.2 and 1.144.4.5

version 1.127.4.2, 2008/02/06 00:08:50 version 1.144.4.5, 2013/06/09 17:18:38
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  //
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  // Permission is hereby granted, free of charge, to any person obtaining a
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  // copy of this software and associated documentation files (the "Software"),
 // EMC Corporation; Symantec Corporation; The Open Group.  // to deal in the Software without restriction, including without limitation
 //  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // and/or sell copies of the Software, and to permit persons to whom the
 // of this software and associated documentation files (the "Software"), to  // Software is furnished to do so, subject to the following conditions:
 // deal in the Software without restriction, including without limitation the  //
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // The above copyright notice and this permission notice shall be included
 // sell copies of the Software, and to permit persons to whom the Software is  // in all copies or substantial portions of the Software.
 // furnished to do so, subject to the following conditions:  //
 //  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
   #include <Pegasus/Common/Constants.h>
 #include <errno.h> #include <errno.h>
 #include <cctype> #include <cctype>
 #include <cstdio> #include <cstdio>
Line 39 
Line 38 
 # include <errno.h> # include <errno.h>
 #endif #endif
 #include "CIMName.h" #include "CIMName.h"
   #include "CIMNameCast.h"
 #include "XmlReader.h" #include "XmlReader.h"
 #include "XmlWriter.h" #include "XmlWriter.h"
 #include "CIMQualifier.h" #include "CIMQualifier.h"
Line 53 
Line 53 
 #include <Pegasus/Common/MessageLoader.h> #include <Pegasus/Common/MessageLoader.h>
 #include <Pegasus/Common/StringConversion.h> #include <Pegasus/Common/StringConversion.h>
 #include <Pegasus/Common/AutoPtr.h> #include <Pegasus/Common/AutoPtr.h>
 #include "CIMNameUnchecked.h"  
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 205 
Line 204 
     {     {
         MessageLoaderParms mlParms(         MessageLoaderParms mlParms(
             "Common.XmlReader.EXPECTED_CDATA",             "Common.XmlReader.EXPECTED_CDATA",
             "Expected content of CDATA");              "Expected content or CDATA");
         throw XmlValidationError(parser.getLine(), mlParms);         throw XmlValidationError(parser.getLine(), mlParms);
     }     }
  
Line 266 
Line 265 
     XmlEntry& entry,     XmlEntry& entry,
     const char* tagName)     const char* tagName)
 { {
     if (!parser.next(entry) ||      if (!parser.next(entry))
        (entry.type != XmlEntry::START_TAG &&      {
           return false;
       }
       if ((entry.type != XmlEntry::START_TAG &&
         entry.type != XmlEntry::EMPTY_TAG) ||         entry.type != XmlEntry::EMPTY_TAG) ||
         strcmp(entry.text, tagName) != 0)         strcmp(entry.text, tagName) != 0)
     {     {
Line 370 
Line 372 
     const char* elementName,     const char* elementName,
     Boolean acceptNull)     Boolean acceptNull)
 { {
     String name;      const char* name;
  
     if (!entry.getAttributeValue("NAME", name))     if (!entry.getAttributeValue("NAME", name))
     {     {
Line 384 
Line 386 
         throw XmlValidationError(lineNumber, mlParms);         throw XmlValidationError(lineNumber, mlParms);
     }     }
  
     if (acceptNull && name.size() == 0)      if (acceptNull && *name == '\0')
         return CIMName ();         return CIMName ();
  
     if (!CIMName::legal(name))      Uint32 size = CIMNameLegalASCII(name);
   
       if (size)
     {     {
 #ifdef PEGASUS_SNIA_INTEROP_TEST          String tmp(name, size);
     // In testing, replace illegal CIMName with this value to avoid the          return CIMName(CIMNameCast(tmp));
     // exception and let xml parsing continue.  THIS IS TEMP.      }
     name = "BADNAMESUBSTITUTEDBYPEGASUSCLIENT";  
 #else  
  
       if (!CIMName::legal(name))
       {
     char buffer[MESSAGE_SIZE];     char buffer[MESSAGE_SIZE];
     sprintf(buffer, "%s.NAME", elementName);     sprintf(buffer, "%s.NAME", elementName);
  
Line 404 
Line 408 
         buffer);         buffer);
  
     throw XmlSemanticError(lineNumber, mlParms);     throw XmlSemanticError(lineNumber, mlParms);
   
 #endif  
     }     }
     return CIMNameUnchecked(name);  
       return CIMNameCast(name);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 471 
Line 474 
     if (!entry.getAttributeValue("CLASSORIGIN", name))     if (!entry.getAttributeValue("CLASSORIGIN", name))
         return CIMName();         return CIMName();
  
       /* Interoperability hack to make the C++ client of OpenPegasus able
          to deal with the wbemservices CIMOM delivered with Sun Solaris.
          The issue is that the wbemservices delivers Xml responses with
          CLASSORIGIN=""
          Originally this had been reported with Bug#537.
       */
       if (name.size()==0)
       {
           return CIMName();
       }
   
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
         char buffer[MESSAGE_SIZE];         char buffer[MESSAGE_SIZE];
Line 482 
Line 496 
             buffer);             buffer);
         throw XmlSemanticError(lineNumber, mlParms);         throw XmlSemanticError(lineNumber, mlParms);
     }     }
       // The CIMName was already checked with legal() + String()
     return name;      return CIMNameCast(name);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 492 
Line 506 
 // //
 //     <!ENTITY % EmbeddedObject "EmbeddedObject (object | instance) #IMPLIED"> //     <!ENTITY % EmbeddedObject "EmbeddedObject (object | instance) #IMPLIED">
 // //
   //     EmbeddedObjectAttributeType:
   //        NO_EMBEDDED_OBJECT     = 0,
   //        EMBEDDED_OBJECT_ATTR   = 1,
   //        EMBEDDED_INSTANCE_ATTR = 2
   //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 String XmlReader::getEmbeddedObjectAttribute(  XmlReader::EmbeddedObjectAttributeType XmlReader::getEmbeddedObjectAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)      const char* tagName)
 { {
     String embeddedObject;      const char* embeddedObject;
  
     // Check for both upper case and mixed case "EmbeddedObject"     // Check for both upper case and mixed case "EmbeddedObject"
     // because of an error in an earlier pegasus version  where we     // because of an error in an earlier pegasus version  where we
Line 507 
Line 526 
     // whereas the DMTF spec calls for mixed case.     // whereas the DMTF spec calls for mixed case.
     if (!entry.getAttributeValue("EmbeddedObject", embeddedObject) &&     if (!entry.getAttributeValue("EmbeddedObject", embeddedObject) &&
         !entry.getAttributeValue("EMBEDDEDOBJECT", embeddedObject))         !entry.getAttributeValue("EMBEDDEDOBJECT", embeddedObject))
         return String();          return NO_EMBEDDED_OBJECT;
  
     // The embeddedObject attribute, if present, must have the string     // The embeddedObject attribute, if present, must have the string
     // value "object" or "instance".     // value "object" or "instance".
     if (!(String::equal(embeddedObject, "object") ||      if (strcmp(embeddedObject, "object") == 0)
           String::equal(embeddedObject, "instance")))      {
           return EMBEDDED_OBJECT_ATTR;
       }
   
       if (strcmp(embeddedObject, "instance") == 0)
     {     {
           return EMBEDDED_INSTANCE_ATTR;
       }
   
         char buffer[MESSAGE_SIZE];         char buffer[MESSAGE_SIZE];
         sprintf(buffer, "%s.EmbeddedObject", elementName);      sprintf(buffer, "%s.EmbeddedObject", tagName);
  
         MessageLoaderParms mlParms(         MessageLoaderParms mlParms(
             "Common.XmlReader.ILLEGAL_VALUE_FOR_ATTRIBUTE",             "Common.XmlReader.ILLEGAL_VALUE_FOR_ATTRIBUTE",
             "Illegal value for $0 attribute",             "Illegal value for $0 attribute",
             buffer);             buffer);
         throw XmlSemanticError(lineNumber, mlParms);         throw XmlSemanticError(lineNumber, mlParms);
     }  
  
     return embeddedObject;      return NO_EMBEDDED_OBJECT;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 547 
Line 572 
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
 #ifdef PEGASUS_SNIA_INTEROP_TEST  
         name = "PEGASUS_SUBSTITUED_THIS_FOR_BAD_NAME";  
         return name;  
 #endif  
   
         char buffer[MESSAGE_SIZE];         char buffer[MESSAGE_SIZE];
         sprintf(buffer, "%s.REFERENCECLASS", elementName);         sprintf(buffer, "%s.REFERENCECLASS", elementName);
  
Line 561 
Line 581 
             buffer);             buffer);
         throw XmlSemanticError(lineNumber, mlParms);         throw XmlSemanticError(lineNumber, mlParms);
     }     }
       // The CIMName was already checked with legal() + String()
     return name;      return CIMNameCast(name);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 594 
Line 614 
             buffer);             buffer);
         throw XmlSemanticError(lineNumber, mlParms);         throw XmlSemanticError(lineNumber, mlParms);
     }     }
       // The CIMName was already checked with legal() + String()
     return superClass;      return CIMNameCast(superClass);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 760 
Line 780 
 { {
     Uint32 i;     Uint32 i;
  
     Array<Uint8> utf8Chars;      Buffer utf8Chars;
  
     for (i=0; i<uriString.size(); i++)     for (i=0; i<uriString.size(); i++)
     {     {
Line 787 
Line 807 
             }             }
  
             Uint16 decodedChar = Uint16(digit1<<4) + Uint16(digit2);             Uint16 decodedChar = Uint16(digit1<<4) + Uint16(digit2);
             utf8Chars.append((Uint8)decodedChar);              utf8Chars.append((char)decodedChar);
         }         }
         else         else
         {         {
             utf8Chars.append((Uint8)uriString[i]);              utf8Chars.append((char)uriString[i]);
         }         }
     }     }
  
Line 799 
Line 819 
     if (uriString.size() > 0)     if (uriString.size() > 0)
     {     {
         // Convert UTF-8 to UTF-16 and return the String         // Convert UTF-8 to UTF-16 and return the String
         utf8Chars.append('\0');          return String(utf8Chars.getData(), utf8Chars.size());
         return String((char *)utf8Chars.getData());  
     }     }
     else     else
     {     {
Line 810 
Line 829 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // stringToSignedInteger  
 //  
 //      [ "+" | "-" ] ( positiveDecimalDigit *decimalDigit | "0" )  
 //    or  
 //      [ "+" | "-" ] ( "0x" | "0X" ) 1*hexDigit  
 //  
 //------------------------------------------------------------------------------  
   
 Boolean XmlReader::stringToSignedInteger(  
     const char* stringValue,  
     Sint64& x)  
 {  
     return (StringConversion::stringToSint64(  
                 stringValue, StringConversion::decimalStringToUint64, x) ||  
             StringConversion::stringToSint64(  
                 stringValue, StringConversion::hexStringToUint64, x));  
 }  
   
 //------------------------------------------------------------------------------  
 //  
 // stringToUnsignedInteger  
 //  
 //      ( positiveDecimalDigit *decimalDigit | "0" )  
 //    or  
 //      ( "0x" | "0X" ) 1*hexDigit  
 //  
 //------------------------------------------------------------------------------  
   
 Boolean XmlReader::stringToUnsignedInteger(  
     const char* stringValue,  
     Uint64& x)  
 {  
     return (StringConversion::decimalStringToUint64(stringValue, x) ||  
             StringConversion::hexStringToUint64(stringValue, x));  
 }  
   
 //------------------------------------------------------------------------------  
 //  
 // stringToValue() // stringToValue()
 // //
 // Return: CIMValue. If the string input is zero length creates a CIMValue // Return: CIMValue. If the string input is zero length creates a CIMValue
Line 862 
Line 843 
     const char* valueString,     const char* valueString,
     CIMType type)     CIMType type)
 { {
       return stringToValue(lineNumber, valueString, strlen(valueString), type);
   }
   
   CIMValue XmlReader::stringToValue(
       Uint32 lineNumber,
       const char* valueString,
       Uint32 valueStringLen,
       CIMType type)
   {
     // ATTN-B: accepting only UTF-8 for now! (affects string and char16):     // ATTN-B: accepting only UTF-8 for now! (affects string and char16):
  
       // Char string must have been null terminated.
       PEGASUS_ASSERT (!valueString[valueStringLen]);
   
     // Create value per type     // Create value per type
     switch (type)     switch (type)
     {     {
Line 884 
Line 877 
  
         case CIMTYPE_STRING:         case CIMTYPE_STRING:
         {         {
             return CIMValue(String(valueString));              return CIMValue(String(valueString, valueStringLen));
         }         }
  
         case CIMTYPE_CHAR16:         case CIMTYPE_CHAR16:
         {         {
             // Converts UTF-8 to UTF-16             // Converts UTF-8 to UTF-16
             String tmp(valueString);              String tmp(valueString, valueStringLen);
             if (tmp.size() != 1)             if (tmp.size() != 1)
             {             {
                 MessageLoaderParms mlParms(                 MessageLoaderParms mlParms(
Line 909 
Line 902 
         {         {
             Uint64 x;             Uint64 x;
  
             if (!stringToUnsignedInteger(valueString, x))              if (!StringConversion::stringToUnsignedInteger(valueString, x))
             {             {
                 MessageLoaderParms mlParms(                 MessageLoaderParms mlParms(
                     "Common.XmlReader.INVALID_UI_VALUE",                     "Common.XmlReader.INVALID_UI_VALUE",
Line 964 
Line 957 
         {         {
             Sint64 x;             Sint64 x;
  
             if (!stringToSignedInteger(valueString, x))              if (!StringConversion::stringToSignedInteger(valueString, x))
             {             {
                 MessageLoaderParms mlParms(                 MessageLoaderParms mlParms(
                     "Common.XmlReader.INVALID_SI_VALUE",                     "Common.XmlReader.INVALID_SI_VALUE",
Line 1018 
Line 1011 
  
             try             try
             {             {
                 // KS 20021002 - Exception if no datetime value. Test for                  if (valueStringLen != 0)
                 // zero length and leave the NULL value in the variable                  {
                 // Bugzilla 137  Adds the following if line.  
                 // Expect this to become permanent but test only for now  
 #ifdef PEGASUS_SNIA_INTEROP_TEST  
                 if (strlen(valueString) != 0)  
 #endif  
                     tmp.set(valueString);                     tmp.set(valueString);
             }             }
               }
             catch (InvalidDateTimeFormatException&)             catch (InvalidDateTimeFormatException&)
             {             {
                 MessageLoaderParms mlParms(                 MessageLoaderParms mlParms(
Line 1071 
Line 1060 
 //  just a Pegasus internal representation of an embedded object. However, //  just a Pegasus internal representation of an embedded object. However,
 //  this case is used when decoding string representations of embedded objects. //  this case is used when decoding string representations of embedded objects.
         case CIMTYPE_OBJECT:         case CIMTYPE_OBJECT:
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         case CIMTYPE_INSTANCE:         case CIMTYPE_INSTANCE:
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         {         {
             CIMObject x;             CIMObject x;
  
Line 1090 
Line 1077 
                 // just the value of the Embedded Object in String                 // just the value of the Embedded Object in String
                 // representation.                 // representation.
                 AutoArrayPtr<char> tmp_buffer(                 AutoArrayPtr<char> tmp_buffer(
                     new char[strlen(valueString) + 1]);                      new char[valueStringLen + 1]);
                 strcpy(tmp_buffer.get(), valueString);                  memcpy(tmp_buffer.get(), valueString, valueStringLen + 1);
                 XmlParser tmp_parser(tmp_buffer.get());                 XmlParser tmp_parser(tmp_buffer.get());
  
                 // The next bit of logic constructs a CIMObject from the                 // The next bit of logic constructs a CIMObject from the
Line 1102 
Line 1089 
  
                 if (XmlReader::getInstanceElement(tmp_parser, cimInstance))                 if (XmlReader::getInstanceElement(tmp_parser, cimInstance))
                 {                 {
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                     if (type == CIMTYPE_INSTANCE)                     if (type == CIMTYPE_INSTANCE)
                         return CIMValue(cimInstance);                         return CIMValue(cimInstance);
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                     x = CIMObject(cimInstance);                     x = CIMObject(cimInstance);
                 }                 }
                 else if (XmlReader::getClassElement(tmp_parser, cimClass))                 else if (XmlReader::getClassElement(tmp_parser, cimClass))
Line 1114 
Line 1099 
                 }                 }
                 else                 else
                 {                 {
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                     if (type == CIMTYPE_OBJECT)                     if (type == CIMTYPE_OBJECT)
                     {                     {
                         // change "element" to "embedded object"                         // change "element" to "embedded object"
Line 1132 
Line 1116 
                             "Expected INSTANCE element");                             "Expected INSTANCE element");
                         throw XmlValidationError(lineNumber, mlParms);                         throw XmlValidationError(lineNumber, mlParms);
                     }                     }
 #else  
                     // change "element" to "embedded object"  
                     MessageLoaderParms mlParms(  
                         "Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",  
                         "Expected INSTANCE or CLASS element");  
                     throw XmlValidationError(lineNumber, mlParms);  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                 }                 }
                 // Ok, now we can delete the storage for the temporary                 // Ok, now we can delete the storage for the temporary
                 // XmlParser.                 // XmlParser.
Line 1215 
Line 1192 
     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
  
     const char* valueString = "";     const char* valueString = "";
       Uint32 valueStringLen = 0;
     if (!empty)     if (!empty)
     {     {
         if (testContentOrCData(parser, entry))         if (testContentOrCData(parser, entry))
         {         {
             valueString = entry.text;             valueString = entry.text;
               valueStringLen = entry.textLen;
         }         }
  
         expectEndTag(parser, "VALUE");         expectEndTag(parser, "VALUE");
     }     }
 #ifdef PEGASUS_SNIA_INTEROP_TEST      value = stringToValue(parser.getLine(),valueString,valueStringLen,type);
     // KS 20021004 - tries to put value in even if empty.  
     // Think this is general problem with empty value  
     // Need to check meaning of (#PCDATA) - Does it allow empty.  
     // Bugzilla tbd  
     if (!empty)  
 #endif  
         value = stringToValue(parser.getLine(), valueString,type);  
  
     return true;     return true;
 } }
Line 1267 
Line 1238 
     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
  
     const char* valueString = "";     const char* valueString = "";
       Uint32 valueStringLen = 0;
   
       if (!empty)
       {
           if (testContentOrCData(parser, entry))
           {
               valueString = entry.text;
               valueStringLen = entry.textLen;
           }
   
           expectEndTag(parser, "VALUE");
       }
   
       str = String(valueString, valueStringLen);
       return true;
   }
   
   // EXP_PULL_BEGIN
   //------------------------------------------------------------------------------
   //
   // getUint32ArgValueElement()
   //
   //     <!ELEMENT VALUE (#PCDATA)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getUint32ArgValueElement(
       XmlParser& parser,
       Uint32Arg& val,
       Boolean required)
   {
       XmlEntry entry;
   
       if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))
       {
           if (required)
           {
               MessageLoaderParms mlParms(
                   "Common.XmlReader.EXPECTED_VALUE_ELEMENT",
                   "Expected VALUE element");
               throw XmlValidationError(parser.getLine(), mlParms);
           }
           return false;
       }
   
       Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
   
       const char* valueString = "";
   
       if (!empty)
       {
           if (testContentOrCData(parser, entry))
               valueString = entry.text;
   
           expectEndTag(parser, "VALUE");
       }
       else
       {
           // create the arg object with the NULL value in it.
           val = Uint32Arg();
           return true;
       }
   
       //convert to Uint32. Note error if overflow.
   
       Uint64 x;
       if (!StringConversion::stringToUnsignedInteger(valueString, x))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.INVALID_UI_VALUE",
               "Invalid unsigned integer value");
           throw XmlSemanticError(parser.getLine(), mlParms);
       }
   
       if (!StringConversion::checkUintBounds(x, CIMTYPE_UINT32))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.U32_VALUE_OUT_OF_RANGE",
               "Uint32 value out of range");
           throw XmlSemanticError(parser.getLine(), mlParms);
       }
       // create the arg object with the value in it.
       val = Uint32Arg(x);
   
       return true;
   }
   //------------------------------------------------------------------------------
   //
   // getUint64ValueElement()
   //
   //     <!ELEMENT VALUE (#PCDATA)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getUint64ValueElement(
       XmlParser& parser,
       Uint64Arg& val,
       Boolean required)
   {
       XmlEntry entry;
   
       if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))
       {
           if (required)
           {
               MessageLoaderParms mlParms(
                   "Common.XmlReader.EXPECTED_VALUE_ELEMENT",
                   "Expected VALUE element");
               throw XmlValidationError(parser.getLine(), mlParms);
           }
           return false;
       }
   
       Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
   
       const char* valueString = "";
  
     if (!empty)     if (!empty)
     {     {
Line 1275 
Line 1362 
  
         expectEndTag(parser, "VALUE");         expectEndTag(parser, "VALUE");
     }     }
       else
       {
           // create the arg object with the NULL value in it.
           val = Uint64Arg();
           return true;
       }
   
       Uint64 x;
       // EXP_PULL clean this up KS_TODO
       if (!StringConversion::stringToUnsignedInteger(valueString, x))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.INVALID_UI_VALUE",
               "Invalid unsigned integer value");
           throw XmlSemanticError(parser.getLine(), mlParms);
       }
       //EXP_PULL_QUESTION- Is there even a check for 64 bit too large
   
       if (!StringConversion::checkUintBounds(x, CIMTYPE_UINT64))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.U64_VALUE_OUT_OF_RANGE",
               "Uint64 value out of range");
           throw XmlSemanticError(parser.getLine(), mlParms);
       }
       // create the arg object with the value in it.
       val = Uint64Arg(x);
   
       return true;
   }
   
   
   //------------------------------------------------------------------------------
   //
   // getUint32ValueElement()
   //
   //     <!ELEMENT VALUE (#PCDATA)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getUint32ValueElement(
       XmlParser& parser,
       Uint32& val,
       Boolean required)
   {
       XmlEntry entry;
   
       if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))
       {
           if (required)
           {
               MessageLoaderParms mlParms(
                   "Common.XmlReader.EXPECTED_VALUE_ELEMENT",
                   "Expected VALUE element");
               throw XmlValidationError(parser.getLine(), mlParms);
           }
           return false;
       }
   
       Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
   
       const char* valueString = "";
   
       if (!empty)
       {
           if (testContentOrCData(parser, entry))
               valueString = entry.text;
   
           expectEndTag(parser, "VALUE");
       }
       else
       {
           // leave the existing value
           return true;
       }
   
       //convert to Uint32. Note error if overflow.
   
       Uint64 x;
       if (!StringConversion::stringToUnsignedInteger(valueString, x))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.INVALID_UI_VALUE",
               "Invalid unsigned integer value");
           throw XmlSemanticError(parser.getLine(), mlParms);
       }
   
       if (!StringConversion::checkUintBounds(x, CIMTYPE_UINT32))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.U32_VALUE_OUT_OF_RANGE",
               "Uint32 value out of range");
           throw XmlSemanticError(parser.getLine(), mlParms);
       }
       // create the arg object with the value in it.
       val = x;
  
     str = String(valueString);  
     return true;     return true;
 } }
   //EXP_PULL_END
  
 //---------------------------------------------------------------------------- //----------------------------------------------------------------------------
 // //
Line 1345 
Line 1528 
 template<class T> template<class T>
 CIMValue StringArrayToValueAux( CIMValue StringArrayToValueAux(
     Uint32 lineNumber,     Uint32 lineNumber,
     const Array<const char*>& stringArray,      const Array<CharString>& stringArray,
     CIMType type,     CIMType type,
     T*)     T*)
 { {
Line 1354 
Line 1537 
     for (Uint32 i = 0, n = stringArray.size(); i < n; i++)     for (Uint32 i = 0, n = stringArray.size(); i < n; i++)
     {     {
         CIMValue value = XmlReader::stringToValue(         CIMValue value = XmlReader::stringToValue(
             lineNumber, stringArray[i], type);              lineNumber,
               stringArray[i].value,
               stringArray[i].length,
               type);
  
         T x;         T x;
         value.get(x);         value.get(x);
Line 1369 
Line 1555 
     const Array<const char*>& array,     const Array<const char*>& array,
     CIMType type)     CIMType type)
 { {
       Array<CharString> strArray;
   
       for (Uint32 i = 0, n = array.size() ; i < n ; ++i)
       {
           strArray.append(CharString(array[i], strlen(array[i])));
       }
   
       return _stringArrayToValue(lineNumber, strArray, type);
   }
   
   CIMValue XmlReader::_stringArrayToValue(
       Uint32 lineNumber,
       const Array<CharString> &array,
       CIMType type)
   {
     switch (type)     switch (type)
     {     {
         case CIMTYPE_BOOLEAN:         case CIMTYPE_BOOLEAN:
Line 1421 
Line 1622 
         case CIMTYPE_OBJECT:         case CIMTYPE_OBJECT:
             return StringArrayToValueAux(             return StringArrayToValueAux(
                 lineNumber, array, type, (CIMObject*)0);                 lineNumber, array, type, (CIMObject*)0);
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         case CIMTYPE_INSTANCE:         case CIMTYPE_INSTANCE:
             return StringArrayToValueAux(             return StringArrayToValueAux(
                 lineNumber, array, type, (CIMInstance*)0);                 lineNumber, array, type, (CIMInstance*)0);
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
   
         default:         default:
             break;             break;
     }     }
Line 1456 
Line 1654 
     // Get VALUE.ARRAY open tag:     // Get VALUE.ARRAY open tag:
  
     XmlEntry entry;     XmlEntry entry;
     Array<const char*> stringArray;      Array<CharString> stringArray;
  
     // If no VALUE.ARRAY start tag, return false     // If no VALUE.ARRAY start tag, return false
     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))
Line 1468 
Line 1666 
  
         while (testStartTagOrEmptyTag(parser, entry, "VALUE"))         while (testStartTagOrEmptyTag(parser, entry, "VALUE"))
         {         {
               // ATTN: NULL values in array will have VALUE.NULL subelement
               // See DSP0201 Version 2.3.0, Section 5.2.3.2
             if (entry.type == XmlEntry::EMPTY_TAG)             if (entry.type == XmlEntry::EMPTY_TAG)
             {             {
                 stringArray.append("");                  stringArray.append(CharString("", 0));
                 continue;                 continue;
             }             }
  
             if (testContentOrCData(parser, entry))             if (testContentOrCData(parser, entry))
                 stringArray.append(entry.text);              {
                   stringArray.append(CharString(entry.text, entry.textLen));
               }
             else             else
                 stringArray.append("");              {
                   stringArray.append(CharString("", 0));
               }
             expectEndTag(parser, "VALUE");             expectEndTag(parser, "VALUE");
         }         }
  
         expectEndTag(parser, "VALUE.ARRAY");         expectEndTag(parser, "VALUE.ARRAY");
     }     }
  
     value = stringArrayToValue(parser.getLine(), stringArray, type);      value = _stringArrayToValue(parser.getLine(), stringArray, type);
     return true;     return true;
 } }
  
Line 1752 
Line 1955 
  
     // Get PROPERTY.EmbeddedObject attribute:     // Get PROPERTY.EmbeddedObject attribute:
  
     String embeddedObject = getEmbeddedObjectAttribute(      EmbeddedObjectAttributeType embeddedObject =
         parser.getLine(), entry, "PROPERTY");          getEmbeddedObjectAttribute(parser.getLine(), entry, "PROPERTY");
  
     // Get PROPERTY.TYPE attribute:     // Get PROPERTY.TYPE attribute:
  
Line 1774 
Line 1977 
     }     }
  
     Boolean embeddedObjectQualifierValue = false;     Boolean embeddedObjectQualifierValue = false;
     Uint32 ix = property.findQualifier(CIMName("EmbeddedObject"));      Uint32 ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT);
     if (ix != PEG_NOT_FOUND)     if (ix != PEG_NOT_FOUND)
     {     {
         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);
     }     }
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     String embeddedInstanceQualifierValue;     String embeddedInstanceQualifierValue;
     ix = property.findQualifier(CIMName("EmbeddedInstance"));      ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE);
     if (ix != PEG_NOT_FOUND)     if (ix != PEG_NOT_FOUND)
     {     {
         property.getQualifier(ix).getValue().get(         property.getQualifier(ix).getValue().get(
             embeddedInstanceQualifierValue);             embeddedInstanceQualifierValue);
     }     }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     // If the EmbeddedObject attribute is present with value "object"     // If the EmbeddedObject attribute is present with value "object"
     // or the EmbeddedObject qualifier exists on this property with value "true"     // or the EmbeddedObject qualifier exists on this property with value "true"
     // then convert the EmbeddedObject-encoded string into a CIMObject     // then convert the EmbeddedObject-encoded string into a CIMObject
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT      Boolean isEmbeddedObject = (embeddedObject == EMBEDDED_OBJECT_ATTR) ||
     Boolean isEmbeddedObject = String::equal(embeddedObject, "object") ||  
         embeddedObjectQualifierValue;         embeddedObjectQualifierValue;
     Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance") ||      Boolean isEmbeddedInstance = (embeddedObject == EMBEDDED_INSTANCE_ATTR) ||
         embeddedInstanceQualifierValue.size() > 0;         embeddedInstanceQualifierValue.size() > 0;
     if (isEmbeddedObject || isEmbeddedInstance)     if (isEmbeddedObject || isEmbeddedInstance)
     {     {
Line 1812 
Line 2012 
  
             // Copy the qualifiers from the String property to the CIMObject             // Copy the qualifiers from the String property to the CIMObject
             // property.             // property.
             for (Uint32 ix = 0; ix < property.getQualifierCount(); ++ix)              for (Uint32 i = 0; i < property.getQualifierCount(); ++i)
             {             {
                 // All properties are copied, including the EmbeddedObject                 // All properties are copied, including the EmbeddedObject
                 // qualifier.  This way we don't have to keep track to know                 // qualifier.  This way we don't have to keep track to know
                 // that the EmbeddedObject qualifier needs to be added back                 // that the EmbeddedObject qualifier needs to be added back
                 // during the encode step.                 // during the encode step.
                 new_property.addQualifier(property.getQualifier(ix));                  new_property.addQualifier(property.getQualifier(i));
             }             }
  
             value = new_value;             value = new_value;
Line 1832 
Line 2032 
             throw XmlValidationError(parser.getLine(), mlParms);             throw XmlValidationError(parser.getLine(), mlParms);
         }         }
     }     }
 #else  
     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)  
     {  
         // The EmbeddedObject attribute is only valid on Properties of type  
         // string  
         if (type == CIMTYPE_STRING)  
         {  
             type = CIMTYPE_OBJECT;  
             CIMValue new_value(type, false);  
             CIMProperty new_property = CIMProperty(  
                 name, new_value, 0, CIMName(), classOrigin, propagated);  
   
             // Copy the qualifiers from the String property to the CIMObject  
             // property.  
             for (Uint32 ix = 0; ix < property.getQualifierCount(); ++ix)  
             {  
                 // All properties are copied, including the EmbeddedObject  
                 // qualifier.  This way we don't have to keep track to know  
                 // that the EmbeddedObject qualifier needs to be added back  
                 // during the encode step.  
                 new_property.addQualifier(property.getQualifier(ix));  
             }  
   
             value = new_value;  
             property = new_property;  
         }  
         else  
         {  
             MessageLoaderParms mlParms(  
                 "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                 "The EmbeddedObject attribute is only valid on string types.");  
             throw XmlValidationError(parser.getLine(), mlParms);  
         }  
     }  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     // Continue on to get property value, if not empty.     // Continue on to get property value, if not empty.
     if (!empty)     if (!empty)
     {     {
Line 1902 
Line 2067 
  
     Uint64 arraySize;     Uint64 arraySize;
  
     if (!stringToUnsignedInteger(tmp, arraySize) || (arraySize == 0) ||      if (!StringConversion::stringToUnsignedInteger(tmp, arraySize) ||
           (arraySize == 0) ||
         !StringConversion::checkUintBounds(arraySize, CIMTYPE_UINT32))         !StringConversion::checkUintBounds(arraySize, CIMTYPE_UINT32))
     {     {
         char message[128];         char message[128];
Line 1979 
Line 2145 
  
     // Get PROPERTY.EmbeddedObject attribute:     // Get PROPERTY.EmbeddedObject attribute:
  
     String embeddedObject = getEmbeddedObjectAttribute(      EmbeddedObjectAttributeType embeddedObject = getEmbeddedObjectAttribute(
         parser.getLine(), entry, "PROPERTY.ARRAY");         parser.getLine(), entry, "PROPERTY.ARRAY");
  
     // Create property:     // Create property:
Line 1995 
Line 2161 
     }     }
  
     Boolean embeddedObjectQualifierValue = false;     Boolean embeddedObjectQualifierValue = false;
     Uint32 ix = property.findQualifier(CIMName("EmbeddedObject"));      Uint32 ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT);
     if (ix != PEG_NOT_FOUND)     if (ix != PEG_NOT_FOUND)
     {     {
         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);
     }     }
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     String embeddedInstanceQualifierValue;     String embeddedInstanceQualifierValue;
     ix = property.findQualifier(CIMName("EmbeddedInstance"));      ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE);
     if (ix != PEG_NOT_FOUND)     if (ix != PEG_NOT_FOUND)
     {     {
         property.getQualifier(ix).getValue().get(         property.getQualifier(ix).getValue().get(
             embeddedInstanceQualifierValue);             embeddedInstanceQualifierValue);
     }     }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     // If the EmbeddedObject attribute is present with value "object"     // If the EmbeddedObject attribute is present with value "object"
     // or the EmbeddedObject qualifier exists on this property with value "true"     // or the EmbeddedObject qualifier exists on this property with value "true"
     // then     // then
     //     Convert the EmbeddedObject-encoded string into a CIMObject     //     Convert the EmbeddedObject-encoded string into a CIMObject
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT      Boolean isEmbeddedObject = (embeddedObject == EMBEDDED_OBJECT_ATTR) ||
     Boolean isEmbeddedObject = String::equal(embeddedObject, "object") ||  
         embeddedObjectQualifierValue;         embeddedObjectQualifierValue;
     Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance") ||      Boolean isEmbeddedInstance = (embeddedObject == EMBEDDED_INSTANCE_ATTR) ||
         embeddedInstanceQualifierValue.size() > 0;         embeddedInstanceQualifierValue.size() > 0;
     if (isEmbeddedObject || isEmbeddedInstance)     if (isEmbeddedObject || isEmbeddedInstance)
     {     {
Line 2034 
Line 2197 
  
             // Copy the qualifiers from the String property to the CIMObject             // Copy the qualifiers from the String property to the CIMObject
             // property.             // property.
             for (Uint32 ix = 0; ix < property.getQualifierCount(); ++ix)              for (Uint32 i = 0; i < property.getQualifierCount(); ++i)
             {             {
                 // All properties are copied, including the EmbeddedObject                 // All properties are copied, including the EmbeddedObject
                 // qualifier.  This way we don't have to keep track to know                 // qualifier.  This way we don't have to keep track to know
                 // that the EmbeddedObject qualifier needs to be added back                 // that the EmbeddedObject qualifier needs to be added back
                 // during the encode step.                 // during the encode step.
                 new_property.addQualifier(property.getQualifier(ix));                  new_property.addQualifier(property.getQualifier(i));
             }             }
  
             value = new_value;             value = new_value;
Line 2054 
Line 2217 
             throw XmlValidationError(parser.getLine(), mlParms);             throw XmlValidationError(parser.getLine(), mlParms);
         }         }
     }     }
 #else  
     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)  
     {  
         // The EmbeddedObject attribute is only valid on Properties of type  
         // string  
         if (type == CIMTYPE_STRING)  
         {  
             type = CIMTYPE_OBJECT;  
             CIMValue new_value(type, true, arraySize);  
             CIMProperty new_property = CIMProperty(  
                 name, new_value, arraySize, CIMName(), classOrigin, propagated);  
   
             // Copy the qualifiers from the String property to the CIMObject  
             // property.  
             for (Uint32 ix = 0; ix < property.getQualifierCount(); ++ix)  
             {  
                 // All properties are copied, including the EmbeddedObject  
                 // qualifier.  This way we don't have to keep track to know  
                 // that the EmbeddedObject qualifier needs to be added back  
                 // during the encode step.  
                 new_property.addQualifier(property.getQualifier(ix));  
             }  
   
             value = new_value;  
             property = new_property;  
         }  
         else  
         {  
             MessageLoaderParms mlParms(  
                 "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                 "The EmbeddedObject attribute is only valid on string types.");  
             throw XmlValidationError(parser.getLine(), mlParms);  
         }  
     }  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     // Continue on to get property array value, if not empty.     // Continue on to get property array value, if not empty.
     // Else not an embedded object, if not empty, get the property array value.     // Else not an embedded object, if not empty, get the property array value.
     if (!empty)     if (!empty)
Line 2127 
Line 2255 
  
     if (!testStartTag(parser, entry, "HOST"))     if (!testStartTag(parser, entry, "HOST"))
         return false;         return false;
 #ifdef PEGASUS_SNIA_INTEROP_TEST  
     // Temp code to allow empty HOST field.  
     // SNIA CIMOMs return empty field particularly on enumerateinstance.  
     // Simply substitute a string for the empty.  
     if (!parser.next(entry))  
         throw XmlException(XmlException::UNCLOSED_TAGS, parser.getLine());  
   
     if (entry.type == XmlEntry::CONTENT)  
         host = String(entry.text);  
     else  
     {  
         parser.putBack(entry);  
         host = "HOSTNAMEINSERTEDBYPEGASUSCLIENT";  
     }  
   
 #else  
  
     if (!parser.next(entry) || entry.type != XmlEntry::CONTENT)     if (!parser.next(entry) || entry.type != XmlEntry::CONTENT)
     {     {
Line 2153 
Line 2265 
     }     }
  
     host = String(entry.text);     host = String(entry.text);
 #endif  
     expectEndTag(parser, "HOST");     expectEndTag(parser, "HOST");
     return true;     return true;
 } }
Line 2321 
Line 2432 
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
 { {
     String tmp;      const char* tmp;
  
     if (!entry.getAttributeValue("VALUETYPE", tmp))     if (!entry.getAttributeValue("VALUETYPE", tmp))
         return CIMKeyBinding::STRING;         return CIMKeyBinding::STRING;
  
     if (String::equal(tmp, "string"))      if (strcmp(tmp, "string") == 0)
         return CIMKeyBinding::STRING;         return CIMKeyBinding::STRING;
     else if (String::equal(tmp, "boolean"))      else if (strcmp(tmp, "boolean") == 0)
         return CIMKeyBinding::BOOLEAN;         return CIMKeyBinding::BOOLEAN;
     else if (String::equal(tmp, "numeric"))      else if (strcmp(tmp, "numeric") == 0)
         return CIMKeyBinding::NUMERIC;         return CIMKeyBinding::NUMERIC;
  
     char buffer[MESSAGE_SIZE];     char buffer[MESSAGE_SIZE];
Line 2486 
Line 2597 
     else     else
     {     {
         while (getKeyBindingElement(parser, name, value, type))         while (getKeyBindingElement(parser, name, value, type))
           {
             keyBindings.append(CIMKeyBinding(name, value, type));             keyBindings.append(CIMKeyBinding(name, value, type));
               if (keyBindings.size() > PEGASUS_MAXELEMENTS_NUM)
               {
                   MessageLoaderParms mlParms(
                       "Common.XmlReader.TOO_MANY_KEYBINDINGS",
                       "More than $0 key-value pairs per object path"
                           " are not supported.",
                       PEGASUS_MAXELEMENTS_NUM);
                   throw XmlValidationError(parser.getLine(), mlParms);
               }
           }
     }     }
  
     expectEndTag(parser, "INSTANCENAME");     expectEndTag(parser, "INSTANCENAME");
Line 2694 
Line 2816 
 // //
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
   //
   // Parses the input to a CIMObjectPath.  Note that today the differences
   // between ClassPath and InstancePath are lost in this mapping because
   // Pegasus uses the existence of keys as separator . See BUG_3302
 Boolean XmlReader::getValueReferenceElement( Boolean XmlReader::getValueReferenceElement(
     XmlParser& parser,     XmlParser& parser,
     CIMObjectPath& reference)     CIMObjectPath& reference)
Line 3161 
Line 3286 
     // Get ARRAYSIZE attribute:     // Get ARRAYSIZE attribute:
  
     Uint32 arraySize = 0;     Uint32 arraySize = 0;
     Boolean gotArraySize = getArraySizeAttribute(parser.getLine(),      getArraySizeAttribute(parser.getLine(),
         entry, "QUALIFIER.DECLARATION", arraySize);         entry, "QUALIFIER.DECLARATION", arraySize);
  
     // Get flavor oriented attributes:     // Get flavor oriented attributes:
Line 3420 
Line 3545 
     return true;     return true;
 } }
  
   
   //EXP_PULL_BEGIN
   //------------------------------------------------------------------------------
   // getInstanceWithPathElement()
   //
   //     <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)>
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getInstanceWithPathElement(
       XmlParser& parser,
       CIMInstance& namedInstance)
   {
       XmlEntry entry;
       if (!testStartTag(parser, entry, "VALUE.INSTANCEWITHPATH"))
           return false;
   
       CIMObjectPath instanceName;
   
       // Get INSTANCENAME elements:
   //EXP_PULL_Question Should we have new getInstancePathElement??? KS_TODO
       if (!getInstancePathElement(parser, instanceName))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.EXPECTED_INSTANCEPATH_ELEMENT",
               "expected INSTANCEPATH element");
           throw XmlValidationError(parser.getLine(), mlParms);
       }
   
       // Get INSTANCE elements:
   
       if (!getInstanceElement(parser, namedInstance))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.EXPECTED_INSTANCE_ELEMENT",
               "expected INSTANCE element");
           throw XmlValidationError(parser.getLine(), mlParms);
       }
       // Get VALUE.NAMEDINSTANCE end tag:
   
       expectEndTag(parser, "VALUE.INSTANCEWITHPATH");
   
       namedInstance.setPath (instanceName);
   
       return true;
   }
   
   //EXP_PULL_END
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // getObject() // getObject()
Line 3604 
Line 3778 
     return true;     return true;
 } }
  
   //EXP_PULL_BEGIN
   //------------------------------------------------------------------------------
   //
   // getIParamValueTag()
   //
   //------------------------------------------------------------------------------
   
   Boolean XmlReader::getParamValueTag(
       XmlParser& parser,
       const char*& name,
       Boolean& isEmptyTag)
   {
       XmlEntry entry;
   
       if (!testStartTagOrEmptyTag(parser, entry, "PARAMVALUE"))
       {
   
           return false;
       }
   
       isEmptyTag = (entry.type == XmlEntry::EMPTY_TAG);
   
       // Get PARAMVALUE.NAME attribute:
   
       if (!entry.getAttributeValue("NAME", name))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.MISSING_PARAMVALUE_ATTRIBUTE",
               "Missing PARAMVALUE.NAME attribute");
           throw XmlValidationError(parser.getLine(), mlParms);
       }
       return true;
   }
   //------------------------------------------------------------------------------
   //
   // getIReturnValueTag()
   //
   //------------------------------------------------------------------------------
   ////EXP_PULL Think we can get rid of this KS_TODO
   Boolean XmlReader::getIReturnValueTag(
       XmlParser& parser,
       const char*& name,
       Boolean& isEmptyTag)
   {
       XmlEntry entry;
       if (!testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
           return false;
       //entry.print();
       isEmptyTag = (entry.type == XmlEntry::EMPTY_TAG);
   
       if (!entry.getAttributeValue("NAME", name))
       {
           MessageLoaderParms mlParms(
               "Common.XmlReader.MISSING_IRETURNVALUE_ATTRIBUTE",
               "Missing IRETURNVALUE.NAME attribute");
           throw XmlValidationError(parser.getLine(), mlParms);
       }
   // EXP_PULL_TBD Add new msg above to msg bundle.  KS_TODO
       return true;
   }
   
   //EXP_PULL_END
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // rejectNullIParamValue() // rejectNullIParamValue()
Line 3624 
Line 3860 
     }     }
 } }
  
   // EXP_PULL_BEGIN
   //------------------------------------------------------------------------------
   //
   // rejectNullIReturnParamValue()
   //
   //------------------------------------------------------------------------------
   
   void XmlReader::rejectNullIReturnValue(
       XmlParser& parser,
       Boolean isEmptyTag,
       const char* paramName)
   {
       if (isEmptyTag)
       {
           MessageLoaderParms mlParms("Common.XmlReader.INVALID_NULL_IRETURNVALUE",
               "A null value is not valid for IRETURNVALUE \"$0\".",
               paramName);
           throw XmlValidationError(parser.getLine(), mlParms);
       }
   }
   
   void XmlReader::rejectNullParamValue(
       XmlParser& parser,
       Boolean isEmptyTag,
       const char* paramName)
   {
       if (isEmptyTag)
       {
           MessageLoaderParms mlParms("Common.XmlReader.INVALID_NULL_PARAMVALUE",
               "A null value is not valid for PARAMVALUE \"$0\".",
               paramName);
           throw XmlValidationError(parser.getLine(), mlParms);
       }
   }
   // EXP_PULL_TODO_TBD add above message to bundle KS_TODO
   // EXP_PULL_END
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // getBooleanValueElement() // getBooleanValueElement()
Line 3948 
Line 4220 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
   // Returns true if ClassNameElement or false if InstanceNameElement
   // Parse errors always throw exception
 Boolean XmlReader::getObjectNameElement( Boolean XmlReader::getObjectNameElement(
     XmlParser& parser,     XmlParser& parser,
     CIMObjectPath& objectName)     CIMObjectPath& objectName)
Line 3957 
Line 4231 
     if (getClassNameElement(parser, className, false))     if (getClassNameElement(parser, className, false))
     {     {
         objectName.set(String(), CIMNamespaceName(), className);         objectName.set(String(), CIMNamespaceName(), className);
   
           // Return flag indicating this is ClassNameElement
         return true;         return true;
     }     }
  
Line 3968 
Line 4244 
         throw XmlValidationError(parser.getLine(), mlParms);         throw XmlValidationError(parser.getLine(), mlParms);
     }     }
  
     return true;      // Return flag indicating this is InstanceNameElement
       return false;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 4191 
Line 4468 
  
     // Get PROPERTY.EmbeddedObject     // Get PROPERTY.EmbeddedObject
  
     String embeddedObject = getEmbeddedObjectAttribute(      EmbeddedObjectAttributeType embeddedObject = getEmbeddedObjectAttribute(
         parser.getLine(), entry, "PARAMVALUE");         parser.getLine(), entry, "PARAMVALUE");
  
     // Get PARAMVALUE.PARAMTYPE attribute:     // Get PARAMVALUE.PARAMTYPE attribute:
Line 4243 
Line 4520 
             // If the EmbeddedObject attribute is present with value "object"             // If the EmbeddedObject attribute is present with value "object"
             // then             // then
             //     Convert the EmbeddedObject-encoded string into a CIMObject             //     Convert the EmbeddedObject-encoded string into a CIMObject
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT              if (embeddedObject != NO_EMBEDDED_OBJECT)
             Boolean isEmbeddedObject = String::equal(embeddedObject, "object");  
             Boolean isEmbeddedInstance =  
                 String::equal(embeddedObject, "instance");  
             if (isEmbeddedObject || isEmbeddedInstance)  
             {             {
                 // The EmbeddedObject attribute is only valid on Parameters                 // The EmbeddedObject attribute is only valid on Parameters
                 // of type string                 // of type string
                 // The type must have been specified.                 // The type must have been specified.
                 if (gotType && (type == CIMTYPE_STRING))                 if (gotType && (type == CIMTYPE_STRING))
                 {                 {
                   if (isEmbeddedObject)                    if (embeddedObject == EMBEDDED_OBJECT_ATTR)
                       // Used below by getValueElement() or                       // Used below by getValueElement() or
                       // getValueArrayElement()                       // getValueArrayElement()
                       effectiveType = CIMTYPE_OBJECT;                       effectiveType = CIMTYPE_OBJECT;
Line 4270 
Line 4543 
                     throw XmlValidationError(parser.getLine(), mlParms);                     throw XmlValidationError(parser.getLine(), mlParms);
                 }                 }
             }             }
 #else  
             if (String::equal(embeddedObject, "object"))  
             {  
                 // The EmbeddedObject attribute is only valid on Parameters  
                 // of type string  
                 // The type must have been specified.  
                 if (gotType && (type == CIMTYPE_STRING))  
                 {  
                     // Used below by getValueElement() or getValueArrayElement()  
                     effectiveType = CIMTYPE_OBJECT;  
                 }  
                 else  
                 {  
                     MessageLoaderParms mlParms(  
                         "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                         "The EmbeddedObject attribute is only valid on "  
                             "string types.");  
                     throw XmlValidationError(parser.getLine(), mlParms);  
                 }  
             }  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
  
             if (!XmlReader::getValueArrayElement(parser, effectiveType, value)             if (!XmlReader::getValueArrayElement(parser, effectiveType, value)
                 && !XmlReader::getValueElement(parser, effectiveType, value))                 && !XmlReader::getValueElement(parser, effectiveType, value))
Line 4332 
Line 4584 
  
     // Get PROPERTY.EmbeddedObject     // Get PROPERTY.EmbeddedObject
  
     String embeddedObject = getEmbeddedObjectAttribute(      EmbeddedObjectAttributeType embeddedObject = getEmbeddedObjectAttribute(
         parser.getLine(), entry, "RETURNVALUE");         parser.getLine(), entry, "RETURNVALUE");
  
     // Get RETURNVALUE.PARAMTYPE attribute:     // Get RETURNVALUE.PARAMTYPE attribute:
Line 4368 
Line 4620 
             // 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
             type = CIMTYPE_STRING;             type = CIMTYPE_STRING;
         }         }
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT          if (embeddedObject != NO_EMBEDDED_OBJECT)
         Boolean isEmbeddedObject = String::equal(embeddedObject, "object");  
         Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance");  
         if (isEmbeddedObject || isEmbeddedInstance)  
         {         {
             if (gotType && (type == CIMTYPE_STRING))             if (gotType && (type == CIMTYPE_STRING))
             {             {
                 if (isEmbeddedObject)                  if (embeddedObject == EMBEDDED_OBJECT_ATTR)
                     // Used below by getValueElement() or getValueArrayElement()                     // Used below by getValueElement() or getValueArrayElement()
                     type = CIMTYPE_OBJECT;                     type = CIMTYPE_OBJECT;
                 else                 else
Line 4390 
Line 4639 
                 throw XmlValidationError(parser.getLine(), mlParms);                 throw XmlValidationError(parser.getLine(), mlParms);
             }             }
         }         }
 #else  
         if (String::equal(embeddedObject, "object"))  
         {  
             if (gotType && (type == CIMTYPE_STRING))  
             {  
                 type = CIMTYPE_OBJECT;  // Used below by getValueElement()  
             }  
             else  
             {  
                 MessageLoaderParms mlParms(  
                     "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                     "The EmbeddedObject attribute is only valid on string "  
                         "types.");  
                 throw XmlValidationError(parser.getLine(), mlParms);  
             }  
         }  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         if ( !XmlReader::getValueElement(parser, type, returnValue) )         if ( !XmlReader::getValueElement(parser, type, returnValue) )
         {         {
             MessageLoaderParms mlParms(             MessageLoaderParms mlParms(


Legend:
Removed from v.1.127.4.2  
changed lines
  Added in v.1.144.4.5

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2