(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.128 and 1.153.2.2

version 1.128, 2005/10/31 22:35:04 version 1.153.2.2, 2008/02/25 23:38:57
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 27 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)  
 //              Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)  
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)  
 //              Carol Ann Krug Graves, Hewlett-Packard Company  
 //                  (carolann_graves@hp.com)  
 //              Amit K Arora, IBM (amita@in.ibm.com) for PEP#101  
 //         Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1  
 //                               Willis White (whiwill@us.ibm.com) PEP 127 and 128  
 //         Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2  
 //              Dave Sudlik, IBM (dsudlik@us.ibm.com)  
 //              David Dillard, VERITAS Software Corp.  
 //                  (david.dillard@veritas.com)  
 //              Vijay Eli, vijayeli@in.ibm.com, fix for #2571  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
Line 73 
Line 59 
 #include "CommonUTF.h" #include "CommonUTF.h"
 #include "Buffer.h" #include "Buffer.h"
 #include "StrLit.h" #include "StrLit.h"
   #include "LanguageParser.h"
   #include "IDFactory.h"
   #include "StringConversion.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 // This is a shortcut macro for outputing content length. This  
 // pads the output number to the max characters representing a Uint32 number  
 // so that it can be overwritten easily with a transfer encoding line later  
 // on in HTTPConnection if required. This is strictly for performance since  
 // messages can be very large. This overwriting shortcut allows us to NOT have  
 // to repackage a large message later.  
   
 #define OUTPUT_CONTENTLENGTH                                               \  
 {                                                                          \  
     char contentLengthP[11];                                               \  
     sprintf(contentLengthP,"%.10u", contentLength);                        \  
     out << STRLIT("content-length: ") << contentLengthP << STRLIT("\r\n"); \  
 }  
   
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 // //
 // SpecialChar and table. // SpecialChar and table.
Line 102 
Line 77 
 struct SpecialChar struct SpecialChar
 { {
     const char* str;     const char* str;
     size_t size;      Uint32 size;
 }; };
  
 // Defines encodings of special characters. Just use a 7-bit ASCII character // Defines encodings of special characters. Just use a 7-bit ASCII character
Line 246 
Line 221 
 static const int _isSpecialChar7[] = static const int _isSpecialChar7[] =
 { {
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,
     0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,      0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
 }; };
  
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 Buffer& operator<<(Buffer& out, const char* x)  
 {  
     XmlWriter::append(out, x);  
     return out;  
 }  
   
 Buffer& operator<<(Buffer& out, char x)  
 {  
     XmlWriter::append(out, x);  
     return out;  
 }  
   
 Buffer& operator<<(Buffer& out, const Char16& x) Buffer& operator<<(Buffer& out, const Char16& x)
 { {
     XmlWriter::append(out, x);     XmlWriter::append(out, x);
Line 302 
Line 265 
 } }
  
  
 // l10n  Buffer& operator<<(Buffer& out, const AcceptLanguageList& al)
 Buffer& operator<<(Buffer& out, const AcceptLanguages& al)  
 { {
     XmlWriter::append(out, al.toString ());      XmlWriter::append(out, LanguageParser::buildAcceptLanguageHeader(al));
     return out;     return out;
 } }
  
 // l10n  Buffer& operator<<(Buffer& out, const ContentLanguageList& cl)
 Buffer& operator<<(Buffer& out, const ContentLanguages& cl)  
 { {
     XmlWriter::append(out, cl.toString ());      XmlWriter::append(out, LanguageParser::buildContentLanguageHeader(cl));
     return out;     return out;
 } }
  
Line 352 
Line 313 
     Uint8 *strtgt = (Uint8 *)str;     Uint8 *strtgt = (Uint8 *)str;
     Uint8 *endtgt = (Uint8 *)&str[5];     Uint8 *endtgt = (Uint8 *)&str[5];
  
     UTF16toUTF8(&strsrc,      UTF16toUTF8(
           &strsrc,
                 endsrc,                 endsrc,
                 &strtgt,                 &strtgt,
                 endtgt);                 endtgt);
Line 380 
Line 342 
 { {
     if ( ((c < 0x20) && (c >= 0)) || (c == 0x7f) )     if ( ((c < 0x20) && (c >= 0)) || (c == 0x7f) )
     {     {
         char charref[7];          char scratchBuffer[22];
         sprintf(charref, "&#%u;", static_cast<Uint8>(c));          Uint32 outputLength;
         os << charref;          const char * output = Uint8ToString(scratchBuffer,
                                               static_cast<Uint8>(c),
                                               outputLength);
           os << "&#" << output << ";";
     }     }
     else     else
     {     {
Line 427 
Line 392 
     Uint8 *strtgt = (Uint8 *)str;     Uint8 *strtgt = (Uint8 *)str;
     Uint8 *endtgt = (Uint8 *)&str[5];     Uint8 *endtgt = (Uint8 *)&str[5];
  
     UTF16toUTF8(&strsrc,      UTF16toUTF8(
           &strsrc,
                 endsrc,                 endsrc,
                 &strtgt,                 &strtgt,
                 endtgt);                 endtgt);
Line 442 
Line 408 
         _xmlWritter_appendSpecialChar(os, *str++);         _xmlWritter_appendSpecialChar(os, *str++);
 } }
  
   // On windows sprintf outputs 3 digit precision exponent prepending
   // zeros. Make it 2 digit precision if first digit is zero in the exponent.
   #ifdef PEGASUS_OS_TYPE_WINDOWS
   inline void _xmlWriter_normalizeRealValueString(char *str)
   {
       // skip initial sign value...
       if (*str == '-' || *str == '+')
       {
           ++str;
       }
       while (*str && *str != '+' && *str != '-')
       {
           ++str;
       }
       if (*str && * ++str == '0')
       {
           *str = *(str+1);
           *(str+1) = *(str+2);
           *(str+2) = 0;
       }
   }
   #endif
   
 void XmlWriter::append(Buffer& out, const Char16& x) void XmlWriter::append(Buffer& out, const Char16& x)
 { {
     _xmlWritter_appendChar(out, x);     _xmlWritter_appendChar(out, x);
Line 449 
Line 438 
  
 void XmlWriter::append(Buffer& out, Boolean x) void XmlWriter::append(Buffer& out, Boolean x)
 { {
     append(out, (x ? "TRUE" : "FALSE"));      if (x)
           out.append(STRLIT_ARGS("TRUE"));
       else
           out.append(STRLIT_ARGS("FALSE"));
 } }
  
 void XmlWriter::append(Buffer& out, Uint32 x) void XmlWriter::append(Buffer& out, Uint32 x)
 { {
     char buffer[32];      Uint32 outputLength=0;
     sprintf(buffer, "%u", x);      char buffer[22];
     append(out, buffer);      const char * output = Uint32ToString(buffer, x, outputLength);
       out.append(output, outputLength);
 } }
  
 void XmlWriter::append(Buffer& out, Sint32 x) void XmlWriter::append(Buffer& out, Sint32 x)
 { {
     char buffer[32];      Uint32 outputLength=0;
     sprintf(buffer, "%d", x);      char buffer[22];
     append(out, buffer);      const char * output = Sint32ToString(buffer, x, outputLength);
       out.append(output, outputLength);
 } }
  
 void XmlWriter::append(Buffer& out, Uint64 x) void XmlWriter::append(Buffer& out, Uint64 x)
 { {
     char buffer[32];  // Should need 21 chars max      Uint32 outputLength=0;
     sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", x);      char buffer[22];
     append(out, buffer);      const char * output = Uint64ToString(buffer, x, outputLength);
       out.append(output, outputLength);
 } }
  
 void XmlWriter::append(Buffer& out, Sint64 x) void XmlWriter::append(Buffer& out, Sint64 x)
 { {
     char buffer[32];  // Should need 21 chars max      Uint32 outputLength=0;
     sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", x);      char buffer[22];
     append(out, buffer);      const char * output = Sint64ToString(buffer, x, outputLength);
       out.append(output, outputLength);
 } }
  
 void XmlWriter::append(Buffer& out, Real32 x) void XmlWriter::append(Buffer& out, Real32 x)
Line 487 
Line 483 
     // given in the CIM/XML spec, and the precision required by the CIM 2.2 spec     // given in the CIM/XML spec, and the precision required by the CIM 2.2 spec
     // (4 byte IEEE floating point)     // (4 byte IEEE floating point)
     sprintf(buffer, "%.7e", x);     sprintf(buffer, "%.7e", x);
   #ifdef PEGASUS_OS_TYPE_WINDOWS
       _xmlWriter_normalizeRealValueString(buffer);
   #endif
     append(out, buffer);     append(out, buffer);
 } }
  
 void XmlWriter::append(Buffer& out, Real64 x) void XmlWriter::append(Buffer& out, Real64 x)
 { {
     char buffer[128];     char buffer[128];
     // %.16e gives '[-]m.dddddddddddddddde+/-xx', which seems compatible with the format      // %.16e gives '[-]m.dddddddddddddddde+/-xx', which seems compatible
     // given in the CIM/XML spec, and the precision required by the CIM 2.2 spec      // with the format given in the CIM/XML spec, and the precision required
     // (8 byte IEEE floating point)      // by the CIM 2.2 spec (8 byte IEEE floating point)
     sprintf(buffer, "%.16e", x);     sprintf(buffer, "%.16e", x);
   #ifdef PEGASUS_OS_TYPE_WINDOWS
       _xmlWriter_normalizeRealValueString(buffer);
   #endif
     append(out, buffer);     append(out, buffer);
 } }
  
Line 539 
Line 541 
             continue;             continue;
         }         }
  
         // Hanlde UTF8 case (if reached).          // Handle UTF8 case (if reached).
  
         if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||         if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||
            ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE)))            ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE)))
Line 584 
Line 586 
 void XmlWriter::appendSpecial(Buffer& out, const String& str) void XmlWriter::appendSpecial(Buffer& out, const String& str)
 { {
     const Uint16* p = (const Uint16*)str.getChar16Data();     const Uint16* p = (const Uint16*)str.getChar16Data();
     size_t n = str.size();      // prevCharIsSpace is true when the last character written to the Buffer
       // is a space character (not a character reference).
     // Handle leading ASCII 7 characers in these next two loops (use unrolling).      Boolean prevCharIsSpace = false;
   
     while (n >= 8)      // If the first character is a space, use a character reference to avoid
       // space compression.
       if (*p == ' ')
     {     {
         // The following condition is equivalent to this:          out.append(STRLIT_ARGS("&#32;"));
         //     (p[0] < 128 && p[1] < 128 && p[2] < 128 && p[3] < 128 &&          p++;
         //      p[4] < 128 && p[5] < 128 && p[6] < 128 && p[7] < 128)      }
  
         if (((p[0]|p[1]|p[2]|p[3]|p[4]|p[5]|p[6]|p[7]) & 0xFF80) == 0)      Uint16 c;
       while ((c = *p++) != 0)
         {         {
             // Note: "|" is faster than "||" and achieves the same effect          if (c < 128)
             // since p[i] is either 0 or 1.          {
               if (_isSpecialChar7[c])
             if (_isSpecialChar7[p[0]] | _isSpecialChar7[p[1]] |  
                 _isSpecialChar7[p[2]] | _isSpecialChar7[p[3]] |  
                 _isSpecialChar7[p[4]] | _isSpecialChar7[p[5]] |  
                 _isSpecialChar7[p[6]] | _isSpecialChar7[p[7]])  
             {             {
                 // Rare case.                  // Write the character reference for the special character
                 _appendSpecialChar7(out, p[0]);                  out.append(
                 _appendSpecialChar7(out, p[1]);                      _specialChars[int(c)].str, _specialChars[int(c)].size);
                 _appendSpecialChar7(out, p[2]);                  prevCharIsSpace = false;
                 _appendSpecialChar7(out, p[3]);              }
                 _appendSpecialChar7(out, p[4]);              else if (prevCharIsSpace && (c == ' '))
                 _appendSpecialChar7(out, p[5]);              {
                 _appendSpecialChar7(out, p[6]);                  // Write the character reference for the space character, to
                 _appendSpecialChar7(out, p[7]);                  // avoid compression
                   out.append(STRLIT_ARGS("&#32;"));
                   prevCharIsSpace = false;
             }             }
             else             else
             {             {
                 // Common case.                  out.append(c);
                 out.append(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);                  prevCharIsSpace = (c == ' ');
             }             }
             p += 8;  
             n -= 8;  
         }         }
         else         else
             break;  
     }  
   
     while (n >= 4)  
     {     {
         // The following condition is equivalent to this:              // Handle UTF8 case
         //     (p[0] < 128 && p[1] < 128 && p[2] < 128 && p[3] < 128)  
  
         if (((p[0]|p[1]|p[2]|p[3]) & 0xFF80) == 0)              if ((((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||
                    ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE))) &&
                   *p)
         {         {
             if (_isSpecialChar7[p[0]] | _isSpecialChar7[p[1]] |                  _xmlWritter_appendSurrogatePair(out, c, *p++);
                 _isSpecialChar7[p[2]] | _isSpecialChar7[p[3]])  
             {  
                 // Rare case:  
                 _appendSpecialChar7(out, p[0]);  
                 _appendSpecialChar7(out, p[1]);  
                 _appendSpecialChar7(out, p[2]);  
                 _appendSpecialChar7(out, p[3]);  
             }             }
             else             else
             {             {
                 // Common case:                  _xmlWritter_appendChar(out, c);
                 out.append(p[0], p[1], p[2], p[3]);  
             }             }
  
             p += 4;              prevCharIsSpace = false;
             n -= 4;  
         }  
         else  
             break;  
     }     }
   
     // Process remaining characters. A UTF8 character must have been  
     // encountered or this would have never been reached.  
   
     while (n--)  
     {  
         Uint16 c = *p++;  
   
         // Special processing for UTF8 case:  
   
         if (c < 128)  
         {  
             _appendSpecialChar7(out, c);  
             continue;  
         }         }
  
         // Hanlde UTF8 case (if reached).      // If the last character is a space, use a character reference to avoid
       // space compression.
         if(((c >= FIRST_HIGH_SURROGATE) && (c <= LAST_HIGH_SURROGATE)) ||      if (prevCharIsSpace)
            ((c >= FIRST_LOW_SURROGATE) && (c <= LAST_LOW_SURROGATE)))  
         {  
             Char16 highSurrogate = p[-1];  
             Char16 lowSurrogate = p[0];  
             p++;  
             n--;  
   
             _xmlWritter_appendSurrogatePair(  
                 out, Uint16(highSurrogate),Uint16(lowSurrogate));  
         }  
         else  
         {         {
             _xmlWritter_appendSpecialChar(out, c);          out.remove(out.size() - 1);
         }          out.append(STRLIT_ARGS("&#32;"));
     }     }
 } }
  
Line 707 
Line 668 
     0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,     0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,
 }; };
  
   // Perform the necessary URI encoding of characters in HTTP header values.
   // This is required by the HTTP/1.1 specification and the CIM/HTTP
   // Specification (section 3.3.2).
 static void _xmlWritter_encodeURIChar(String& outString, Sint8 char8) static void _xmlWritter_encodeURIChar(String& outString, Sint8 char8)
 { {
     Uint8 c = (Uint8)char8;     Uint8 c = (Uint8)char8;
Line 767 
Line 731 
             Char16 highSurrogate = uriString[i];             Char16 highSurrogate = uriString[i];
             Char16 lowSurrogate = uriString[++i];             Char16 lowSurrogate = uriString[++i];
  
             _xmlWritter_appendSurrogatePair(utf8, Uint16(highSurrogate),Uint16(lowSurrogate));              _xmlWritter_appendSurrogatePair(
                   utf8, Uint16(highSurrogate),Uint16(lowSurrogate));
         }         }
         else         else
         {         {
Line 800 
Line 765 
  
     char* nameSpaceCopy = strdup(nameSpace.getString().getCString());     char* nameSpaceCopy = strdup(nameSpace.getString().getCString());
  
 #if !defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)  #if !defined(PEGASUS_COMPILER_MSVC) && !defined(PEGASUS_OS_ZOS)
     char *last;     char *last;
     for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p;     for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p;
          p = strtok_r(NULL, "/", &last))          p = strtok_r(NULL, "/", &last))
Line 879 
Line 844 
             CIMObjectPath ref = keyBindings[i].getValue();             CIMObjectPath ref = keyBindings[i].getValue();
             appendValueReferenceElement(out, ref, true);             appendValueReferenceElement(out, ref, true);
         }         }
         else {          else
           {
             out << STRLIT("<KEYVALUE VALUETYPE=\"");             out << STRLIT("<KEYVALUE VALUETYPE=\"");
             out << keyBindingTypeToString(keyBindings[i].getType());             out << keyBindingTypeToString(keyBindings[i].getType());
             out << STRLIT("\">");             out << STRLIT("\">");
Line 1072 
Line 1038 
  
 inline void _xmlWritter_appendValue(Buffer& out, const CIMDateTime& x) inline void _xmlWritter_appendValue(Buffer& out, const CIMDateTime& x)
 { {
     out << x.toString();  //ATTN: append() method?      // It is not necessary to use XmlWriter::appendSpecial(), because
       // CIMDateTime values do not contain special characters.
       out << x.toString();
 } }
  
 inline void _xmlWritter_appendValue(Buffer& out, const CIMObjectPath& x) inline void _xmlWritter_appendValue(Buffer& out, const CIMObjectPath& x)
Line 1265 
Line 1233 
                 _xmlWritter_appendValueArray(out, a.getData(), a.size());                 _xmlWritter_appendValueArray(out, a.getData(), a.size());
                 break;                 break;
             }             }
   #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
               case CIMTYPE_INSTANCE:
               {
                   Array<CIMInstance> a;
                   value.get(a);
                   _xmlWritter_appendValueArray(out, a.getData(), a.size());
                   break;
               }
   #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 1402 
Line 1378 
                 _xmlWritter_appendValue(out, v);                 _xmlWritter_appendValue(out, v);
                 break;                 break;
             }             }
   #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
               case CIMTYPE_INSTANCE:
               {
                   CIMInstance v;
                   value.get(v);
                   _xmlWritter_appendValue(out, v);
                   break;
               }
   #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT
             default:             default:
                 PEGASUS_ASSERT(false);                 PEGASUS_ASSERT(false);
         }         }
Line 1417 
Line 1401 
 { {
     Buffer tmp;     Buffer tmp;
     appendValueElement(tmp, value);     appendValueElement(tmp, value);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1512 
Line 1495 
 { {
     Buffer tmp;     Buffer tmp;
     appendValueReferenceElement(tmp, reference, true);     appendValueReferenceElement(tmp, reference, true);
     tmp.append('\0');  
     indentedPrint(os, tmp.getData());     indentedPrint(os, tmp.getData());
 } }
  
Line 1552 
Line 1534 
     Buffer& out,     Buffer& out,
     const CIMConstClass& cimclass)     const CIMConstClass& cimclass)
 { {
     cimclass._checkRep();      CheckRep(cimclass._rep);
     cimclass._rep->toXml(out);     cimclass._rep->toXml(out);
 } }
  
Line 1562 
Line 1544 
 { {
     Buffer tmp;     Buffer tmp;
     appendClassElement(tmp, cimclass);     appendClassElement(tmp, cimclass);
     tmp.append('\0');  
     indentedPrint(os, tmp.getData(), 4);     indentedPrint(os, tmp.getData(), 4);
 } }
  
Line 1581 
Line 1562 
     Buffer& out,     Buffer& out,
     const CIMConstInstance& instance)     const CIMConstInstance& instance)
 { {
     instance._checkRep();      CheckRep(instance._rep);
     instance._rep->toXml(out);     instance._rep->toXml(out);
 } }
  
Line 1591 
Line 1572 
 { {
     Buffer tmp;     Buffer tmp;
     appendInstanceElement(tmp, instance);     appendInstanceElement(tmp, instance);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1652 
Line 1632 
     Buffer& out,     Buffer& out,
     const CIMConstProperty& property)     const CIMConstProperty& property)
 { {
     property._checkRep();      CheckRep(property._rep);
     property._rep->toXml(out);     property._rep->toXml(out);
 } }
  
Line 1662 
Line 1642 
 { {
     Buffer tmp;     Buffer tmp;
     appendPropertyElement(tmp, property);     appendPropertyElement(tmp, property);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1684 
Line 1663 
     Buffer& out,     Buffer& out,
     const CIMConstMethod& method)     const CIMConstMethod& method)
 { {
     method._checkRep();      CheckRep(method._rep);
     method._rep->toXml(out);     method._rep->toXml(out);
 } }
  
Line 1694 
Line 1673 
 { {
     Buffer tmp;     Buffer tmp;
     appendMethodElement(tmp, method);     appendMethodElement(tmp, method);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1730 
Line 1708 
     Buffer& out,     Buffer& out,
     const CIMConstParameter& parameter)     const CIMConstParameter& parameter)
 { {
     parameter._checkRep();      CheckRep(parameter._rep);
     parameter._rep->toXml(out);     parameter._rep->toXml(out);
 } }
  
Line 1740 
Line 1718 
 { {
     Buffer tmp;     Buffer tmp;
     appendParameterElement(tmp, parameter);     appendParameterElement(tmp, parameter);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1758 
Line 1735 
     Buffer& out,     Buffer& out,
     const CIMParamValue& paramValue)     const CIMParamValue& paramValue)
 { {
     paramValue._checkRep();      CheckRep(paramValue._rep);
     paramValue._rep->toXml(out);     paramValue._rep->toXml(out);
 } }
  
Line 1768 
Line 1745 
 { {
     Buffer tmp;     Buffer tmp;
     appendParamValueElement(tmp, paramValue);     appendParamValueElement(tmp, paramValue);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1789 
Line 1765 
     Buffer& out,     Buffer& out,
     const CIMConstQualifier& qualifier)     const CIMConstQualifier& qualifier)
 { {
     qualifier._checkRep();      CheckRep(qualifier._rep);
     qualifier._rep->toXml(out);     qualifier._rep->toXml(out);
 } }
  
Line 1799 
Line 1775 
 { {
     Buffer tmp;     Buffer tmp;
     appendQualifierElement(tmp, qualifier);     appendQualifierElement(tmp, qualifier);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1821 
Line 1796 
     Buffer& out,     Buffer& out,
     const CIMConstQualifierDecl& qualifierDecl)     const CIMConstQualifierDecl& qualifierDecl)
 { {
     qualifierDecl._checkRep();      CheckRep(qualifierDecl._rep);
     qualifierDecl._rep->toXml(out);     qualifierDecl._rep->toXml(out);
 } }
  
Line 1831 
Line 1806 
 { {
     Buffer tmp;     Buffer tmp;
     appendQualifierDeclElement(tmp, qualifierDecl);     appendQualifierDeclElement(tmp, qualifierDecl);
     tmp.append('\0');  
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 1930 
Line 1904 
     const String& cimObject,     const String& cimObject,
     const String& authenticationHeader,     const String& authenticationHeader,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const AcceptLanguages & acceptLanguages,      const AcceptLanguageList& acceptLanguages,
     const ContentLanguages & contentLanguages,      const ContentLanguageList& contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
Line 1959 
Line 1933 
     }     }
     if (contentLanguages.size() > 0)     if (contentLanguages.size() > 0)
     {     {
         out << STRLIT("Content-Language: ") << contentLanguages << STRLIT("\r\n");          out << STRLIT("Content-Language: ") << contentLanguages <<
               STRLIT("\r\n");
     }     }
  
 #ifdef PEGASUS_DEBUG #ifdef PEGASUS_DEBUG
Line 1970 
Line 1945 
  
                 static const char *clientTransferEncodingOff =                 static const char *clientTransferEncodingOff =
                         getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST");                         getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST");
   
                 if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0')                 if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0')
 #endif #endif
  
Line 1988 
Line 1964 
     else     else
     {     {
         out << STRLIT("CIMOperation: MethodCall\r\n");         out << STRLIT("CIMOperation: MethodCall\r\n");
         out << STRLIT("CIMMethod: ") << encodeURICharacters(cimMethod.getString())          out << STRLIT("CIMMethod: ")
               << encodeURICharacters(cimMethod.getString())
             << STRLIT("\r\n");             << STRLIT("\r\n");
         out << STRLIT("CIMObject: ") << encodeURICharacters(cimObject)         out << STRLIT("CIMObject: ") << encodeURICharacters(cimObject)
             << STRLIT("\r\n");             << STRLIT("\r\n");
Line 2006 
Line 1983 
 void XmlWriter::appendMethodResponseHeader( void XmlWriter::appendMethodResponseHeader(
      Buffer& out,      Buffer& out,
      HttpMethod httpMethod,      HttpMethod httpMethod,
      const ContentLanguages & contentLanguages,       const ContentLanguageList& contentLanguages,
      Uint32 contentLength,      Uint32 contentLength,
      Uint32 serverResponseTime)       Uint64 serverResponseTime)
 { {
      char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };      char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
      out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");      out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");
      STAT_SERVERTIME  
   #ifndef PEGASUS_DISABLE_PERFINST
        if (StatisticalData::current()->copyGSD)
        {
            out << STRLIT("WBEMServerResponseTime: ") <<
                CIMValue(serverResponseTime).toString() << STRLIT("\r\n");
        }
   #endif
   
      out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");      out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");
      OUTPUT_CONTENTLENGTH;      OUTPUT_CONTENTLENGTH;
  
      if (contentLanguages.size() > 0)      if (contentLanguages.size() > 0)
      {      {
          out << STRLIT("Content-Language: ") << contentLanguages << STRLIT("\r\n");           out << STRLIT("Content-Language: ") << contentLanguages <<
                STRLIT("\r\n");
      }      }
      if (httpMethod == HTTP_METHOD_M_POST)      if (httpMethod == HTTP_METHOD_M_POST)
      {      {
Line 2062 
Line 2048 
     }     }
     if (errorDetail != String::EMPTY)     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 << STRLIT(PEGASUS_HTTPHEADERTAG_ERRORDETAIL ": ")         out << STRLIT(PEGASUS_HTTPHEADERTAG_ERRORDETAIL ": ")
             << encodeURICharacters(errorDetail) << STRLIT("\r\n");             << encodeURICharacters(errorDetail) << STRLIT("\r\n");
     }     }
Line 2095 
Line 2078 
     const String& content)     const String& content)
 { {
     out << STRLIT("HTTP/1.1 " HTTP_STATUS_UNAUTHORIZED "\r\n");     out << STRLIT("HTTP/1.1 " HTTP_STATUS_UNAUTHORIZED "\r\n");
       Uint32 contentLength = 0;
       OUTPUT_CONTENTLENGTH;
     out << content << STRLIT("\r\n");     out << content << STRLIT("\r\n");
     out << STRLIT("\r\n");     out << STRLIT("\r\n");
  
Line 2357 
Line 2342 
     out << STRLIT("<ERROR");     out << STRLIT("<ERROR");
     out << STRLIT(" CODE=\"") << Uint32(cimException.getCode());     out << STRLIT(" CODE=\"") << Uint32(cimException.getCode());
     out.append('"');     out.append('"');
   
     String description = TraceableCIMException(cimException).getDescription();     String description = TraceableCIMException(cimException).getDescription();
   
     if (description != String::EMPTY)     if (description != String::EMPTY)
     {     {
         out << STRLIT(" DESCRIPTION=\"");         out << STRLIT(" DESCRIPTION=\"");
         appendSpecial(out, description);         appendSpecial(out, description);
         out.append('"');         out.append('"');
     }     }
   
       if (cimException.getErrorCount())
       {
           out << STRLIT(">");
   
           for (Uint32 i = 0, n = cimException.getErrorCount(); i < n; i++)
               appendInstanceElement(out, cimException.getError(i));
   
           out << STRLIT("</ERROR>");
       }
       else
     out << STRLIT("/>");     out << STRLIT("/>");
 } }
  
Line 2386 
Line 2384 
  
     CIMType type = value.getType();     CIMType type = value.getType();
     // If the property type is CIMObject, then     // If the property type is CIMObject, then
     //   encode the property in CIM-XML as a string with the EMBEDDEDOBJECT attribute      //   encode the property in CIM-XML as a string with the EMBEDDEDOBJECT
     //   (there is not currently a CIM-XML "object" datatype)      //   attribute (there is not currently a CIM-XML "object" datatype)
     // else     // else
     //   output the real type     //   output the real type
     if (type == CIMTYPE_OBJECT)     if (type == CIMTYPE_OBJECT)
Line 2395 
Line 2393 
         out << STRLIT(" PARAMTYPE=\"string\"");         out << STRLIT(" PARAMTYPE=\"string\"");
         out << STRLIT(" EMBEDDEDOBJECT=\"object\"");         out << STRLIT(" EMBEDDEDOBJECT=\"object\"");
     }     }
   #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
       else if (type == CIMTYPE_INSTANCE)
       {
           out << STRLIT(" PARAMTYPE=\"string\"");
           out << STRLIT(" EMBEDDEDOBJECT=\"instance\"");
       }
   #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT
     else     else
     {     {
         out << STRLIT(" PARAMTYPE=\"") << cimTypeToString (type);         out << STRLIT(" PARAMTYPE=\"") << cimTypeToString (type);
Line 2470 
Line 2475 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // appendQualifierNameIParameter()  
 //  
 //------------------------------------------------------------------------------  
   
 void XmlWriter::appendQualifierNameIParameter(  
     Buffer& out,  
     const char* name,  
     const String& qualifierName)  
 {  
     // <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE  
     //     |INSTANCENAME|CLASSNAME|QUALIFIER.DECLARATION  
     //     |CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?>  
     //  
     // ATTN: notice that there is really no way to pass a qualifier name  
     // 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.  
   
     _appendIParamValueElementBegin(out, name);  
     appendClassNameElement(out, qualifierName);  
     _appendIParamValueElementEnd(out);  
 }  
   
 //------------------------------------------------------------------------------  
 //  
 // appendClassNameIParameter() // appendClassNameIParameter()
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 2719 
Line 2700 
     const String& messageId,     const String& messageId,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const AcceptLanguages& httpAcceptLanguages,      const AcceptLanguageList& httpAcceptLanguages,
     const ContentLanguages& httpContentLanguages)      const ContentLanguageList& httpContentLanguages)
 { {
     Buffer out;     Buffer out;
     Buffer tmp;     Buffer tmp;
Line 2760 
Line 2741 
     const CIMName& methodName,     const CIMName& methodName,
     const String& messageId,     const String& messageId,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const ContentLanguages & httpContentLanguages,      const ContentLanguageList& httpContentLanguages,
     const Buffer& body,     const Buffer& body,
                 Uint32 serverResponseTime,      Uint64 serverResponseTime,
                 Boolean isFirst,                 Boolean isFirst,
                 Boolean isLast)                 Boolean isLast)
 { {
Line 2772 
Line 2753 
         {         {
                 // NOTE: temporarily put zero for content length. the http code                 // NOTE: temporarily put zero for content length. the http code
                 // will later decide to fill in the length or remove it altogether                 // will later decide to fill in the length or remove it altogether
                 appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0,          appendMethodResponseHeader(
                                                                                                                          serverResponseTime);              out, httpMethod, httpContentLanguages, 0, serverResponseTime);
                 _appendMessageElementBegin(out, messageId);                 _appendMessageElementBegin(out, messageId);
                 _appendSimpleRspElementBegin(out);                 _appendSimpleRspElementBegin(out);
                 _appendMethodResponseElementBegin(out, methodName);                 _appendMethodResponseElementBegin(out, methodName);
Line 2795 
Line 2776 
 } }
  
  
   
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // XmlWriter::formatSimpleMethodErrorRspMessage() // XmlWriter::formatSimpleMethodErrorRspMessage()
Line 2819 
Line 2799 
     _appendSimpleRspElementEnd(out);     _appendSimpleRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
 // l10n      appendMethodResponseHeader(
     appendMethodResponseHeader(tmp,          tmp,
         httpMethod,         httpMethod,
         cimException.getContentLanguages(),         cimException.getContentLanguages(),
         out.size());         out.size());
Line 2842 
Line 2822 
     const String& messageId,     const String& messageId,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const AcceptLanguages& httpAcceptLanguages,      const AcceptLanguageList& httpAcceptLanguages,
     const ContentLanguages& httpContentLanguages,      const ContentLanguageList& httpContentLanguages,
     const Buffer& body)     const Buffer& body)
 { {
     Buffer out;     Buffer out;
Line 2883 
Line 2863 
     const CIMName& iMethodName,     const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const ContentLanguages & httpContentLanguages,      const ContentLanguageList& httpContentLanguages,
     const Buffer& body,     const Buffer& body,
     Uint32 serverResponseTime,      Uint64 serverResponseTime,
     Boolean isFirst,     Boolean isFirst,
     Boolean isLast)     Boolean isLast)
 { {
Line 2895 
Line 2875 
                 {                 {
                         // NOTE: temporarily put zero for content length. the http code                         // NOTE: temporarily put zero for content length. the http code
                         // will later decide to fill in the length or remove it altogether                         // will later decide to fill in the length or remove it altogether
                         appendMethodResponseHeader(out, httpMethod, httpContentLanguages, 0,          appendMethodResponseHeader(
                                                                                                                                  serverResponseTime);              out, httpMethod, httpContentLanguages, 0, serverResponseTime);
                         _appendMessageElementBegin(out, messageId);                         _appendMessageElementBegin(out, messageId);
                         _appendSimpleRspElementBegin(out);                         _appendSimpleRspElementBegin(out);
                         _appendIMethodResponseElementBegin(out, iMethodName);                         _appendIMethodResponseElementBegin(out, iMethodName);
  
                         // output the start of the return tag. Test if there is response data by:          // output the start of the return tag. Test if there is response data
           // by:
                         // 1. there is data on the first chunk OR                         // 1. there is data on the first chunk OR
                         // 2. there is no data on the first chunk but isLast is false implying                         // 2. there is no data on the first chunk but isLast is false implying
                         //    there is more non-empty data to come. If all subsequent chunks                         //    there is more non-empty data to come. If all subsequent chunks
Line 2951 
Line 2932 
     _appendSimpleRspElementEnd(out);     _appendSimpleRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
 // l10n  
     appendMethodResponseHeader(tmp,     appendMethodResponseHeader(tmp,
          httpMethod,          httpMethod,
          cimException.getContentLanguages(),          cimException.getContentLanguages(),
Line 2982 
Line 2962 
     const CIMName& cimMethod,     const CIMName& cimMethod,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const AcceptLanguages& acceptLanguages,      const AcceptLanguageList& acceptLanguages,
     const ContentLanguages& contentLanguages,      const ContentLanguageList& contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
Line 3006 
Line 2986 
     }     }
     if (contentLanguages.size() > 0)     if (contentLanguages.size() > 0)
     {     {
         out << STRLIT("Content-Language: ") << contentLanguages << STRLIT("\r\n");          out << STRLIT("Content-Language: ") << contentLanguages <<
               STRLIT("\r\n");
     }     }
  
 #ifdef PEGASUS_DEBUG #ifdef PEGASUS_DEBUG
Line 3026 
Line 3007 
         out << STRLIT("Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");         out << STRLIT("Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");
         out << nn << STRLIT("\r\n");         out << nn << STRLIT("\r\n");
         out << nn << STRLIT("-CIMExport: MethodRequest\r\n");         out << nn << STRLIT("-CIMExport: MethodRequest\r\n");
         out << nn << STRLIT("-CIMExportMethod: ") << cimMethod << STRLIT("\r\n");          out << nn << STRLIT("-CIMExportMethod: ") << cimMethod <<
               STRLIT("\r\n");
     }     }
     else     else
     {     {
Line 3053 
Line 3035 
 void XmlWriter::appendEMethodResponseHeader( void XmlWriter::appendEMethodResponseHeader(
     Buffer& out,     Buffer& out,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const ContentLanguages& contentLanguages,      const ContentLanguageList& contentLanguages,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
Line 3064 
Line 3046 
  
     if (contentLanguages.size() > 0)     if (contentLanguages.size() > 0)
     {     {
         out << STRLIT("Content-Language: ") << contentLanguages << STRLIT("\r\n");          out << STRLIT("Content-Language: ") << contentLanguages <<
               STRLIT("\r\n");
     }     }
     if (httpMethod == HTTP_METHOD_M_POST)     if (httpMethod == HTTP_METHOD_M_POST)
     {     {
Line 3221 
Line 3204 
     const String& messageId,     const String& messageId,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const AcceptLanguages& httpAcceptLanguages,      const AcceptLanguageList& httpAcceptLanguages,
     const ContentLanguages& httpContentLanguages,      const ContentLanguageList& httpContentLanguages,
     const Buffer& body)     const Buffer& body)
 { {
     Buffer out;     Buffer out;
Line 3261 
Line 3244 
     const CIMName& eMethodName,     const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const ContentLanguages& httpContentLanguages,      const ContentLanguageList& httpContentLanguages,
     const Buffer& body)     const Buffer& body)
 { {
     Buffer out;     Buffer out;
Line 3307 
Line 3290 
     _appendSimpleExportRspElementEnd(out);     _appendSimpleExportRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
 // l10n      appendEMethodResponseHeader(
     appendEMethodResponseHeader(tmp,          tmp,
          httpMethod,          httpMethod,
          cimException.getContentLanguages(),          cimException.getContentLanguages(),
                  out.size());                  out.size());
Line 3325 
Line 3308 
  
 void _xmlWritter_printAttributes( void _xmlWritter_printAttributes(
     PEGASUS_STD(ostream)& os,     PEGASUS_STD(ostream)& os,
     const XmlAttribute* attributes,      const Array<XmlAttribute>& attributes,
     Uint32 attributeCount)     Uint32 attributeCount)
 { {
     for (Uint32 i = 0; i < attributeCount; i++)     for (Uint32 i = 0; i < attributeCount; i++)
Line 3347 
Line 3330 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
 void _xmlWritter_indent(PEGASUS_STD(ostream)& os, Uint32 level, Uint32 indentChars)  void _xmlWritter_indent(
       PEGASUS_STD(ostream)& os,
       Uint32 level,
       Uint32 indentChars)
 { {
     Uint32 n = level * indentChars;     Uint32 n = level * indentChars;
  
Line 3381 
Line 3367 
                 _xmlWritter_indent(os, stack.size(), indentChars);                 _xmlWritter_indent(os, stack.size(), indentChars);
  
                 os << "<?" << entry.text << " ";                 os << "<?" << entry.text << " ";
                 _xmlWritter_printAttributes(os, entry.attributes, entry.attributeCount);                  _xmlWritter_printAttributes(
                       os, entry.attributes, entry.attributes.size());
                 os << "?>";                 os << "?>";
                 break;                 break;
             }             }
Line 3392 
Line 3379 
  
                 os << "<" << entry.text;                 os << "<" << entry.text;
  
                 if (entry.attributeCount)                  if (entry.attributes.size())
                     os << ' ';                     os << ' ';
  
                 _xmlWritter_printAttributes(os, entry.attributes, entry.attributeCount);                  _xmlWritter_printAttributes(
                       os, entry.attributes, entry.attributes.size());
                 os << ">";                 os << ">";
                 stack.push(entry.text);                 stack.push(entry.text);
                 break;                 break;
Line 3406 
Line 3394 
                 _xmlWritter_indent(os, stack.size(), indentChars);                 _xmlWritter_indent(os, stack.size(), indentChars);
  
                 os << "<" << entry.text << " ";                 os << "<" << entry.text << " ";
                 _xmlWritter_printAttributes(os, entry.attributes, entry.attributeCount);                  _xmlWritter_printAttributes(
                       os, entry.attributes, entry.attributes.size());
                 os << "/>";                 os << "/>";
                 break;                 break;
             }             }
Line 3424 
Line 3413 
  
             case XmlEntry::COMMENT:             case XmlEntry::COMMENT:
             {             {
   
                 _xmlWritter_indent(os, stack.size(), indentChars);                 _xmlWritter_indent(os, stack.size(), indentChars);
                 os << "<!--";                 os << "<!--";
                 _xmlWritter_appendSpecial(os, entry.text);                 _xmlWritter_appendSpecial(os, entry.text);
Line 3442 
Line 3430 
             case XmlEntry::CDATA:             case XmlEntry::CDATA:
             {             {
                 _xmlWritter_indent(os, stack.size(), indentChars);                 _xmlWritter_indent(os, stack.size(), indentChars);
                 os << "<![CDATA[...]]>";                  os << "<![CDATA[" << entry.text << "]]>";
                 break;                 break;
             }             }
  
Line 3456 
Line 3444 
  
         os << PEGASUS_STD(endl);         os << PEGASUS_STD(endl);
     }     }
   
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 3465 
Line 3452 
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
   static IDFactory _messageIDFactory(1000);
   
 String XmlWriter::getNextMessageId() String XmlWriter::getNextMessageId()
 { {
     // ATTN: make thread-safe:      char scratchBuffer[22];
     static Uint32 messageId = 1000;      Uint32 n;
       const char * startP = Uint32ToString(scratchBuffer,
     messageId++;                                           _messageIDFactory.getID(),
                                            n);
     if (messageId < 1000)      return String(startP, n);
         messageId = 1001;  
   
     char buffer[16];  
     sprintf(buffer, "%d", messageId);  
     return buffer;  
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------


Legend:
Removed from v.1.128  
changed lines
  Added in v.1.153.2.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2