(file) Return to XmlWriter.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlWriter.cpp between version 1.28 and 1.98

version 1.28, 2002/03/01 00:59:57 version 1.98, 2003/10/16 23:26:05
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
 // The Open Group, Tivoli Systems // The Open Group, Tivoli Systems
 // //
 // 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
Line 26 
Line 26 
 // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 //              Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) //              Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              Carol Ann Krug Graves, Hewlett-Packard Company
   //                  (carolann_graves@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
   #include <Pegasus/Common/Config.h>
 #include <cstdlib> #include <cstdlib>
 #include <cstdio> #include <cstdio>
   #include "Constants.h"
 #include "Destroyer.h" #include "Destroyer.h"
 #include "CIMClass.h" #include "CIMClass.h"
   #include "CIMClassRep.h"
 #include "CIMInstance.h" #include "CIMInstance.h"
   #include "CIMInstanceRep.h"
   #include "CIMProperty.h"
   #include "CIMPropertyRep.h"
   #include "CIMMethod.h"
   #include "CIMMethodRep.h"
   #include "CIMParameter.h"
   #include "CIMParameterRep.h"
   #include "CIMParamValue.h"
   #include "CIMParamValueRep.h"
   #include "CIMQualifier.h"
   #include "CIMQualifierRep.h"
 #include "CIMQualifierDecl.h" #include "CIMQualifierDecl.h"
   #include "CIMQualifierDeclRep.h"
   #include "CIMValue.h"
 #include "XmlWriter.h" #include "XmlWriter.h"
 #include "XmlParser.h" #include "XmlParser.h"
   #include "Tracer.h"
   #include <Pegasus/Common/StatisticalData.h>
   #include "CommonUTF.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 52 
Line 73 
     return out;     return out;
 } }
  
 Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x)  Array<Sint8>& operator<<(Array<Sint8>& out, const Char16& x)
 { {
     XmlWriter::append(out, x);     XmlWriter::append(out, x);
     return out;     return out;
Line 82 
Line 103 
     return out;     return out;
 } }
  
 inline void _appendChar(Array<Sint8>& out, Char16 c)  Array<Sint8>& operator<<(Array<Sint8>& out, const CIMName& name)
 { {
     out.append(Sint8(c));      XmlWriter::append(out, name.getString ());
       return out;
   }
   
   
   // l10n
   Array<Sint8>& operator<<(Array<Sint8>& out, const AcceptLanguages& al)
   {
       XmlWriter::append(out, al.toString ());
       return out;
   }
   
   // l10n
   Array<Sint8>& operator<<(Array<Sint8>& out, const ContentLanguages& cl)
   {
       XmlWriter::append(out, cl.toString ());
       return out;
   }
   
   
   PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const CIMDateTime& x)
   {
       return os << x.toString();
   }
   
   PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const CIMName& name)
   {
       os << name.getString();
       return os;
   }
   
   PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os,
       const CIMNamespaceName& name)
   {
       os << name.getString();
       return os;
   }
   
   static inline void _appendChar(Array<Sint8>& out, const Char16& c)
   {
       // We need to convert the Char16 to UTF8 then append the UTF8
       // character into the array.
       // NOTE: The UTF8 character could be several bytes long.
       // WARNING: This function will put in replacement character for
       // all characters that have surogate pairs.
       Uint8 str[6];
       memset(str,0x00,sizeof(str));
       Uint8* charIN = (Uint8 *)&c;
   
       const Uint16 *strsrc = (Uint16 *)charIN;
       Uint16 *endsrc = (Uint16 *)&charIN[1];
   
       Uint8 *strtgt = (Uint8 *)str;
       Uint8 *endtgt = (Uint8 *)&str[5];
   
       UTF16toUTF8(&strsrc,
                   endsrc,
                   &strtgt,
                   endtgt);
   
       out.append((Sint8 *)str,trailingBytesForUTF8[Uint32(str[0])]+1);
   }
   
   static inline void _appendSpecialChar(Array<Sint8>& out, const Char16& c)
   {
       if ( ((c < Char16(0x20)) && (c >= Char16(0x00))) || (c == Char16(0x7f)) )
       {
           char charref[7];
           sprintf(charref, "&#%u;", (Uint16)c);
           out.append(charref, strlen(charref));
 } }
       else
       {
           switch (c)
           {
               case '&':
                   out.append("&amp;", 5);
                   break;
   
               case '<':
                   out.append("&lt;", 4);
                   break;
   
               case '>':
                   out.append("&gt;", 4);
                   break;
   
               case '"':
                   out.append("&quot;", 6);
                   break;
   
               case '\'':
                   out.append("&apos;", 6);
                   break;
  
 inline void _appendSpecialChar(Array<Sint8>& out, Char16 c)              default:
 { {
     // ATTN-B: Only UTF-8 handled for now.                      // We need to convert the Char16 to UTF8 then append the UTF8
                       // character into the array.
                       // NOTE: The UTF8 character could be several bytes long.
                       // WARNING: This function will put in replacement character for
                       // all characters that have surogate pairs.
                       Uint8 str[6];
                       memset(str,0x00,sizeof(str));
                       Uint8* charIN = (Uint8 *)&c;
   
                       const Uint16 *strsrc = (Uint16 *)charIN;
                       Uint16 *endsrc = (Uint16 *)&charIN[1];
   
                       Uint8 *strtgt = (Uint8 *)str;
                       Uint8 *endtgt = (Uint8 *)&str[5];
   
                       UTF16toUTF8(&strsrc,
                                   endsrc,
                                   &strtgt,
                                   endtgt);
   
                       Uint32 number1 = trailingBytesForUTF8[Uint32(str[0])]+1;
   
                       out.append((Sint8 *)str,number1);
                   }
           }
       }
   }
  
   static inline void _appendSpecialChar(Array<Sint8>& out, char c)
   {
       if ( ((c < Char16(0x20)) && (c >= Char16(0x00))) || (c == Char16(0x7f)) )
       {
           char charref[7];
           sprintf(charref, "&#%u;", (Uint8)c);
           out.append(charref, strlen(charref));
       }
       else
       {
     switch (c)     switch (c)
     {     {
         case '&':         case '&':
Line 117 
Line 266 
             out.append(Sint8(c));             out.append(Sint8(c));
     }     }
 } }
   }
   
  
 static inline void _appendSpecialChar(PEGASUS_STD(ostream)& os, char c) static inline void _appendSpecialChar(PEGASUS_STD(ostream)& os, char c)
 { {
       if ( (c < Char16(0x20)) || (c == Char16(0x7f)) )
       {
           char charref[7];
           sprintf(charref, "&#%u;", (Uint8)c);
           os << charref;
       }
       else
       {
     switch (c)     switch (c)
     {     {
         case '&':         case '&':
Line 146 
Line 305 
             os << c;             os << c;
     }     }
 } }
   }
   
   void _appendSurrogatePair(Array<Sint8>& out, Uint16 high, Uint16 low)
   {
       Uint8 str[6];
       Uint8 charIN[5];
       memset(str,0x00,sizeof(str));
       memcpy(&charIN,&high,2);
       memcpy(&charIN[2],&low,2);
       const Uint16 *strsrc = (Uint16 *)charIN;
       Uint16 *endsrc = (Uint16 *)&charIN[3];
   
       Uint8 *strtgt = (Uint8 *)str;
       Uint8 *endtgt = (Uint8 *)&str[5];
   
       UTF16toUTF8(&strsrc,
                   endsrc,
                   &strtgt,
                   endtgt);
   
       Uint32 number1 = trailingBytesForUTF8[Uint32(str[0])]+1;
       out.append((Sint8 *)str,number1);
   }
  
 static inline void _appendSpecial(PEGASUS_STD(ostream)& os, const char* str) static inline void _appendSpecial(PEGASUS_STD(ostream)& os, const char* str)
 { {
Line 153 
Line 335 
         _appendSpecialChar(os, *str++);         _appendSpecialChar(os, *str++);
 } }
  
 void XmlWriter::append(Array<Sint8>& out, Char16 x)  void XmlWriter::append(Array<Sint8>& out, const Char16& x)
 { {
     _appendChar(out, x);     _appendChar(out, x);
 } }
  
 void XmlWriter::append(Array<Sint8>& out, Uint32 x)  void XmlWriter::append(Array<Sint8>& out, Boolean x)
   {
       append(out, (x ? "TRUE" : "FALSE"));
   }
   
   void XmlWriter::append(Array<Sint8>& out, Uint32 x)
   {
       char buffer[32];
       sprintf(buffer, "%u", x);
       append(out, buffer);
   }
   
   void XmlWriter::append(Array<Sint8>& out, Sint32 x)
   {
       char buffer[32];
       sprintf(buffer, "%d", x);
       append(out, buffer);
   }
   
   void XmlWriter::append(Array<Sint8>& out, Uint64 x)
   {
       char buffer[32];  // Should need 21 chars max
       sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", x);
       append(out, buffer);
   }
   
   void XmlWriter::append(Array<Sint8>& out, Sint64 x)
   {
       char buffer[32];  // Should need 21 chars max
       sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", x);
       append(out, buffer);
   }
   
   void XmlWriter::append(Array<Sint8>& out, Real64 x)
   {
       char buffer[128];
       // %e gives '[-]m.dddddde+/-xx', which seems compatible with CIM/XML spec
       sprintf(buffer, "%e", x);
       append(out, buffer);
   }
   
   void XmlWriter::append(Array<Sint8>& out, const char* str)
   {
       while (*str)
           _appendChar(out, *str++);
   }
   
   void XmlWriter::append(Array<Sint8>& out, const String& str)
   {
       for (Uint32 i = 0; i < str.size(); i++)
       {
           Uint16 c = str[i];
           if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||
              ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE)))
           {
               Char16 highSurrogate = str[i];
               Char16 lowSurrogate = str[++i];
   
               _appendSurrogatePair(out, Uint16(highSurrogate),Uint16(lowSurrogate));
           }
           else
           {
               _appendChar(out, str[i]);
           }
       }
   }
   
   void XmlWriter::append(Array<Sint8>& out, const Indentor& x)
   {
       for (Uint32 i = 0; i < 4 * x.getLevel(); i++)
           out.append(' ');
   }
   
   void XmlWriter::appendSpecial(Array<Sint8>& out, const Char16& x)
   {
       _appendSpecialChar(out, x);
   }
   
   void XmlWriter::appendSpecial(Array<Sint8>& out, char x)
   {
       _appendSpecialChar(out, x);
   }
   
   void XmlWriter::appendSpecial(Array<Sint8>& out, const char* str)
   {
       while (*str)
           _appendSpecialChar(out, *str++);
   }
   
   void XmlWriter::appendSpecial(Array<Sint8>& out, const String& str)
   {
       for (Uint32 i = 0; i < str.size(); i++)
       {
           Uint16 c = str[i];
   
           if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||
              ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE)))
           {
               Char16 highSurrogate = str[i];
               Char16 lowSurrogate = str[++i];
   
               _appendSurrogatePair(out, Uint16(highSurrogate),Uint16(lowSurrogate));
           }
           else
           {
               _appendSpecialChar(out, str[i]);
           }
       }
   }
   
   // chuck start
   
   // See http://www.ietf.org/rfc/rfc2396.txt section 2
   // Reserved characters = ';' '/' '?' ':' '@' '&' '=' '+' '$' ','
   // Excluded characters:
   //   Control characters = 0x00-0x1f, 0x7f
   //   Space character = 0x20
   //   Delimiters = '<' '>' '#' '%' '"'
   //   Unwise = '{' '}' '|' '\\' '^' '[' ']' '`'
   //
   
   static inline void _encodeURIChar(String& outString, Sint8 char8)
   {
       Uint8 c = (Uint8)char8;
   
   #ifndef PEGASUS_DO_NOT_IMPLEMENT_URI_ENCODING
       if ( ((c <= 0x20) && (c >= 0x00)) ||    // Control characters + space char
            ( (c >= 0x22) && (c <= 0x26) ) ||  // '"' '#' '$' '%' '&'
            (c == 0x2b) ||                     // '+'
            (c == 0x2c) ||                     // ','
            (c == 0x2f) ||                     // '/'
            ( (c >= 0x3a) && (c <= 0x40) ) ||  // ':' ';' '<' '=' '>' '?' '@'
            ( (c >= 0x5b) && (c <= 0x5e) ) ||  // '[' '\\' ']' '^'
            (c == 0x60) ||                     // '`'
            ( (c >= 0x7b) && (c <= 0x7d) ) ||  // '{' '|' '}'
   //       (c == 0x7f) )                      // Control character
            (c >= 0x7f) )                      // Control character or non US-ASCII (UTF-8)
       {
           char hexencoding[4];
   
           sprintf(hexencoding, "%%%X%X", c/16, c%16);
           outString.append(hexencoding);
       }
       else
   #endif
       {
           outString.append((Uint16)c);
       }
   }
   
   String XmlWriter::encodeURICharacters(Array<Sint8> uriString)
   {
       String encodedString;
   
       for (Uint32 i=0; i<uriString.size(); i++)
       {
           _encodeURIChar(encodedString, uriString[i]);
       }
   
       return encodedString;
   }
   
   String XmlWriter::encodeURICharacters(String uriString)
   {
       String encodedString;
   
   /* i18n remove - did not handle surrogate pairs
       for (Uint32 i=0; i<uriString.size(); i++)
       {
           _encodeURIChar(encodedString, uriString[i]);
       }
   */
   
       // See the "CIM Operations over HTTP" spec, section 3.3.2 and
       // 3.3.3, for the treatment of non US-ASCII (UTF-8) chars
   
       // First, convert to UTF-8 (include handling of surrogate pairs)
       Array<Sint8> utf8;
       for (Uint32 i = 0; i < uriString.size(); i++)
       {
           Uint16 c = uriString[i];
   
           if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||
              ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE)))
           {
               Char16 highSurrogate = uriString[i];
               Char16 lowSurrogate = uriString[++i];
   
               _appendSurrogatePair(utf8, Uint16(highSurrogate),Uint16(lowSurrogate));
           }
           else
           {
               _appendChar(utf8, uriString[i]);
           }
       }
   
       // Second, escape the non HTTP-safe chars
       for (Uint32 i=0; i<utf8.size(); i++)
       {
           _encodeURIChar(encodedString, utf8[i]);
       }
   
       return encodedString;
   }
   
   //------------------------------------------------------------------------------
   //
   // appendLocalNameSpacePathElement()
   //
   //     <!ELEMENT LOCALNAMESPACEPATH (NAMESPACE+)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendLocalNameSpacePathElement(
       Array<Sint8>& out,
       const CIMNamespaceName& nameSpace)
   {
       out << "<LOCALNAMESPACEPATH>\n";
   
       char* nameSpaceCopy = strdup(nameSpace.getString().getCStringUTF8());
   #if defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) || \
       defined(PEGASUS_OS_HPUX) || \
       defined(PEGASUS_OS_LINUX)
       char *last;
       for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p;
            p = strtok_r(NULL, "/", &last))
   #else
       for (const char* p = strtok(nameSpaceCopy, "/"); p; p = strtok(NULL, "/"))
   #endif
       {
           out << "<NAMESPACE NAME=\"" << p << "\"/>\n";
       }
       free(nameSpaceCopy);
   
       out << "</LOCALNAMESPACEPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendNameSpacePathElement()
   //
   //     <!ELEMENT NAMESPACEPATH (HOST,LOCALNAMESPACEPATH)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendNameSpacePathElement(
       Array<Sint8>& out,
       const String& host,
       const CIMNamespaceName& nameSpace)
   {
       out << "<NAMESPACEPATH>\n";
       out << "<HOST>" << host << "</HOST>\n";
       appendLocalNameSpacePathElement(out, nameSpace);
       out << "</NAMESPACEPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendClassNameElement()
   //
   //     <!ELEMENT CLASSNAME EMPTY>
   //     <!ATTLIST CLASSNAME
   //              %CIMName;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendClassNameElement(
       Array<Sint8>& out,
       const CIMName& className)
   {
       out << "<CLASSNAME NAME=\"" << className << "\"/>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendInstanceNameElement()
   //
   //    <!ELEMENT INSTANCENAME (KEYBINDING*|KEYVALUE?|VALUE.REFERENCE?)>
   //    <!ATTLIST INSTANCENAME
   //              %ClassName;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendInstanceNameElement(
       Array<Sint8>& out,
       const CIMObjectPath& instanceName)
   {
       out << "<INSTANCENAME CLASSNAME=\"" << instanceName.getClassName() << "\">\n";
   
       Array<CIMKeyBinding> keyBindings = instanceName.getKeyBindings();
       for (Uint32 i = 0, n = keyBindings.size(); i < n; i++)
       {
           out << "<KEYBINDING NAME=\"" << keyBindings[i].getName() << "\">\n";
   
           if (keyBindings[i].getType() == CIMKeyBinding::REFERENCE)
           {
               CIMObjectPath ref = keyBindings[i].getValue();
               appendValueReferenceElement(out, ref, true);
           }
           else {
               out << "<KEYVALUE VALUETYPE=\"";
               out << keyBindingTypeToString(keyBindings[i].getType());
               out << "\">";
   
               // fixed the special character problem - Markus
   
               appendSpecial(out, keyBindings[i].getValue());
               out << "</KEYVALUE>\n";
           }
           out << "</KEYBINDING>\n";
       }
       out << "</INSTANCENAME>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendClassPathElement()
   //
   //     <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendClassPathElement(
       Array<Sint8>& out,
       const CIMObjectPath& classPath)
   {
       out << "<CLASSPATH>\n";
       appendNameSpacePathElement(out,
                                  classPath.getHost(),
                                  classPath.getNameSpace());
       appendClassNameElement(out, classPath.getClassName());
       out << "</CLASSPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendInstancePathElement()
   //
   //     <!ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendInstancePathElement(
       Array<Sint8>& out,
       const CIMObjectPath& instancePath)
   {
       out << "<INSTANCEPATH>\n";
       appendNameSpacePathElement(out,
                                  instancePath.getHost(),
                                  instancePath.getNameSpace());
       appendInstanceNameElement(out, instancePath);
       out << "</INSTANCEPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendLocalClassPathElement()
   //
   //     <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendLocalClassPathElement(
       Array<Sint8>& out,
       const CIMObjectPath& classPath)
   {
       out << "<LOCALCLASSPATH>\n";
       appendLocalNameSpacePathElement(out, classPath.getNameSpace());
       appendClassNameElement(out, classPath.getClassName());
       out << "</LOCALCLASSPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendLocalInstancePathElement()
   //
   //     <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH, INSTANCENAME)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendLocalInstancePathElement(
       Array<Sint8>& out,
       const CIMObjectPath& instancePath)
   {
       out << "<LOCALINSTANCEPATH>\n";
       appendLocalNameSpacePathElement(out, instancePath.getNameSpace());
       appendInstanceNameElement(out, instancePath);
       out << "</LOCALINSTANCEPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendLocalObjectPathElement()
   //
   //     If the reference refers to an instance, write a LOCALINSTANCEPATH;
   //     otherwise write a LOCALCLASSPATH.
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendLocalObjectPathElement(
       Array<Sint8>& out,
       const CIMObjectPath& objectPath)
   {
       //
       //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
       //  distinguish instanceNames from classNames in every case
       //  The instanceName of a singleton instance of a keyless class has no
       //  key bindings
       //
       if (objectPath.getKeyBindings ().size () != 0)
       {
           appendLocalInstancePathElement(out, objectPath);
       }
       else
       {
           appendLocalClassPathElement(out, objectPath);
       }
   }
   
   //------------------------------------------------------------------------------
   //
   // Helper functions for appendValueElement()
   //
   //------------------------------------------------------------------------------
   
   static inline void _appendValue(Array<Sint8>& out, Boolean x)
   {
       XmlWriter::append(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, Uint8 x)
   {
       XmlWriter::append(out, Uint32(x));
   }
   
   static inline void _appendValue(Array<Sint8>& out, Sint8 x)
   {
       XmlWriter::append(out, Sint32(x));
   }
   
   static inline void _appendValue(Array<Sint8>& out, Uint16 x)
   {
       XmlWriter::append(out, Uint32(x));
   }
   
   static inline void _appendValue(Array<Sint8>& out, Sint16 x)
   {
       XmlWriter::append(out, Sint32(x));
   }
   
   static inline void _appendValue(Array<Sint8>& out, Uint32 x)
   {
       XmlWriter::append(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, Sint32 x)
   {
       XmlWriter::append(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, Uint64 x)
   {
       XmlWriter::append(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, Sint64 x)
   {
       XmlWriter::append(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, Real32 x)
   {
       XmlWriter::append(out, Real64(x));
   }
   
   static inline void _appendValue(Array<Sint8>& out, Real64 x)
   {
       XmlWriter::append(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, const Char16& x)
   {
       XmlWriter::appendSpecial(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, const String& x)
   {
       XmlWriter::appendSpecial(out, x);
   }
   
   static inline void _appendValue(Array<Sint8>& out, const CIMDateTime& x)
   {
       out << x.toString();  //ATTN: append() method?
   }
   
   static inline void _appendValue(Array<Sint8>& out, const CIMObjectPath& x)
   {
       XmlWriter::appendValueReferenceElement(out, x, true);
   }
   
   void _appendValueArray(Array<Sint8>& out, const CIMObjectPath* p, Uint32 size)
   {
       out << "<VALUE.REFARRAY>\n";
       while (size--)
       {
           _appendValue(out, *p++);
       }
       out << "</VALUE.REFARRAY>\n";
   }
   
   template<class T>
   void _appendValueArray(Array<Sint8>& out, const T* p, Uint32 size)
   {
       out << "<VALUE.ARRAY>\n";
   
       while (size--)
       {
           out << "<VALUE>";
           _appendValue(out, *p++);
           out << "</VALUE>\n";
       }
   
       out << "</VALUE.ARRAY>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendValueElement()
   //
   //    <!ELEMENT VALUE (#PCDATA)>
   //    <!ELEMENT VALUE.ARRAY (VALUE*)>
   //    <!ELEMENT VALUE.REFERENCE
   //        (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|
   //         INSTANCENAME)>
   //    <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE*)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendValueElement(
       Array<Sint8>& out,
       const CIMValue& value)
   {
       if (value.isNull())
       {
           return;
       }
       if (value.isArray())
       {
           switch (value.getType())
           {
               case CIMTYPE_BOOLEAN:
               {
                   Array<Boolean> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_UINT8:
               {
                   Array<Uint8> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_SINT8:
               {
                   Array<Sint8> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_UINT16:
               {
                   Array<Uint16> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_SINT16:
               {
                   Array<Sint16> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_UINT32:
               {
                   Array<Uint32> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_SINT32:
               {
                   Array<Sint32> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_UINT64:
               {
                   Array<Uint64> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_SINT64:
               {
                   Array<Sint64> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_REAL32:
               {
                   Array<Real32> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_REAL64:
               {
                   Array<Real64> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_CHAR16:
               {
                   Array<Char16> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_STRING:
               {
                   Array<String> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_DATETIME:
               {
                   Array<CIMDateTime> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               case CIMTYPE_REFERENCE:
               {
                   Array<CIMObjectPath> a;
                   value.get(a);
                   _appendValueArray(out, a.getData(), a.size());
                   break;
               }
   
               default:
                   PEGASUS_ASSERT(false);
           }
       }
       else if (value.getType() == CIMTYPE_REFERENCE)
       {
           // Has to be separate because it uses VALUE.REFERENCE tag
           CIMObjectPath v;
           value.get(v);
           _appendValue(out, v);
       }
       else
       {
           out << "<VALUE>";
   
           switch (value.getType())
           {
               case CIMTYPE_BOOLEAN:
               {
                   Boolean v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_UINT8:
               {
                   Uint8 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_SINT8:
               {
                   Sint8 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_UINT16:
               {
                   Uint16 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_SINT16:
               {
                   Sint16 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_UINT32:
               {
                   Uint32 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_SINT32:
               {
                   Sint32 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_UINT64:
               {
                   Uint64 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_SINT64:
               {
                   Sint64 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_REAL32:
               {
                   Real32 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_REAL64:
               {
                   Real64 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_CHAR16:
               {
                   Char16 v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_STRING:
               {
                   String v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               case CIMTYPE_DATETIME:
               {
                   CIMDateTime v;
                   value.get(v);
                   _appendValue(out, v);
                   break;
               }
   
               default:
                   PEGASUS_ASSERT(false);
           }
   
           out << "</VALUE>\n";
       }
   }
   
   void XmlWriter::printValueElement(
       const CIMValue& value,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendValueElement(tmp, value);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendValueObjectWithPathElement()
   //
   //     <!ELEMENT VALUE.OBJECTWITHPATH
   //         ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendValueObjectWithPathElement(
       Array<Sint8>& out,
       const CIMObject& objectWithPath)
   {
       out << "<VALUE.OBJECTWITHPATH>\n";
   
       appendValueReferenceElement(out, objectWithPath.getPath (), false);
       appendObjectElement(out, objectWithPath);
   
       out << "</VALUE.OBJECTWITHPATH>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendValueReferenceElement()
   //
   //    <!ELEMENT VALUE.REFERENCE
   //        (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|
   //         INSTANCENAME)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendValueReferenceElement(
       Array<Sint8>& out,
       const CIMObjectPath& reference,
       Boolean putValueWrapper)
   {
       if (putValueWrapper)
           out << "<VALUE.REFERENCE>\n";
   
       // See if it is a class or instance reference (instance references have
       // key-bindings; class references do not).
       //
       //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
       //  distinguish instanceNames from classNames in every case
       //  The instanceName of a singleton instance of a keyless class has no
       //  key bindings
       //
   
       Array<CIMKeyBinding> kbs = reference.getKeyBindings();
   
       if (kbs.size())
       {
           if (reference.getHost().size())
           {
               appendInstancePathElement(out, reference);
           }
           else if (!reference.getNameSpace().isNull())
           {
               appendLocalInstancePathElement(out, reference);
           }
           else
           {
               appendInstanceNameElement(out, reference);
           }
       }
       else
       {
           if (reference.getHost().size())
           {
               appendClassPathElement(out, reference);
           }
           else if (!reference.getNameSpace().isNull())
           {
               appendLocalClassPathElement(out, reference);
           }
           else
           {
               appendClassNameElement(out, reference.getClassName());
           }
       }
   
       if (putValueWrapper)
           out << "</VALUE.REFERENCE>\n";
   }
   
   void XmlWriter::printValueReferenceElement(
       const CIMObjectPath& reference,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendValueReferenceElement(tmp, reference, true);
       tmp.append('\0');
       indentedPrint(os, tmp.getData());
   }
   
   //------------------------------------------------------------------------------
   //
   // appendValueNamedInstanceElement()
   //
   //     <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendValueNamedInstanceElement(
       Array<Sint8>& out,
       const CIMInstance& namedInstance)
   {
       out << "<VALUE.NAMEDINSTANCE>\n";
   
       appendInstanceNameElement(out, namedInstance.getPath ());
       appendInstanceElement(out, namedInstance);
   
       out << "</VALUE.NAMEDINSTANCE>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendClassElement()
   //
   //     <!ELEMENT CLASS
   //         (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,METHOD*)>
   //     <!ATTLIST CLASS
   //         %CIMName;
   //         %SuperClass;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendClassElement(
       Array<Sint8>& out,
       const CIMConstClass& cimclass)
   {
       cimclass._checkRep();
       cimclass._rep->toXml(out);
   }
   
   void XmlWriter::printClassElement(
       const CIMConstClass& cimclass,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendClassElement(tmp, cimclass);
       tmp.append('\0');
       indentedPrint(os, tmp.getData(), 4);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendInstanceElement()
   //
   //     <!ELEMENT INSTANCE
   //         (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*)>
   //     <!ATTLIST INSTANCE
   //         %ClassName;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendInstanceElement(
       Array<Sint8>& out,
       const CIMConstInstance& instance)
   {
       instance._checkRep();
       instance._rep->toXml(out);
   }
   
   void XmlWriter::printInstanceElement(
       const CIMConstInstance& instance,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendInstanceElement(tmp, instance);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendObjectElement()
   //
   // May refer to a CLASS or an INSTANCE
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendObjectElement(
       Array<Sint8>& out,
       const CIMConstObject& object)
   {
       if (object.isClass())
       {
           CIMConstClass c(object);
           appendClassElement(out, c);
       }
       else if (object.isInstance())
       {
           CIMConstInstance i(object);
           appendInstanceElement(out, i);
       }
       // else PEGASUS_ASSERT(0);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendPropertyElement()
   //
   //     <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)>
   //     <!ATTLIST PROPERTY
   //              %CIMName;
   //              %CIMType;           #REQUIRED
   //              %ClassOrigin;
   //              %Propagated;>
   //
   //     <!ELEMENT PROPERTY.ARRAY (QUALIFIER*,VALUE.ARRAY?)>
   //     <!ATTLIST PROPERTY.ARRAY
   //              %CIMName;
   //              %CIMType;           #REQUIRED
   //              %ArraySize;
   //              %ClassOrigin;
   //              %Propagated;>
   //
   //     <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,VALUE.REFERENCE?)>
   //     <!ATTLIST PROPERTY.REFERENCE
   //              %CIMName;
   //              %ReferenceClass;
   //              %ClassOrigin;
   //              %Propagated;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendPropertyElement(
       Array<Sint8>& out,
       const CIMConstProperty& property)
   {
       property._checkRep();
       property._rep->toXml(out);
   }
   
   void XmlWriter::printPropertyElement(
       const CIMConstProperty& property,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendPropertyElement(tmp, property);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendMethodElement()
   //
   //     <!ELEMENT METHOD (QUALIFIER*,
   //         (PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)>
   //     <!ATTLIST METHOD
   //              %CIMName;
   //              %CIMType;          #IMPLIED
   //              %ClassOrigin;
   //              %Propagated;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendMethodElement(
       Array<Sint8>& out,
       const CIMConstMethod& method)
   {
       method._checkRep();
       method._rep->toXml(out);
   }
   
   void XmlWriter::printMethodElement(
       const CIMConstMethod& method,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendMethodElement(tmp, method);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendParameterElement()
   //
   //     <!ELEMENT PARAMETER (QUALIFIER*)>
   //     <!ATTLIST PARAMETER
   //              %CIMName;
   //              %CIMType;      #REQUIRED>
   //
   //     <!ELEMENT PARAMETER.REFERENCE (QUALIFIER*)>
   //     <!ATTLIST PARAMETER.REFERENCE
   //              %CIMName;
   //              %ReferenceClass;>
   //
   //     <!ELEMENT PARAMETER.ARRAY (QUALIFIER*)>
   //     <!ATTLIST PARAMETER.ARRAY
   //              %CIMName;
   //              %CIMType;           #REQUIRED
   //              %ArraySize;>
   //
   //     <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)>
   //     <!ATTLIST PARAMETER.REFARRAY
   //              %CIMName;
   //              %ReferenceClass;
   //              %ArraySize;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendParameterElement(
       Array<Sint8>& out,
       const CIMConstParameter& parameter)
   {
       parameter._checkRep();
       parameter._rep->toXml(out);
   }
   
   void XmlWriter::printParameterElement(
       const CIMConstParameter& parameter,
       PEGASUS_STD(ostream)& os)
   {
       Array<Sint8> tmp;
       appendParameterElement(tmp, parameter);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
   }
   
   //------------------------------------------------------------------------------
   //
   // appendParamValueElement()
   //
   //     <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?>
   //     <!ATTLIST PARAMVALUE
   //              %CIMName;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendParamValueElement(
       Array<Sint8>& out,
       const CIMParamValue& paramValue)
 { {
     char buffer[32];      paramValue._checkRep();
     sprintf(buffer, "%d", x);      paramValue._rep->toXml(out);
     append(out, buffer);  
 } }
  
 void XmlWriter::append(Array<Sint8>& out, const char* str)  void XmlWriter::printParamValueElement(
       const CIMParamValue& paramValue,
       PEGASUS_STD(ostream)& os)
 { {
     while (*str)      Array<Sint8> tmp;
         _appendChar(out, *str++);      appendParamValueElement(tmp, paramValue);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
 void XmlWriter::append(Array<Sint8>& out, const String& str)  //------------------------------------------------------------------------------
 {  //
     const Char16* tmp = str.getData();  // appendQualifierElement()
   //
     while (*tmp)  //     <!ELEMENT QUALIFIER (VALUE|VALUE.ARRAY)>
         _appendChar(out, *tmp++);  //     <!ATTLIST QUALIFIER
 }  //              %CIMName;
   //              %CIMType;               #REQUIRED
   //              %Propagated;
   //              %QualifierFlavor;>
   //
   //------------------------------------------------------------------------------
  
 void XmlWriter::append(Array<Sint8>& out, const Indentor& x)  void XmlWriter::appendQualifierElement(
       Array<Sint8>& out,
       const CIMConstQualifier& qualifier)
 { {
     for (Uint32 i = 0; i < 4 * x.getLevel(); i++)      qualifier._checkRep();
         out.append(' ');      qualifier._rep->toXml(out);
 } }
  
 void XmlWriter::appendSpecial(Array<Sint8>& out, Char16 x)  void XmlWriter::printQualifierElement(
       const CIMConstQualifier& qualifier,
       PEGASUS_STD(ostream)& os)
 { {
     _appendSpecialChar(out, x);      Array<Sint8> tmp;
       appendQualifierElement(tmp, qualifier);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
 void XmlWriter::appendSpecial(Array<Sint8>& out, char x)  //------------------------------------------------------------------------------
   //
   // appendQualifierDeclElement()
   //
   //     <!ELEMENT QUALIFIER.DECLARATION (SCOPE?,(VALUE|VALUE.ARRAY)?)>
   //     <!ATTLIST QUALIFIER.DECLARATION
   //              %CIMName;
   //              %CIMType;                       #REQUIRED
   //              ISARRAY        (true|false)     #IMPLIED
   //              %ArraySize;
   //              %QualifierFlavor;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendQualifierDeclElement(
       Array<Sint8>& out,
       const CIMConstQualifierDecl& qualifierDecl)
 { {
     _appendSpecialChar(out, Char16(x));      qualifierDecl._checkRep();
       qualifierDecl._rep->toXml(out);
 } }
  
 void XmlWriter::appendSpecial(Array<Sint8>& out, const char* str)  void XmlWriter::printQualifierDeclElement(
       const CIMConstQualifierDecl& qualifierDecl,
       PEGASUS_STD(ostream)& os)
 { {
     while (*str)      Array<Sint8> tmp;
         _appendSpecialChar(out, *str++);      appendQualifierDeclElement(tmp, qualifierDecl);
       tmp.append('\0');
       os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
 void XmlWriter::appendSpecial(Array<Sint8>& out, const String& str)  //------------------------------------------------------------------------------
   //
   // appendQualifierFlavorEntity()
   //
   //     <!ENTITY % QualifierFlavor "OVERRIDABLE  (true|false)   'true'
   //                                 TOSUBCLASS   (true|false)   'true'
   //                                 TOINSTANCE   (true|false)   'false'
   //                                 TRANSLATABLE (true|false)   'false'">
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendQualifierFlavorEntity(
       Array<Sint8>& out,
       const CIMFlavor & flavor)
 { {
     const Char16* tmp = str.getData();      if (!(flavor.hasFlavor (CIMFlavor::OVERRIDABLE)))
           out << " OVERRIDABLE=\"false\"";
   
       if (!(flavor.hasFlavor (CIMFlavor::TOSUBCLASS)))
           out << " TOSUBCLASS=\"false\"";
  
     while (*tmp)      if (flavor.hasFlavor (CIMFlavor::TOINSTANCE))
         _appendSpecialChar(out, *tmp++);          out << " TOINSTANCE=\"true\"";
   
       if (flavor.hasFlavor (CIMFlavor::TRANSLATABLE))
           out << " TRANSLATABLE=\"true\"";
 } }
  
 void XmlWriter::appendLocalNameSpaceElement(  //------------------------------------------------------------------------------
   //
   // appendScopeElement()
   //
   //     <!ELEMENT SCOPE EMPTY>
   //     <!ATTLIST SCOPE
   //              CLASS        (true|false)      'false'
   //              ASSOCIATION  (true|false)      'false'
   //              REFERENCE    (true|false)      'false'
   //              PROPERTY     (true|false)      'false'
   //              METHOD       (true|false)      'false'
   //              PARAMETER    (true|false)      'false'
   //              INDICATION   (true|false)      'false'>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendScopeElement(
     Array<Sint8>& out,     Array<Sint8>& out,
     const String& nameSpace)      const CIMScope & scope)
 { {
     out << "<LOCALNAMESPACEPATH>\n";      if (!(scope.equal (CIMScope ())))
       {
           out << "<SCOPE";
  
     char* tmp = nameSpace.allocateCString();          if (scope.hasScope (CIMScope::CLASS))
               out << " CLASS=\"true\"";
  
     for (char* p = strtok(tmp, "/"); p; p = strtok(NULL, "/"))          if (scope.hasScope (CIMScope::ASSOCIATION))
     {              out << " ASSOCIATION=\"true\"";
         out << "<NAMESPACE NAME=\"" << p << "\"/>\n";  
     }  
  
     delete [] tmp;          if (scope.hasScope (CIMScope::REFERENCE))
               out << " REFERENCE=\"true\"";
  
     out << "</LOCALNAMESPACEPATH>\n";          if (scope.hasScope (CIMScope::PROPERTY))
               out << " PROPERTY=\"true\"";
   
           if (scope.hasScope (CIMScope::METHOD))
               out << " METHOD=\"true\"";
   
           if (scope.hasScope (CIMScope::PARAMETER))
               out << " PARAMETER=\"true\"";
   
           if (scope.hasScope (CIMScope::INDICATION))
               out << " INDICATION=\"true\"";
   
           out << "/>";
 } }
   }
   
   // l10n - added content language and accept language support to
   // the header methods below
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendMethodCallHeader() // appendMethodCallHeader()
 // //
 //     Build HTTP request header.  //     Build HTTP method call request header.
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendMethodCallHeader( void XmlWriter::appendMethodCallHeader(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* host,     const char* host,
     const char* cimMethod,      const CIMName& cimMethod,
     const String& cimObject,     const String& cimObject,
     const String& authenticationHeader,     const String& authenticationHeader,
       HttpMethod httpMethod,
       const AcceptLanguages & acceptLanguages,
       const ContentLanguages & contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
       // ATTN: KS 20020926 - Temporary change to issue only POST. This may
       // be changed in the DMTF CIM Operations standard in the future.
       // If we kept M-Post we would have to retry with Post. Does not
       // do that in client today. Permanent change is to retry until spec
       // updated. This change is temp to finish tests or until the retry
       // installed.  Required because of change to wbemservices cimom
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "M-POST /cimom HTTP/1.1\r\n";     out << "M-POST /cimom HTTP/1.1\r\n";
       }
       else
       {
           out << "POST /cimom HTTP/1.1\r\n";
       }
     out << "HOST: " << host << "\r\n";     out << "HOST: " << host << "\r\n";
     out << "Content-CIMType: application/xml; charset=\"utf-8\"\r\n";      out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (acceptLanguages.size() > 0)
       {
           out << "Accept-Language: " << acceptLanguages << "\r\n";
       }
       if (contentLanguages.size() > 0)
       {
           out << "Content-Language: " << contentLanguages << "\r\n";
       }
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMOperation: MethodCall\r\n";     out << nn << "-CIMOperation: MethodCall\r\n";
     out << nn << "-CIMMethod: " << cimMethod << "\r\n";          out << nn << "-CIMMethod: "
     out << nn << "-CIMObject: " << cimObject << "\r\n";              << encodeURICharacters(cimMethod.getString()) << "\r\n";
           out << nn << "-CIMObject: " << encodeURICharacters(cimObject) << "\r\n";
       }
       else
       {
           out << "CIMOperation: MethodCall\r\n";
           out << "CIMMethod: " << encodeURICharacters(cimMethod.getString())
               << "\r\n";
           out << "CIMObject: " << encodeURICharacters(cimObject) << "\r\n";
       }
   
     if (authenticationHeader.size())     if (authenticationHeader.size())
     {     {
         out << authenticationHeader << "\r\n";         out << authenticationHeader << "\r\n";
Line 261 
Line 1721 
     out << "\r\n";     out << "\r\n";
 } }
  
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendMethodResponseHeader() // appendMethodResponseHeader()
Line 271 
Line 1732 
  
 void XmlWriter::appendMethodResponseHeader( void XmlWriter::appendMethodResponseHeader(
     Array<Sint8>& out,     Array<Sint8>& out,
       HttpMethod httpMethod,
       const ContentLanguages & contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
     out << "HTTP/1.1 200 OK\r\n";      out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";
     out << "Content-CIMType: application/xml; charset=\"utf-8\"\r\n";      STAT_SERVERTIME
       out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (contentLanguages.size() > 0)
       {
           out << "Content-Language: " << contentLanguages << "\r\n";
       }
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Ext:\r\n";     out << "Ext:\r\n";
     out << "Cache-Control: no-cache\r\n";     out << "Cache-Control: no-cache\r\n";
     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMOperation: MethodResponse\r\n\r\n";     out << nn << "-CIMOperation: MethodResponse\r\n\r\n";
 } }
       else
       {
           out << "CIMOperation: MethodResponse\r\n\r\n";
       }
   }
   
   //------------------------------------------------------------------------------
   //
   // appendHttpErrorResponseHeader()
   //
   //     Build HTTP error response header.
   //
   //     Returns error response message in the following format:
   //
   //        HTTP/1.1 400 Bad Request       (using specified status code)
   //        CIMError: <error type>         (if specified by caller)
   //        PGErrorDetail: <error text>    (if specified by caller)
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendHttpErrorResponseHeader(
       Array<Sint8>& out,
       const String& status,
       const String& cimError,
       const String& errorDetail)
   {
       out << "HTTP/1.1 " << status << "\r\n";
       if (cimError != String::EMPTY)
       {
           out << "CIMError: " << cimError << "\r\n";
       }
       if (errorDetail != String::EMPTY)
       {
           // ATTN-RK-P3-20020404: It is critical that this text not contain '\n'
           // ATTN-RK-P3-20020404: Need to encode this value properly.  (See
           // CIM/HTTP Specification section 3.3.2
           out << PEGASUS_HTTPHEADERTAG_ERRORDETAIL ": "
               << encodeURICharacters(errorDetail) << "\r\n";
       }
       out << "\r\n";
   }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
Line 308 
Line 1819 
     Array<Sint8>& out,     Array<Sint8>& out,
     const String& content)     const String& content)
 { {
     out << "HTTP/1.1 401 Unauthorized\r\n";      out << "HTTP/1.1 " HTTP_STATUS_UNAUTHORIZED "\r\n";
     out << content << "\r\n";     out << content << "\r\n";
     out << "\r\n";     out << "\r\n";
  
Line 322 
Line 1833 
 //    out << "</BODY></HTML>\r\n"; //    out << "</BODY></HTML>\r\n";
 } }
  
   #ifdef PEGASUS_KERBEROS_AUTHENTICATION
   //------------------------------------------------------------------------------
   //
   // appendOKResponseHeader()
   //
   //     Build HTTP authentication response header for unauthorized requests.
   //
   //     Returns OK message in the following format:
   //
   //        HTTP/1.1 200 OK
   //        WWW-Authenticate: Negotiate "token"
   //        <HTML><HEAD>
   //        <TITLE>200 OK</TITLE>
   //        </HEAD><BODY BGCOLOR="#99cc99">
   //        <H2>TEST200 OK</H2>
   //        <HR>
   //        </BODY></HTML>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendOKResponseHeader(
       Array<Sint8>& out,
       const String& content)
   {
       out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";
       out << content << "\r\n";
       out << "\r\n";
   
   //ATTN: We may need to include the following line, so that the browsers
   //      can display the error message.
   //    out << "<HTML><HEAD>\r\n";
   //    out << "<TITLE>" << "200 OK" <<  "</TITLE>\r\n";
   //    out << "</HEAD><BODY BGCOLOR=\"#99cc99\">\r\n";
   //    out << "<H2>TEST" << "200 OK" << "</H2>\r\n";
   //    out << "<HR>\r\n";
   //    out << "</BODY></HTML>\r\n";
   }
   #endif
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendMessageElementBegin()  // _appendMessageElementBegin()
 // appendMessageElementEnd()  // _appendMessageElementEnd()
 // //
 //     <!ELEMENT MESSAGE (SIMPLEREQ|MULTIREQ|SIMPLERSP|MULTIRSP)> //     <!ELEMENT MESSAGE (SIMPLEREQ|MULTIREQ|SIMPLERSP|MULTIRSP)>
 //     <!ATTLIST MESSAGE //     <!ATTLIST MESSAGE
Line 334 
Line 1884 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendMessageElementBegin(  void XmlWriter::_appendMessageElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const String& messageId)     const String& messageId)
 { {
Line 343 
Line 1893 
     out << "<MESSAGE ID=\"" << messageId << "\" PROTOCOLVERSION=\"1.0\">\n";     out << "<MESSAGE ID=\"" << messageId << "\" PROTOCOLVERSION=\"1.0\">\n";
 } }
  
 void XmlWriter::appendMessageElementEnd(  void XmlWriter::_appendMessageElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</MESSAGE>\n";     out << "</MESSAGE>\n";
Line 352 
Line 1902 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendSimpleReqElementBegin()  // _appendSimpleReqElementBegin()
 // appendSimpleReqElementEnd()  // _appendSimpleReqElementEnd()
 // //
 //     <!ELEMENT SIMPLEREQ (IMETHODCALL|METHODCALL)> //     <!ELEMENT SIMPLEREQ (IMETHODCALL|METHODCALL)>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendSimpleReqElementBegin(  void XmlWriter::_appendSimpleReqElementBegin(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "<SIMPLEREQ>\n";     out << "<SIMPLEREQ>\n";
 } }
  
 void XmlWriter::appendSimpleReqElementEnd(  void XmlWriter::_appendSimpleReqElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</SIMPLEREQ>\n";     out << "</SIMPLEREQ>\n";
Line 373 
Line 1923 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendMethodCallElementBegin()  // _appendMethodCallElementBegin()
 // appendMethodCallElementEnd()  // _appendMethodCallElementEnd()
 // //
 //     <!ELEMENT METHODCALL ((LOCALCLASSPATH|LOCALINSTANCEPATH),PARAMVALUE*)> //     <!ELEMENT METHODCALL ((LOCALCLASSPATH|LOCALINSTANCEPATH),PARAMVALUE*)>
 //     <!ATTLIST METHODCALL %CIMName;> //     <!ATTLIST METHODCALL %CIMName;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendMethodCallElementBegin(  void XmlWriter::_appendMethodCallElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)      const CIMName& name)
 { {
     out << "<METHODCALL NAME=\"" << name << "\">\n";     out << "<METHODCALL NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendMethodCallElementEnd(  void XmlWriter::_appendMethodCallElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</METHODCALL>\n";     out << "</METHODCALL>\n";
Line 396 
Line 1946 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendIMethodCallElementBegin()  // _appendIMethodCallElementBegin()
 // appendIMethodCallElementEnd()  // _appendIMethodCallElementEnd()
 // //
 //     <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH,IPARAMVALUE*)> //     <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH,IPARAMVALUE*)>
 //     <!ATTLIST IMETHODCALL %CIMName;> //     <!ATTLIST IMETHODCALL %CIMName;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendIMethodCallElementBegin(  void XmlWriter::_appendIMethodCallElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)      const CIMName& name)
 { {
     out << "<IMETHODCALL NAME=\"" << name << "\">\n";     out << "<IMETHODCALL NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendIMethodCallElementEnd(  void XmlWriter::_appendIMethodCallElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</IMETHODCALL>\n";     out << "</IMETHODCALL>\n";
Line 419 
Line 1969 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendIParamValueElementBegin()  // _appendIParamValueElementBegin()
 // appendIParamValueElementEnd()  // _appendIParamValueElementEnd()
 // //
 //     <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE //     <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE
 //         |INSTANCENAME|CLASSNAME|QUALIFIER.DECLARATION //         |INSTANCENAME|CLASSNAME|QUALIFIER.DECLARATION
Line 429 
Line 1979 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendIParamValueElementBegin(  void XmlWriter::_appendIParamValueElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)     const char* name)
 { {
     out << "<IPARAMVALUE NAME=\"" << name << "\">\n";     out << "<IPARAMVALUE NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendIParamValueElementEnd(  void XmlWriter::_appendIParamValueElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</IPARAMVALUE>\n";     out << "</IPARAMVALUE>\n";
Line 444 
Line 1994 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendSimpleRspElementBegin()  // _appendSimpleRspElementBegin()
 // appendSimpleRspElementEnd()  // _appendSimpleRspElementEnd()
 // //
 //     <!ELEMENT SIMPLERSP (METHODRESPONSE|IMETHODRESPONSE)> //     <!ELEMENT SIMPLERSP (METHODRESPONSE|IMETHODRESPONSE)>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendSimpleRspElementBegin(  void XmlWriter::_appendSimpleRspElementBegin(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "<SIMPLERSP>\n";     out << "<SIMPLERSP>\n";
 } }
  
 void XmlWriter::appendSimpleRspElementEnd(  void XmlWriter::_appendSimpleRspElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</SIMPLERSP>\n";     out << "</SIMPLERSP>\n";
Line 465 
Line 2015 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendMethodResponseElementBegin()  // _appendMethodResponseElementBegin()
 // appendMethodResponseElementEnd()  // _appendMethodResponseElementEnd()
 // //
 //     <!ELEMENT METHODRESPONSE (ERROR|IRETURNVALUE?)> //     <!ELEMENT METHODRESPONSE (ERROR|IRETURNVALUE?)>
 //     <!ATTLIST METHODRESPONSE %CIMName;> //     <!ATTLIST METHODRESPONSE %CIMName;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendMethodResponseElementBegin(  void XmlWriter::_appendMethodResponseElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)      const CIMName& name)
 { {
     out << "<METHODRESPONSE NAME=\"" << name << "\">\n";     out << "<METHODRESPONSE NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendMethodResponseElementEnd(  void XmlWriter::_appendMethodResponseElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</METHODRESPONSE>\n";     out << "</METHODRESPONSE>\n";
Line 488 
Line 2038 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendIMethodResponseElementBegin()  // _appendIMethodResponseElementBegin()
 // appendIMethodResponseElementEnd()  // _appendIMethodResponseElementEnd()
 // //
 //     <!ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)> //     <!ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)>
 //     <!ATTLIST IMETHODRESPONSE %CIMName;> //     <!ATTLIST IMETHODRESPONSE %CIMName;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendIMethodResponseElementBegin(  void XmlWriter::_appendIMethodResponseElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)      const CIMName& name)
 { {
     out << "<IMETHODRESPONSE NAME=\"" << name << "\">\n";     out << "<IMETHODRESPONSE NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendIMethodResponseElementEnd(  void XmlWriter::_appendIMethodResponseElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</IMETHODRESPONSE>\n";     out << "</IMETHODRESPONSE>\n";
Line 511 
Line 2061 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendErrorElement()  // _appendErrorElement()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendErrorElement(  void XmlWriter::_appendErrorElement(
     Array<Sint8>& out,     Array<Sint8>& out,
     CIMStatusCode code,      const CIMException& cimException)
     const char* description)  
 { {
       Tracer::traceCIMException(TRC_XML_WRITER, Tracer::LEVEL2, cimException);
   
     out << "<ERROR";     out << "<ERROR";
     out << " CODE=\"" << Uint32(code) << "\"";      out << " CODE=\"" << Uint32(cimException.getCode()) << "\"";
       String description = TraceableCIMException(cimException).getDescription();
       if (description != String::EMPTY)
       {
     out << " DESCRIPTION=\"";     out << " DESCRIPTION=\"";
     appendSpecial(out, description);     appendSpecial(out, description);
     out << "\"/>";          out << "\"";
       }
       out << "/>";
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 544 
Line 2100 
     out << "<RETURNVALUE";     out << "<RETURNVALUE";
  
     CIMType type = value.getType();     CIMType type = value.getType();
     if (type != CIMType::NONE)      out << " PARAMTYPE=\"" << cimTypeToString (type) << "\"";
     {  
         out << " PARAMTYPE=\"" << TypeToString(type) << "\"";  
     }  
  
     out << ">\n";     out << ">\n";
     value.toXml(out);  
       // Add value.
       appendValueElement(out, value);
     out << "</RETURNVALUE>\n";     out << "</RETURNVALUE>\n";
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendIReturnValueElementBegin()  // _appendIReturnValueElementBegin()
 // appendIReturnValueElementEnd()  // _appendIReturnValueElementEnd()
 // //
 //      <!ELEMENT IRETURNVALUE (CLASSNAME*|INSTANCENAME*|VALUE*| //      <!ELEMENT IRETURNVALUE (CLASSNAME*|INSTANCENAME*|VALUE*|
 //          VALUE.OBJECTWITHPATH*|VALUE.OBJECTWITHLOCALPATH*|VALUE.OBJECT*| //          VALUE.OBJECTWITHPATH*|VALUE.OBJECTWITHLOCALPATH*|VALUE.OBJECT*|
Line 566 
Line 2121 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendIReturnValueElementBegin(  void XmlWriter::_appendIReturnValueElementBegin(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "<IRETURNVALUE>\n";     out << "<IRETURNVALUE>\n";
 } }
  
 void XmlWriter::appendIReturnValueElementEnd(  void XmlWriter::_appendIReturnValueElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</IRETURNVALUE>\n";     out << "</IRETURNVALUE>\n";
Line 589 
Line 2144 
     const char* name,     const char* name,
     Boolean flag)     Boolean flag)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     out << "<VALUE>" << (flag ? "TRUE" : "FALSE") << "</VALUE>\n";      out << "<VALUE>";
     appendIParamValueElementEnd(out);      append(out, flag);
       out << "</VALUE>\n";
       _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 605 
Line 2162 
     const char* name,     const char* name,
     const String& str)     const String& str)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     out << "<VALUE>";     out << "<VALUE>";
     appendSpecial(out, str);     appendSpecial(out, str);
     out << "</VALUE>\n";     out << "</VALUE>\n";
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 631 
Line 2188 
     // as an IPARAMVALUE element according to the spec (look above). So we     // as an IPARAMVALUE element according to the spec (look above). So we
     // just pass it as a class name. An answer must be obtained later.     // just pass it as a class name. An answer must be obtained later.
  
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     appendClassNameElement(out, qualifierName);     appendClassNameElement(out, qualifierName);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 645 
Line 2202 
 void XmlWriter::appendClassNameIParameter( void XmlWriter::appendClassNameIParameter(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name,     const char* name,
     const String& className)      const CIMName& className)
   {
       _appendIParamValueElementBegin(out, name);
   
       //
       //  A NULL (unassigned) value for a parameter is specified by an
       //  <IPARAMVALUE> element with no subelement
       //
       if (!className.isNull ())
 { {
     appendIParamValueElementBegin(out, name);  
     appendClassNameElement(out, className);     appendClassNameElement(out, className);
     appendIParamValueElementEnd(out);      }
   
       _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 661 
Line 2227 
 void XmlWriter::appendInstanceNameIParameter( void XmlWriter::appendInstanceNameIParameter(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name,     const char* name,
     const CIMReference& instanceName)      const CIMObjectPath& instanceName)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     instanceName.instanceNameToXml(out);      appendInstanceNameElement(out, instanceName);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 void XmlWriter::appendObjectNameIParameter( void XmlWriter::appendObjectNameIParameter(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name,     const char* name,
     const CIMReference& objectName)      const CIMObjectPath& objectName)
 { {
     if (objectName.isClassName())      //
       //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
       //  distinguish instanceNames from classNames in every case
       //  The instanceName of a singleton instance of a keyless class also
       //  has no key bindings
       //
       if (objectName.getKeyBindings ().size () == 0)
     {     {
         XmlWriter::appendClassNameIParameter(         XmlWriter::appendClassNameIParameter(
             out, name, objectName.getClassName());             out, name, objectName.getClassName());
Line 696 
Line 2268 
     const char* name,     const char* name,
     const CIMConstClass& cimClass)     const CIMConstClass& cimClass)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     cimClass.toXml(out);      appendClassElement(out, cimClass);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 712 
Line 2284 
     const char* name,     const char* name,
     const CIMConstInstance& instance)     const CIMConstInstance& instance)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     instance.toXml(out);      appendInstanceElement(out, instance);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 726 
Line 2298 
 void XmlWriter::appendNamedInstanceIParameter( void XmlWriter::appendNamedInstanceIParameter(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name,     const char* name,
     const CIMNamedInstance& namedInstance)      const CIMInstance& namedInstance)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     namedInstance.toXml(out);      appendValueNamedInstanceElement(out, namedInstance);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //---------------------------------------------------------- //----------------------------------------------------------
Line 744 
Line 2316 
 //========================================================== //==========================================================
 void XmlWriter::appendPropertyNameIParameter( void XmlWriter::appendPropertyNameIParameter(
     Array<Sint8>& out,     Array<Sint8>& out,
     const String& propertyName)      const CIMName& propertyName)
 { {
     appendIParamValueElementBegin(out, "PropertyName");      _appendIParamValueElementBegin(out, "PropertyName");
     out << "<VALUE>" << propertyName << "</VALUE>\n";     out << "<VALUE>" << propertyName << "</VALUE>\n";
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 762 
Line 2334 
     const char* name,     const char* name,
     const CIMValue& value)     const CIMValue& value)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     value.toXml(out);      appendValueElement(out, value);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 777 
Line 2349 
     Array<Sint8>& out,     Array<Sint8>& out,
     const CIMPropertyList& propertyList)     const CIMPropertyList& propertyList)
 { {
     appendIParamValueElementBegin(out, "PropertyList");      _appendIParamValueElementBegin(out, "PropertyList");
  
       //
       //  A NULL (unassigned) value for a parameter is specified by an
       //  <IPARAMVALUE> element with no subelement
       //
       if (!propertyList.isNull ())
       {
     out << "<VALUE.ARRAY>\n";     out << "<VALUE.ARRAY>\n";
     for (Uint32 i = 0; i < propertyList.getNumProperties(); i++)          for (Uint32 i = 0; i < propertyList.size(); i++)
     {     {
         out << "<VALUE>" << propertyList.getPropertyName(i) << "</VALUE>\n";              out << "<VALUE>" << propertyList[i] << "</VALUE>\n";
     }     }
     out << "</VALUE.ARRAY>\n";     out << "</VALUE.ARRAY>\n";
       }
  
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 800 
Line 2379 
     const char* name,     const char* name,
     const CIMConstQualifierDecl& qualifierDecl)     const CIMConstQualifierDecl& qualifierDecl)
 { {
     appendIParamValueElementBegin(out, name);      _appendIParamValueElementBegin(out, name);
     qualifierDecl.toXml(out);      appendQualifierDeclElement(out, qualifierDecl);
     appendIParamValueElementEnd(out);      _appendIParamValueElementEnd(out);
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendClassNameElement()  // XmlWriter::formatHttpErrorRspMessage()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendClassNameElement(  Array<Sint8> XmlWriter::formatHttpErrorRspMessage(
     Array<Sint8>& out,      const String& status,
     const String& className)      const String& cimError,
       const String& errorDetail)
 { {
     out << "<CLASSNAME NAME=\"" << className << "\"/>\n";      Array<Sint8> out;
 }  
  
 //------------------------------------------------------------------------------      appendHttpErrorResponseHeader(out, status, cimError, errorDetail);
 //  
 // appendInstanceNameElement()  
 //  
 //------------------------------------------------------------------------------  
  
 void XmlWriter::appendInstanceNameElement(      return out;
     Array<Sint8>& out,  
     const CIMReference& instanceName)  
 {  
     instanceName.instanceNameToXml(out);  
 } }
  
   // l10n - add content language support to the format methods below
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // XmlWriter::formatSimpleMethodReqMessage() // XmlWriter::formatSimpleMethodReqMessage()
Line 840 
Line 2413 
 // ATTN-RK-P1-20020228: Need to complete copy elimination optimization // ATTN-RK-P1-20020228: Need to complete copy elimination optimization
 Array<Sint8> XmlWriter::formatSimpleMethodReqMessage( Array<Sint8> XmlWriter::formatSimpleMethodReqMessage(
     const char* host,     const char* host,
     const String& nameSpace,      const CIMNamespaceName& nameSpace,
     const char* methodName,      const CIMObjectPath& path,
       const CIMName& methodName,
       const Array<CIMParamValue>& parameters,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const Array<Sint8>& body)      const AcceptLanguages& httpAcceptLanguages,
       const ContentLanguages& httpContentLanguages)
 { {
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
       CIMObjectPath localObjectPath = path;
     appendMessageElementBegin(out, messageId);      localObjectPath.setNameSpace(nameSpace.getString());
     appendSimpleReqElementBegin(out);      localObjectPath.setHost(String::EMPTY);
     appendMethodCallElementBegin(out, methodName);  
 //    appendLocalPathElement(out, nameSpace); // ATTN-RK-P1-20020228:  Need this      _appendMessageElementBegin(out, messageId);
     out << body;      _appendSimpleReqElementBegin(out);
     appendMethodCallElementEnd(out);      _appendMethodCallElementBegin(out, methodName);
     appendSimpleReqElementEnd(out);      appendLocalObjectPathElement(out, localObjectPath);
     appendMessageElementEnd(out);      for (Uint32 i=0; i < parameters.size(); i++)
       {
           appendParamValueElement(out, parameters[i]);
       }
       _appendMethodCallElementEnd(out);
       _appendSimpleReqElementEnd(out);
       _appendMessageElementEnd(out);
  
     appendMethodCallHeader(     appendMethodCallHeader(
         tmp,         tmp,
         host,         host,
         methodName,         methodName,
         nameSpace,  // ATTN-RK: Is this right?          localObjectPath.toString(),
         authenticationHeader,         authenticationHeader,
           httpMethod,
           httpAcceptLanguages,
           httpContentLanguages,
         out.size());         out.size());
     tmp << out;     tmp << out;
  
Line 871 
Line 2457 
 } }
  
 Array<Sint8> XmlWriter::formatSimpleMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleMethodRspMessage(
     const char* methodName,      const CIMName& methodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
       const ContentLanguages & httpContentLanguages,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleRspElementBegin(out);      _appendSimpleRspElementBegin(out);
     appendMethodResponseElementBegin(out, methodName);      _appendMethodResponseElementBegin(out, methodName);
     out << body;     out << body;
     appendMethodResponseElementEnd(out);      _appendMethodResponseElementEnd(out);
     appendSimpleRspElementEnd(out);      _appendSimpleRspElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
   
     appendMethodResponseHeader(tmp, out.size());      appendMethodResponseHeader(tmp,
           httpMethod,
           httpContentLanguages,
           out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 899 
Line 2490 
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Array<Sint8> XmlWriter::formatSimpleMethodErrorRspMessage( Array<Sint8> XmlWriter::formatSimpleMethodErrorRspMessage(
     const String& methodName,      const CIMName& methodName,
     const String& messageId,     const String& messageId,
     CIMStatusCode code,      HttpMethod httpMethod,
     const String& description)      const CIMException& cimException)
 { {
     ArrayDestroyer<char> tmp1(methodName.allocateCString());  
     ArrayDestroyer<char> tmp2(description.allocateCString());  
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleRspElementBegin(out);      _appendSimpleRspElementBegin(out);
     appendMethodResponseElementBegin(out, tmp1.getPointer());      _appendMethodResponseElementBegin(out, methodName);
     appendErrorElement(out, code, tmp2.getPointer());      _appendErrorElement(out, cimException);
     appendMethodResponseElementEnd(out);      _appendMethodResponseElementEnd(out);
     appendSimpleRspElementEnd(out);      _appendSimpleRspElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
   
     appendMethodResponseHeader(tmp, out.size());  // l10n
       appendMethodResponseHeader(tmp,
           httpMethod,
           cimException.getContentLanguages(),
           out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 931 
Line 2524 
  
 Array<Sint8> XmlWriter::formatSimpleIMethodReqMessage( Array<Sint8> XmlWriter::formatSimpleIMethodReqMessage(
     const char* host,     const char* host,
     const String& nameSpace,      const CIMNamespaceName& nameSpace,
     const char* iMethodName,      const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
       const AcceptLanguages& httpAcceptLanguages,
       const ContentLanguages& httpContentLanguages,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleReqElementBegin(out);      _appendSimpleReqElementBegin(out);
     appendIMethodCallElementBegin(out, iMethodName);      _appendIMethodCallElementBegin(out, iMethodName);
     appendLocalNameSpaceElement(out, nameSpace);      appendLocalNameSpacePathElement(out, nameSpace.getString());
     out << body;     out << body;
     appendIMethodCallElementEnd(out);      _appendIMethodCallElementEnd(out);
     appendSimpleReqElementEnd(out);      _appendSimpleReqElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
  
     appendMethodCallHeader(     appendMethodCallHeader(
         tmp,         tmp,
         host,         host,
         iMethodName,         iMethodName,
         nameSpace,          nameSpace.getString(),
         authenticationHeader,         authenticationHeader,
           httpMethod,
           httpAcceptLanguages,
           httpContentLanguages,
         out.size());         out.size());
     tmp << out;     tmp << out;
  
Line 968 
Line 2567 
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Array<Sint8> XmlWriter::formatSimpleIMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleIMethodRspMessage(
     const char* iMethodName,      const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
       const ContentLanguages & httpContentLanguages,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleRspElementBegin(out);      _appendSimpleRspElementBegin(out);
     appendIMethodResponseElementBegin(out, iMethodName);      _appendIMethodResponseElementBegin(out, iMethodName);
     appendIReturnValueElementBegin(out);      if (body.size() != 0)
       {
           _appendIReturnValueElementBegin(out);
     out << body;     out << body;
     appendIReturnValueElementEnd(out);          _appendIReturnValueElementEnd(out);
     appendIMethodResponseElementEnd(out);      }
     appendSimpleRspElementEnd(out);      _appendIMethodResponseElementEnd(out);
     appendMessageElementEnd(out);      _appendSimpleRspElementEnd(out);
       _appendMessageElementEnd(out);
     appendMethodResponseHeader(tmp, out.size());  
       appendMethodResponseHeader(tmp,
                    httpMethod,
                    httpContentLanguages,
            out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 998 
Line 2605 
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Array<Sint8> XmlWriter::formatSimpleIMethodErrorRspMessage( Array<Sint8> XmlWriter::formatSimpleIMethodErrorRspMessage(
     const String& iMethodName,      const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
     CIMStatusCode code,      HttpMethod httpMethod,
     const String& description)      const CIMException& cimException)
 { {
     ArrayDestroyer<char> tmp1(iMethodName.allocateCString());  
     ArrayDestroyer<char> tmp2(description.allocateCString());  
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleRspElementBegin(out);      _appendSimpleRspElementBegin(out);
     appendIMethodResponseElementBegin(out, tmp1.getPointer());      _appendIMethodResponseElementBegin(out, iMethodName);
     appendErrorElement(out, code, tmp2.getPointer());      _appendErrorElement(out, cimException);
     appendIMethodResponseElementEnd(out);      _appendIMethodResponseElementEnd(out);
     appendSimpleRspElementEnd(out);      _appendSimpleRspElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
   
     appendMethodResponseHeader(tmp, out.size());  // l10n
       appendMethodResponseHeader(tmp,
            httpMethod,
            cimException.getContentLanguages(),
            out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 1038 
Line 2647 
  
 void XmlWriter::appendEMethodRequestHeader( void XmlWriter::appendEMethodRequestHeader(
     Array<Sint8>& out,     Array<Sint8>& out,
       const char* requestUri,
     const char* host,     const char* host,
     const char* cimMethod,      const CIMName& cimMethod,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
       const AcceptLanguages& acceptLanguages,
       const ContentLanguages& contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
     out << "M-POST /cimom HTTP/1.1\r\n";      if (httpMethod == HTTP_METHOD_M_POST)
       {
           out << "M-POST " << requestUri << " HTTP/1.1\r\n";
       }
       else
       {
           out << "POST " << requestUri << " HTTP/1.1\r\n";
       }
     out << "HOST: " << host << "\r\n";     out << "HOST: " << host << "\r\n";
     out << "Content-CIMType: application/xml; charset=\"utf-8\"\r\n";      out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (acceptLanguages.size() > 0)
       {
           out << "Accept-Language: " << acceptLanguages << "\r\n";
       }
       if (contentLanguages.size() > 0)
       {
           out << "Content-Language: " << contentLanguages << "\r\n";
       }
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Man: http://www.hp.com; ns=";     out << "Man: http://www.hp.com; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMExport: MethodRequest\r\n";  // ATTN-RK-P2-20020228: Should this be "MethodCall"?          out << nn << "-CIMExport: MethodRequest\r\n";
     out << nn << "-CIMExportMethod: " << cimMethod << "\r\n";     out << nn << "-CIMExportMethod: " << cimMethod << "\r\n";
       }
       else
       {
           out << "CIMExport: MethodRequest\r\n";
           out << "CIMExportMethod: " << cimMethod << "\r\n";
       }
   
     if (authenticationHeader.size())     if (authenticationHeader.size())
     {     {
         out << authenticationHeader << "\r\n";         out << authenticationHeader << "\r\n";
Line 1070 
Line 2707 
  
 void XmlWriter::appendEMethodResponseHeader( void XmlWriter::appendEMethodResponseHeader(
     Array<Sint8>& out,     Array<Sint8>& out,
       HttpMethod httpMethod,
       const ContentLanguages& contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
     out << "HTTP/1.1 200 OK\r\n";      out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";
     out << "Content-CIMType: application/xml; charset=\"utf-8\"\r\n";      out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (contentLanguages.size() > 0)
       {
           out << "Content-Language: " << contentLanguages << "\r\n";
       }
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Ext:\r\n";     out << "Ext:\r\n";
     out << "Cache-Control: no-cache\r\n";     out << "Cache-Control: no-cache\r\n";
     out << "Man:  http://www.dmtf.org/cim/mapping/http/v1.0; ns=";     out << "Man:  http://www.dmtf.org/cim/mapping/http/v1.0; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMExport: MethodResponse\r\n\r\n";     out << nn << "-CIMExport: MethodResponse\r\n\r\n";
 } }
       else
       {
           out << "CIMExport: MethodResponse\r\n\r\n";
       }
   }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendSimpleExportReqElementBegin()  // _appendSimpleExportReqElementBegin()
 // appendSimpleExportReqElementEnd()  // _appendSimpleExportReqElementEnd()
 // //
 //     <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)> //     <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendSimpleExportReqElementBegin(  void XmlWriter::_appendSimpleExportReqElementBegin(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "<SIMPLEEXPREQ>\n";     out << "<SIMPLEEXPREQ>\n";
 } }
  
 void XmlWriter::appendSimpleExportReqElementEnd(  void XmlWriter::_appendSimpleExportReqElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</SIMPLEEXPREQ>\n";     out << "</SIMPLEEXPREQ>\n";
Line 1107 
Line 2757 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendEMethodCallElementBegin()  // _appendEMethodCallElementBegin()
 // appendEMethodCallElementEnd()  // _appendEMethodCallElementEnd()
 // //
 //     <!ELEMENT EXPMETHODCALL (IPARAMVALUE*)> //     <!ELEMENT EXPMETHODCALL (IPARAMVALUE*)>
 //     <!ATTLIST EXPMETHODCALL %CIMName;> //     <!ATTLIST EXPMETHODCALL %CIMName;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendEMethodCallElementBegin(  void XmlWriter::_appendEMethodCallElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)      const CIMName& name)
 { {
     out << "<EXPMETHODCALL NAME=\"" << name << "\">\n";     out << "<EXPMETHODCALL NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendEMethodCallElementEnd(  void XmlWriter::_appendEMethodCallElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</EXPMETHODCALL>\n";     out << "</EXPMETHODCALL>\n";
Line 1130 
Line 2780 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendSimpleExportRspElementBegin()  // _appendEParamValueElementBegin()
 // appendSimpleExportRspElementEnd()  // _appendEParamValueElementEnd()
   //
   //     <!ELEMENT EXPPARAMVALUE (INSTANCE)>
   //     <!ATTLIST EXPPARAMVALUE
   //         %CIMName;>
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::_appendEParamValueElementBegin(
       Array<Sint8>& out,
       const char* name)
   {
       out << "<EXPPARAMVALUE NAME=\"" << name << "\">\n";
   }
   
   void XmlWriter::_appendEParamValueElementEnd(
       Array<Sint8>& out)
   {
       out << "</EXPPARAMVALUE>\n";
   }
   
   //------------------------------------------------------------------------------
   //
   // appendInstanceEParameter()
   //
   //------------------------------------------------------------------------------
   
   void XmlWriter::appendInstanceEParameter(
       Array<Sint8>& out,
       const char* name,
       const CIMInstance& instance)
   {
       _appendEParamValueElementBegin(out, name);
       appendInstanceElement(out, instance);
       _appendEParamValueElementEnd(out);
   }
   
   //------------------------------------------------------------------------------
   //
   // _appendSimpleExportRspElementBegin()
   // _appendSimpleExportRspElementEnd()
 // //
 //     <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)> //     <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendSimpleExportRspElementBegin(  void XmlWriter::_appendSimpleExportRspElementBegin(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "<SIMPLEEXPRSP>\n";     out << "<SIMPLEEXPRSP>\n";
 } }
  
 void XmlWriter::appendSimpleExportRspElementEnd(  void XmlWriter::_appendSimpleExportRspElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</SIMPLEEXPRSP>\n";     out << "</SIMPLEEXPRSP>\n";
Line 1151 
Line 2841 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // formatEMethodResponseElement()  // _appendEMethodResponseElementBegin()
   // _appendEMethodResponseElementEnd()
 // //
 //     <!ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)> //     <!ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)>
 //     <!ATTLIST EXPMETHODRESPONSE %CIMName;> //     <!ATTLIST EXPMETHODRESPONSE %CIMName;>
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void XmlWriter::appendEMethodResponseElementBegin(  void XmlWriter::_appendEMethodResponseElementBegin(
     Array<Sint8>& out,     Array<Sint8>& out,
     const char* name)      const CIMName& name)
 { {
     out << "<EXPMETHODRESPONSE NAME=\"" << name << "\">\n";     out << "<EXPMETHODRESPONSE NAME=\"" << name << "\">\n";
 } }
  
 void XmlWriter::appendEMethodResponseElementEnd(  void XmlWriter::_appendEMethodResponseElementEnd(
     Array<Sint8>& out)     Array<Sint8>& out)
 { {
     out << "</EXPMETHODRESPONSE>\n";     out << "</EXPMETHODRESPONSE>\n";
Line 1178 
Line 2869 
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Array<Sint8> XmlWriter::formatSimpleEMethodReqMessage( Array<Sint8> XmlWriter::formatSimpleEMethodReqMessage(
       const char* requestUri,
     const char* host,     const char* host,
     const char* eMethodName,      const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
       const AcceptLanguages& httpAcceptLanguages,
       const ContentLanguages& httpContentLanguages,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleExportReqElementBegin(out);      _appendSimpleExportReqElementBegin(out);
     appendEMethodCallElementBegin(out, eMethodName);      _appendEMethodCallElementBegin(out, eMethodName);
     out << body;     out << body;
     appendEMethodCallElementEnd(out);      _appendEMethodCallElementEnd(out);
     appendSimpleExportReqElementEnd(out);      _appendSimpleExportReqElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
  
     appendEMethodRequestHeader(     appendEMethodRequestHeader(
         tmp,         tmp,
           requestUri,
         host,         host,
         eMethodName,         eMethodName,
           httpMethod,
         authenticationHeader,         authenticationHeader,
           httpAcceptLanguages,
           httpContentLanguages,
         out.size());         out.size());
     tmp << out;     tmp << out;
  
     return out;      return tmp;
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 1213 
Line 2912 
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Array<Sint8> XmlWriter::formatSimpleEMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleEMethodRspMessage(
     const char* eMethodName,      const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
       const ContentLanguages& httpContentLanguages,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleExportRspElementBegin(out);      _appendSimpleExportRspElementBegin(out);
     appendEMethodResponseElementBegin(out, eMethodName);      _appendEMethodResponseElementBegin(out, eMethodName);
     out << body;     out << body;
     appendEMethodResponseElementEnd(out);      _appendEMethodResponseElementEnd(out);
     appendSimpleExportRspElementEnd(out);      _appendSimpleExportRspElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
   
     appendEMethodResponseHeader(tmp, out.size());      appendEMethodResponseHeader(tmp,
           httpMethod,
           httpContentLanguages,
           out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 1241 
Line 2945 
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 Array<Sint8> XmlWriter::formatSimpleEMethodErrorRspMessage( Array<Sint8> XmlWriter::formatSimpleEMethodErrorRspMessage(
     const String& eMethodName,      const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
     CIMStatusCode code,      HttpMethod httpMethod,
     const String& description)      const CIMException& cimException)
 { {
     ArrayDestroyer<char> tmp1(eMethodName.allocateCString());  
     ArrayDestroyer<char> tmp2(description.allocateCString());  
     Array<Sint8> out;     Array<Sint8> out;
     Array<Sint8> tmp;     Array<Sint8> tmp;
  
     appendMessageElementBegin(out, messageId);      _appendMessageElementBegin(out, messageId);
     appendSimpleExportRspElementBegin(out);      _appendSimpleExportRspElementBegin(out);
     appendEMethodResponseElementBegin(out, tmp1.getPointer());      _appendEMethodResponseElementBegin(out, eMethodName);
     appendErrorElement(out, code, tmp2.getPointer());      _appendErrorElement(out, cimException);
     appendEMethodResponseElementEnd(out);      _appendEMethodResponseElementEnd(out);
     appendSimpleExportRspElementEnd(out);      _appendSimpleExportRspElementEnd(out);
     appendMessageElementEnd(out);      _appendMessageElementEnd(out);
   
     appendEMethodResponseHeader(tmp, out.size());  // l10n
       appendEMethodResponseHeader(tmp,
            httpMethod,
            cimException.getContentLanguages(),
                    out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 1429 
Line 3135 
     return buffer;     return buffer;
 } }
  
   //------------------------------------------------------------------------------
   //
   // XmlWriter::keyBindingTypeToString
   //
   //------------------------------------------------------------------------------
   const char* XmlWriter::keyBindingTypeToString (CIMKeyBinding::Type type)
   {
       switch (type)
       {
           case CIMKeyBinding::BOOLEAN:
               return "boolean";
   
           case CIMKeyBinding::STRING:
               return "string";
   
           case CIMKeyBinding::NUMERIC:
               return "numeric";
   
           case CIMKeyBinding::REFERENCE:
           default:
               PEGASUS_ASSERT(false);
       }
   
       return "unknown";
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.28  
changed lines
  Added in v.1.98

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2