(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.144.4.3 and 1.144.4.4

version 1.144.4.3, 2012/02/21 17:22:10 version 1.144.4.4, 2013/06/03 22:35:14
Line 399 
Line 399 
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
     {     {
 #ifdef PEGASUS_SNIA_INTEROP_TEST  
     // In testing, replace illegal CIMName with this value to avoid the  
     // exception and let xml parsing continue.  THIS IS TEMP.  
     name = "BADNAMESUBSTITUTEDBYPEGASUSCLIENT";  
 #else  
   
     char buffer[MESSAGE_SIZE];     char buffer[MESSAGE_SIZE];
     sprintf(buffer, "%s.NAME", elementName);     sprintf(buffer, "%s.NAME", elementName);
  
Line 414 
Line 408 
         buffer);         buffer);
  
     throw XmlSemanticError(lineNumber, mlParms);     throw XmlSemanticError(lineNumber, mlParms);
   
 #endif  
     }     }
  
     return CIMNameCast(name);     return CIMNameCast(name);
Line 580 
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 1024 
Line 1011 
  
             try             try
             {             {
                 // KS 20021002 - Exception if no datetime value. Test for  
                 // 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 (valueStringLen != 0)                 if (valueStringLen != 0)
 #endif                  {
                     tmp.set(valueString);                     tmp.set(valueString);
             }             }
               }
             catch (InvalidDateTimeFormatException&)             catch (InvalidDateTimeFormatException&)
             {             {
                 MessageLoaderParms mlParms(                 MessageLoaderParms mlParms(
Line 1220 
Line 1203 
  
         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,  
             valueStringLen,  
             type);  
  
     return true;     return true;
 } }
Line 1286 
Line 1258 
 // EXP_PULL_BEGIN // EXP_PULL_BEGIN
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // getUint32ValueElement()  // getUint32ArgValueElement()
 // //
 //     <!ELEMENT VALUE (#PCDATA)> //     <!ELEMENT VALUE (#PCDATA)>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Boolean XmlReader::getUint32ValueElement(  Boolean XmlReader::getUint32ArgValueElement(
     XmlParser& parser,     XmlParser& parser,
     Uint32Arg& val,     Uint32Arg& val,
     Boolean required)     Boolean required)
Line 1398 
Line 1370 
     }     }
  
     Uint64 x;     Uint64 x;
     // EXP_PULL clean this up      // EXP_PULL clean this up KS_TODO
     if (!StringConversion::stringToUnsignedInteger(valueString, x))     if (!StringConversion::stringToUnsignedInteger(valueString, x))
     {     {
         MessageLoaderParms mlParms(         MessageLoaderParms mlParms(
Line 1420 
Line 1392 
  
     return true;     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;
   
       return true;
   }
 //EXP_PULL_END //EXP_PULL_END
  
 //---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Line 2214 
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 2240 
Line 2265 
     }     }
  
     host = String(entry.text);     host = String(entry.text);
 #endif  
     expectEndTag(parser, "HOST");     expectEndTag(parser, "HOST");
     return true;     return true;
 } }
Line 2573 
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 2781 
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 3248 
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 3527 
Line 3565 
     CIMObjectPath instanceName;     CIMObjectPath instanceName;
  
     // Get INSTANCENAME elements:     // Get INSTANCENAME elements:
 //EXP_PULL_ISSUE Should we have new getInstancePathElement???  //EXP_PULL_ISSUE Should we have new getInstancePathElement??? KS_TODO
     if (!getInstancePathElement(parser, instanceName))     if (!getInstancePathElement(parser, instanceName))
     {     {
         MessageLoaderParms mlParms(         MessageLoaderParms mlParms(
Line 3778 
Line 3816 
 // getIReturnValueTag() // getIReturnValueTag()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 ////EXP_PULL Think we can get rid of this TBD  ////EXP_PULL Think we can get rid of this KS_TODO
 Boolean XmlReader::getIReturnValueTag( Boolean XmlReader::getIReturnValueTag(
     XmlParser& parser,     XmlParser& parser,
     const char*& name,     const char*& name,
Line 3797 
Line 3835 
             "Missing IRETURNVALUE.NAME attribute");             "Missing IRETURNVALUE.NAME attribute");
         throw XmlValidationError(parser.getLine(), mlParms);         throw XmlValidationError(parser.getLine(), mlParms);
     }     }
 // EXP_PULL_TBD Add new msg above to msg bundle.  // EXP_PULL_TBD Add new msg above to msg bundle.  KS_TODO
     return true;     return true;
 } }
  
Line 3856 
Line 3894 
         throw XmlValidationError(parser.getLine(), mlParms);         throw XmlValidationError(parser.getLine(), mlParms);
     }     }
 } }
 // EXP_PULL_TODO_TBD add above message to bundle  // EXP_PULL_TODO_TBD add above message to bundle KS_TODO
 // EXP_PULL_END // EXP_PULL_END
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
Line 4182 
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 4191 
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 4202 
Line 4244 
         throw XmlValidationError(parser.getLine(), mlParms);         throw XmlValidationError(parser.getLine(), mlParms);
     }     }
  
     return true;      // Return flag indicating this is InstanceNameElement
       return false;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------


Legend:
Removed from v.1.144.4.3  
changed lines
  Added in v.1.144.4.4

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2