(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.110 and 1.116

version 1.110, 2005/03/09 21:02:26 version 1.116, 2006/01/30 16:17:08
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 34 
Line 36 
 //              Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) //              Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com) //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com)
   //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3103
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
Line 59 
Line 62 
 #endif #endif
 // l10n // l10n
 #include <Pegasus/Common/MessageLoader.h> #include <Pegasus/Common/MessageLoader.h>
   #include <Pegasus/Common/AutoPtr.h>
   #include "CIMNameUnchecked.h"
  
 #define PEGASUS_SINT64_MIN (PEGASUS_SINT64_LITERAL(0x8000000000000000)) #define PEGASUS_SINT64_MIN (PEGASUS_SINT64_LITERAL(0x8000000000000000))
 #define PEGASUS_UINT64_MAX PEGASUS_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF) #define PEGASUS_UINT64_MAX PEGASUS_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF)
Line 475 
Line 480 
  
 #endif #endif
     }     }
     return CIMName (name);      return CIMNameUnchecked(name);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 1598 
Line 1603 
             // Convert the non-NULL string to a CIMObject (containing either a             // Convert the non-NULL string to a CIMObject (containing either a
             // CIMInstance or a CIMClass).             // CIMInstance or a CIMClass).
  
             // First we need to create a new "temporary" XMLParser that is              // First we need to create a new "temporary" XmlParser that is
             // just the value of the Embedded Object in String representation.             // just the value of the Embedded Object in String representation.
             char* tmp_buffer = new char[strlen(valueString) + 1];              AutoArrayPtr<char> tmp_buffer(new char[strlen(valueString) + 1]);
             strcpy(tmp_buffer, valueString);              strcpy(tmp_buffer.get(), valueString);
             XmlParser tmp_parser(tmp_buffer);              XmlParser tmp_parser(tmp_buffer.get());
             delete [] tmp_buffer;  
  
             // The next bit of logic constructs a CIMObject from the Embedded Object String.             // The next bit of logic constructs a CIMObject from the Embedded Object String.
             // It is similar to the method XmlReader::getValueObjectElement().             // It is similar to the method XmlReader::getValueObjectElement().
Line 1631 
Line 1635 
                 throw XmlValidationError(lineNumber, mlParms);                 throw XmlValidationError(lineNumber, mlParms);
  
             }             }
               // Ok, now we can delete the storage for the temporary XmlParser.
               tmp_buffer.reset();
         }         }
         return CIMValue(x);         return CIMValue(x);
     }     }
Line 1700 
Line 1706 
  
     XmlEntry entry;     XmlEntry entry;
     if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))
         return false;  
   
     Boolean empty = entry.type == XmlEntry::EMPTY_TAG;  
   
     // Since stringToValue() takes a char* as input, we handle CIMTYPE_OBJECT separately.  
     if (type == CIMTYPE_OBJECT)  
     {  
         CIMObject cimObject;  
   
         if (empty)  
         {         {
             cimObject = CIMObject();              return false;
         }         }
         else  
         {  
             // Convert the non-empty value to a CIMObject (containing either a  
             // CIMInstance or a CIMClass).  
   
             // The next bit of logic constructs a CIMObject from the Embedded Object String.  
             // It is similar to the method XmlReader::getValueObjectElement().  
             CIMInstance cimInstance;  
             CIMClass cimClass;  
  
             if (XmlReader::getInstanceElement(parser, cimInstance))      Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
             {  
                 cimObject = CIMObject(cimInstance);  
             }  
             else if (XmlReader::getClassElement(parser, cimClass))  
             {  
                 cimObject = CIMObject(cimClass);  
             }  
             else  
             {  
                 // l10n  
   
                 // throw XmlValidationError(parser.getLine(),  
                 //   "Expected INSTANCE or CLASS element");  
   
                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",  
                            "Expected INSTANCE or CLASS element"); // change "element" to "embedded object"  
  
                 throw XmlValidationError(parser.getLine(), mlParms);  
             }  
             expectEndTag(parser, "VALUE");  
         }  
         value = CIMValue(cimObject);  
     }  
     else  
     {  
         const char* valueString = "";         const char* valueString = "";
  
         if (!empty)         if (!empty)
         {         {
         if (testContentOrCData(parser, entry))         if (testContentOrCData(parser, entry))
           {
             valueString = entry.text;             valueString = entry.text;
           }
  
         expectEndTag(parser, "VALUE");         expectEndTag(parser, "VALUE");
         }         }
Line 1766 
Line 1731 
         if (!empty)         if (!empty)
     #endif     #endif
             value = stringToValue(parser.getLine(), valueString,type);             value = stringToValue(parser.getLine(), valueString,type);
     }  
  
     return true;     return true;
 } }
Line 1989 
Line 1953 
     // Get VALUE.ARRAY open tag:     // Get VALUE.ARRAY open tag:
  
     XmlEntry entry;     XmlEntry entry;
       Array<const char*> stringArray;
  
     // If no VALUE.ARRAY start tag, return false     // If no VALUE.ARRAY start tag, return false
     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY"))
Line 1996 
Line 1961 
  
     if (entry.type != XmlEntry::EMPTY_TAG)     if (entry.type != XmlEntry::EMPTY_TAG)
     {     {
         if (type == CIMTYPE_OBJECT)  
         {  
             Array<CIMObject> objectArray;  
   
             // For each VALUE element:             // For each VALUE element:
             while (testStartTagOrEmptyTag(parser, entry, "VALUE"))  
             {  
                 CIMObject cimObject;  
  
                 if (entry.type == XmlEntry::EMPTY_TAG)  
                 {  
                     cimObject = CIMObject();  
                 }  
                 else  
                 {  
                     // Convert the non-empty value to a CIMObject (containing either a  
                     // CIMInstance or a CIMClass).  
   
                     // The next bit of logic constructs a CIMObject from the Embedded Object String.  
                     // It is similar to the method XmlReader::getValueObjectElement().  
                     CIMInstance cimInstance;  
                     CIMClass cimClass;  
   
                     if (XmlReader::getInstanceElement(parser, cimInstance))  
                     {  
                         cimObject = CIMObject(cimInstance);  
                     }  
                     else if (XmlReader::getClassElement(parser, cimClass))  
                     {  
                         cimObject = CIMObject(cimClass);  
                     }  
                     else  
                     {  
                         // l10n  
   
                         // throw XmlValidationError(parser.getLine(),  
                         //   "Expected INSTANCE or CLASS element");  
   
                         MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",  
                                    "Expected INSTANCE or CLASS element"); // change "element" to "embedded object"  
   
                         throw XmlValidationError(parser.getLine(), mlParms);  
                     }  
                     expectEndTag(parser, "VALUE");  
                 }  
                 objectArray.append(cimObject);  
             }  
             value = CIMValue(objectArray);  
         }  
         else  
         {  
             Array<const char*> stringArray;  
   
             // For each VALUE element:  
             while (testStartTagOrEmptyTag(parser, entry, "VALUE"))             while (testStartTagOrEmptyTag(parser, entry, "VALUE"))
             {             {
                 if (entry.type == XmlEntry::EMPTY_TAG)                 if (entry.type == XmlEntry::EMPTY_TAG)
Line 2065 
Line 1978 
  
                 expectEndTag(parser, "VALUE");                 expectEndTag(parser, "VALUE");
             }             }
             value = stringArrayToValue(parser.getLine(), stringArray, type);  
         }  
  
         expectEndTag(parser, "VALUE.ARRAY");         expectEndTag(parser, "VALUE.ARRAY");
     }     }
  
       value = stringArrayToValue(parser.getLine(), stringArray, type);
     return true;     return true;
 } }
  
Line 2391 
Line 2303 
                 new_property.addQualifier(property.getQualifier(ix));                 new_property.addQualifier(property.getQualifier(ix));
             }             }
  
             value = new_value; // does this leak?              value = new_value;
             property = new_property; // does this leak?              property = new_property;
         }         }
         else         else
         {         {
Line 2570 
Line 2482 
                 new_property.addQualifier(property.getQualifier(ix));                 new_property.addQualifier(property.getQualifier(ix));
             }             }
  
             value = new_value; // does this leak?              value = new_value;
             property = new_property; // does this leak?              property = new_property;
         }         }
         else         else
         {         {
Line 5019 
Line 4931 
     Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,     Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type,
                                           "PARAMVALUE", "PARAMTYPE", false);                                           "PARAMVALUE", "PARAMTYPE", false);
  
     if (!empty)      if (empty)
       {
           gotType = false; // Can't distinguish array and non-array types
       }
       else
     {     {
         // Parse VALUE.REFERENCE and VALUE.REFARRAY type         // Parse VALUE.REFERENCE and VALUE.REFARRAY type
         if ( (type == CIMTYPE_REFERENCE) || !gotType )         if ( (type == CIMTYPE_REFERENCE) || !gotType )
Line 5062 
Line 4978 
                 // The type must have been specified.                 // The type must have been specified.
                 if (gotType && (type == CIMTYPE_STRING))                 if (gotType && (type == CIMTYPE_STRING))
                 {                 {
                     type = CIMTYPE_OBJECT; // Used below by getValueElement() or getValueArrayElement()                      // Used below by getValueElement() or getValueArrayElement()
                       effectiveType = CIMTYPE_OBJECT;
                 }                 }
                 else                 else
                 {                 {
Line 5084 
Line 5001 
             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&
                  !XmlReader::getValueElement(parser, effectiveType, value) )                  !XmlReader::getValueElement(parser, effectiveType, value) )
             {             {
                   gotType = false; // Can't distinguish array and non-array types
                 value.clear();    // Isn't necessary; should already be cleared                 value.clear();    // Isn't necessary; should already be cleared
             }             }
  


Legend:
Removed from v.1.110  
changed lines
  Added in v.1.116

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2