(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.111

version 1.110, 2005/03/09 21:02:26 version 1.111, 2005/03/15 05:41:45
Line 1598 
Line 1598 
             // 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];             char* tmp_buffer = new char[strlen(valueString) + 1];
             strcpy(tmp_buffer, valueString);             strcpy(tmp_buffer, valueString);
             XmlParser tmp_parser(tmp_buffer);             XmlParser tmp_parser(tmp_buffer);
             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 1630 
                 throw XmlValidationError(lineNumber, mlParms);                 throw XmlValidationError(lineNumber, mlParms);
  
             }             }
               // Ok, now we can delete the storage for the temporary XmlParser.
               delete [] tmp_buffer;
         }         }
         return CIMValue(x);         return CIMValue(x);
     }     }
Line 1700 
Line 1701 
  
     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();  
         }  
         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);              return false;
             }             }
             else  
             {  
                 // l10n  
   
                 // throw XmlValidationError(parser.getLine(),  
                 //   "Expected INSTANCE or CLASS element");  
  
                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",      Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
                            "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 1726 
         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 1948 
     // 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 1956 
  
     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 1973 
  
                 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 2298 
                 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 2477 
                 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
         {         {


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2