(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.3 and 1.11

version 1.3, 2001/02/19 01:47:16 version 1.11, 2001/04/29 18:57:33
Line 1 
Line 1 
 //BEGIN_LICENSE  //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
 // //
Line 17 
Line 17 
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
 // //
 //END_LICENSE  //==============================================================================
 //BEGIN_HISTORY  
 // //
 // Author:  // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // $Log$  // Modified By:
 // Revision 1.3  2001/02/19 01:47:16  mike  
 // Renamed names of the form CIMConst to ConstCIM.  
 // //
 // Revision 1.2  2001/02/16 02:06:07  mike  //%/////////////////////////////////////////////////////////////////////////////
 // Renamed many classes and headers.  
 //  
 // Revision 1.1.1.1  2001/01/14 19:53:32  mike  
 // Pegasus import  
 //  
 //  
 //END_HISTORY  
  
 #include <cassert> #include <cassert>
 #include <cctype> #include <cctype>
Line 48 
Line 38 
 #include "CIMInstance.h" #include "CIMInstance.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
   //debug
   #include <iostream>
   using namespace std;
  
 static const Uint32 MESSAGE_SIZE = 128; static const Uint32 MESSAGE_SIZE = 128;
  
Line 336 
Line 329 
         throw XmlValidationError(lineNumber, buffer);         throw XmlValidationError(lineNumber, buffer);
     }     }
  
     if (acceptNull && name.getLength() == 0)      if (acceptNull && name.size() == 0)
         return name;         return name;
  
     if (!CIMName::legal(name))     if (!CIMName::legal(name))
Line 913 
Line 906 
     // Get VALUE start tag:     // Get VALUE start tag:
  
     XmlEntry entry;     XmlEntry entry;
   
     if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))     if (!testStartTagOrEmptyTag(parser, entry, "VALUE"))
         return false;         return false;
  
Line 922 
Line 914 
     // Get VALUE content:     // Get VALUE content:
  
     const char* valueString = "";     const char* valueString = "";
       // cout << "DEBUG XMLReader:getValueElement " << __LINE__ ;
  
     if (!empty)     if (!empty)
     {     {
         if (testContentOrCData(parser, entry))         if (testContentOrCData(parser, entry))
             valueString = entry.text;             valueString = entry.text;
           //cout << "DEBUG XMLReader:getValueElement " << __LINE__
           //    <<  " valueString " << valueString ;
  
         expectEndTag(parser, "VALUE");         expectEndTag(parser, "VALUE");
     }     }
  
     value = stringToValue(parser.getLine(), valueString,type);     value = stringToValue(parser.getLine(), valueString,type);
       //cout << "DEBUG XMLReader:getValueElement " << __LINE__
       //  << " value " << value;
       return true;
   }
   
   
   //----------------------------------------------------------------------------
   //
   // getPropertyValue
   //     Use: Decode property value from getPropertyResponse
   //     Expect (ERROR|IRETURNVALUE).!ELEMENT VALUE (#PCDATA)>
   //
   //      PropertyValue:
   //      <!ELEMENT VALUE>
   //
   //      <!ELEMENT VALUE.ARRAY (VALUE*)>
   //
   //      <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME|
   //                           INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)>
   //
   //----------------------------------------------------------------------------
   Boolean XmlReader::getPropertyValue(
       XmlParser& parser,
       CIMValue& cimValue)
   {
       //Test for Element value type
       CIMType type = CIMType::STRING;
   
       if (XmlReader::getValueElement(parser, type, cimValue))
       {
           //cout << "DEBUG xmlReader::getPropertyValue " << __LINE__
           //    << " CimValue = " << cimValue.toString << endl;
     return true;     return true;
 } }
  
       //Test for Element.array value
       if(XmlReader::getValueArrayElement(parser, type, cimValue))
          return true;
   
       // Test for Value.reference type
       // ATTN:This returns a different type (CIMReference)
       // ATTN: Possibly change to simply return result after
       // we figure out the type differences.
   
      CIMReference reference;
      if(XmlReader::getValueReferenceElement(parser, reference))
         return true;
   
      return false;
   }
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // stringArrayToValue() // stringArrayToValue()
Line 950 
Line 993 
 { {
     Array<T> array;     Array<T> array;
  
     for (Uint32 i = 0, n = stringArray.getSize(); 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], type);
Line 1539 
Line 1582 
  
     while (getNameSpaceElement(parser, nameSpaceComponent))     while (getNameSpaceElement(parser, nameSpaceComponent))
     {     {
         if (nameSpace.getLength())          if (nameSpace.size())
             nameSpace += '/';             nameSpace += '/';
  
         nameSpace += nameSpaceComponent;         nameSpace += nameSpaceComponent;
     }     }
  
     if (!nameSpace.getLength())      if (!nameSpace.size())
     {     {
         throw XmlValidationError(parser.getLine(),         throw XmlValidationError(parser.getLine(),
             "Expected one or more NAMESPACE elements within "             "Expected one or more NAMESPACE elements within "
Line 1637 
Line 1680 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 KeyBinding::CIMType XmlReader::getValueTypeAttribute(  KeyBinding::Type XmlReader::getValueTypeAttribute(
     Uint32 lineNumber,     Uint32 lineNumber,
     const XmlEntry& entry,     const XmlEntry& entry,
     const char* elementName)     const char* elementName)
Line 1647 
Line 1690 
     if (!entry.getAttributeValue("VALUETYPE", tmp))     if (!entry.getAttributeValue("VALUETYPE", tmp))
         return KeyBinding::STRING;         return KeyBinding::STRING;
  
     if (tmp == "string")      if (String::equal(tmp, "string"))
         return KeyBinding::STRING;         return KeyBinding::STRING;
     else if (tmp == "boolean")      else if (String::equal(tmp, "boolean"))
         return KeyBinding::BOOLEAN;         return KeyBinding::BOOLEAN;
     else if (tmp == "numeric")      else if (String::equal(tmp, "numeric"))
         return KeyBinding::NUMERIC;         return KeyBinding::NUMERIC;
  
     char buffer[MESSAGE_SIZE];     char buffer[MESSAGE_SIZE];
Line 1679 
Line 1722 
  
 Boolean XmlReader::getKeyValueElement( Boolean XmlReader::getKeyValueElement(
     XmlParser& parser,     XmlParser& parser,
     KeyBinding::CIMType& type,      KeyBinding::Type& type,
     String& value)     String& value)
 { {
     XmlEntry entry;     XmlEntry entry;
Line 1725 
Line 1768 
     XmlParser& parser,     XmlParser& parser,
     String& name,     String& name,
     String& value,     String& value,
     KeyBinding::CIMType& type)      KeyBinding::Type& type)
 { {
     XmlEntry entry;     XmlEntry entry;
  
Line 1774 
Line 1817 
     if (!empty)     if (!empty)
     {     {
         String name;         String name;
         KeyBinding::CIMType type;          KeyBinding::Type type;
         String value;         String value;
  
         while (getKeyBindingElement(parser, name, value, type))         while (getKeyBindingElement(parser, name, value, type))
Line 2656 
Line 2699 
     return true;     return true;
 } }
  
   
   
   
   
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // getErrorElement() // getErrorElement()
Line 2669 
Line 2717 
  
 Boolean XmlReader::getErrorElement( Boolean XmlReader::getErrorElement(
     XmlParser& parser,     XmlParser& parser,
     CimException::Code& code,      CIMException::Code& code,
     const char*& description,     const char*& description,
     Boolean required)     Boolean required)
 { {
Line 2692 
Line 2740 
         throw XmlValidationError(         throw XmlValidationError(
             parser.getLine(), "missing ERROR.CODE attribute");             parser.getLine(), "missing ERROR.CODE attribute");
  
     code = CimException::Code(tmpCode);      code = CIMException::Code(tmpCode);
  
     // Get ERROR.DESCRIPTION:     // Get ERROR.DESCRIPTION:
  


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.11

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2