version 1.95, 2003/08/26 20:46:28
|
version 1.99, 2003/10/17 21:00:01
|
|
|
return os; | return os; |
} | } |
| |
inline void _appendChar(Array<Sint8>& out, const Char16& c) |
inline void _xmlWritter_appendChar(Array<Sint8>& out, const Char16& c) |
{ | { |
// We need to convert the Char16 to UTF8 then append the UTF8 | // We need to convert the Char16 to UTF8 then append the UTF8 |
// character into the array. | // character into the array. |
|
|
out.append((Sint8 *)str,trailingBytesForUTF8[Uint32(str[0])]+1); | out.append((Sint8 *)str,trailingBytesForUTF8[Uint32(str[0])]+1); |
} | } |
| |
inline void _appendSpecialChar(Array<Sint8>& out, const Char16& c) |
inline void _xmlWritter_appendSpecialChar(Array<Sint8>& out, const Char16& c) |
{ | { |
if ( ((c < Char16(0x20)) && (c >= Char16(0x00))) || (c == Char16(0x7f)) ) | if ( ((c < Char16(0x20)) && (c >= Char16(0x00))) || (c == Char16(0x7f)) ) |
{ | { |
|
|
} | } |
} | } |
| |
inline void _appendSpecialChar(Array<Sint8>& out, char c) |
inline void _xmlWritter_appendSpecialChar(Array<Sint8>& out, char c) |
{ | { |
if ( ((c < Char16(0x20)) && (c >= Char16(0x00))) || (c == Char16(0x7f)) ) | if ( ((c < Char16(0x20)) && (c >= Char16(0x00))) || (c == Char16(0x7f)) ) |
{ | { |
|
|
} | } |
| |
| |
static inline void _appendSpecialChar(PEGASUS_STD(ostream)& os, char c) |
inline void _xmlWritter_appendSpecialChar(PEGASUS_STD(ostream)& os, char c) |
{ | { |
if ( (c < Char16(0x20)) || (c == Char16(0x7f)) ) | if ( (c < Char16(0x20)) || (c == Char16(0x7f)) ) |
{ | { |
|
|
} | } |
} | } |
| |
void _appendSurrogatePair(Array<Sint8>& out, Uint16 high, Uint16 low) |
void _xmlWritter_appendSurrogatePair(Array<Sint8>& out, Uint16 high, Uint16 low) |
{ | { |
Uint8 str[6]; | Uint8 str[6]; |
Uint8 charIN[5]; | Uint8 charIN[5]; |
|
|
out.append((Sint8 *)str,number1); | out.append((Sint8 *)str,number1); |
} | } |
| |
static inline void _appendSpecial(PEGASUS_STD(ostream)& os, const char* str) |
inline void _xmlWritter_appendSpecial(PEGASUS_STD(ostream)& os, const char* str) |
{ | { |
while (*str) | while (*str) |
_appendSpecialChar(os, *str++); |
_xmlWritter_appendSpecialChar(os, *str++); |
} | } |
| |
void XmlWriter::append(Array<Sint8>& out, const Char16& x) | void XmlWriter::append(Array<Sint8>& out, const Char16& x) |
{ | { |
_appendChar(out, x); |
_xmlWritter_appendChar(out, x); |
} | } |
| |
void XmlWriter::append(Array<Sint8>& out, Boolean x) | void XmlWriter::append(Array<Sint8>& out, Boolean x) |
|
|
void XmlWriter::append(Array<Sint8>& out, const char* str) | void XmlWriter::append(Array<Sint8>& out, const char* str) |
{ | { |
while (*str) | while (*str) |
_appendChar(out, *str++); |
_xmlWritter_appendChar(out, *str++); |
} | } |
| |
void XmlWriter::append(Array<Sint8>& out, const String& str) | void XmlWriter::append(Array<Sint8>& out, const String& str) |
|
|
Char16 highSurrogate = str[i]; | Char16 highSurrogate = str[i]; |
Char16 lowSurrogate = str[++i]; | Char16 lowSurrogate = str[++i]; |
| |
_appendSurrogatePair(out, Uint16(highSurrogate),Uint16(lowSurrogate)); |
_xmlWritter_appendSurrogatePair(out, Uint16(highSurrogate),Uint16(lowSurrogate)); |
} | } |
else | else |
{ | { |
_appendChar(out, str[i]); |
_xmlWritter_appendChar(out, str[i]); |
} | } |
} | } |
} | } |
|
|
| |
void XmlWriter::appendSpecial(Array<Sint8>& out, const Char16& x) | void XmlWriter::appendSpecial(Array<Sint8>& out, const Char16& x) |
{ | { |
_appendSpecialChar(out, x); |
_xmlWritter_appendSpecialChar(out, x); |
} | } |
| |
void XmlWriter::appendSpecial(Array<Sint8>& out, char x) | void XmlWriter::appendSpecial(Array<Sint8>& out, char x) |
{ | { |
_appendSpecialChar(out, x); |
_xmlWritter_appendSpecialChar(out, x); |
} | } |
| |
void XmlWriter::appendSpecial(Array<Sint8>& out, const char* str) | void XmlWriter::appendSpecial(Array<Sint8>& out, const char* str) |
{ | { |
while (*str) | while (*str) |
_appendSpecialChar(out, *str++); |
_xmlWritter_appendSpecialChar(out, *str++); |
} | } |
| |
void XmlWriter::appendSpecial(Array<Sint8>& out, const String& str) | void XmlWriter::appendSpecial(Array<Sint8>& out, const String& str) |
|
|
Char16 highSurrogate = str[i]; | Char16 highSurrogate = str[i]; |
Char16 lowSurrogate = str[++i]; | Char16 lowSurrogate = str[++i]; |
| |
_appendSurrogatePair(out, Uint16(highSurrogate),Uint16(lowSurrogate)); |
_xmlWritter_appendSurrogatePair(out, Uint16(highSurrogate),Uint16(lowSurrogate)); |
} | } |
else | else |
{ | { |
_appendSpecialChar(out, str[i]); |
_xmlWritter_appendSpecialChar(out, str[i]); |
} | } |
} | } |
} | } |
|
|
// Unwise = '{' '}' '|' '\\' '^' '[' ']' '`' | // Unwise = '{' '}' '|' '\\' '^' '[' ']' '`' |
// | // |
| |
inline void _encodeURIChar(String& outString, Sint8 char8) |
inline void _xmlWritter_encodeURIChar(String& outString, Sint8 char8) |
{ | { |
Uint8 c = (Uint8)char8; | Uint8 c = (Uint8)char8; |
| |
|
|
| |
for (Uint32 i=0; i<uriString.size(); i++) | for (Uint32 i=0; i<uriString.size(); i++) |
{ | { |
_encodeURIChar(encodedString, uriString[i]); |
_xmlWritter_encodeURIChar(encodedString, uriString[i]); |
} | } |
| |
return encodedString; | return encodedString; |
|
|
/* i18n remove - did not handle surrogate pairs | /* i18n remove - did not handle surrogate pairs |
for (Uint32 i=0; i<uriString.size(); i++) | for (Uint32 i=0; i<uriString.size(); i++) |
{ | { |
_encodeURIChar(encodedString, uriString[i]); |
_xmlWritter_encodeURIChar(encodedString, uriString[i]); |
} | } |
*/ | */ |
| |
|
|
Char16 highSurrogate = uriString[i]; | Char16 highSurrogate = uriString[i]; |
Char16 lowSurrogate = uriString[++i]; | Char16 lowSurrogate = uriString[++i]; |
| |
_appendSurrogatePair(utf8, Uint16(highSurrogate),Uint16(lowSurrogate)); |
_xmlWritter_appendSurrogatePair(utf8, Uint16(highSurrogate),Uint16(lowSurrogate)); |
} | } |
else | else |
{ | { |
_appendChar(utf8, uriString[i]); |
_xmlWritter_appendChar(utf8, uriString[i]); |
} | } |
} | } |
| |
// Second, escape the non HTTP-safe chars | // Second, escape the non HTTP-safe chars |
for (Uint32 i=0; i<utf8.size(); i++) | for (Uint32 i=0; i<utf8.size(); i++) |
{ | { |
_encodeURIChar(encodedString, utf8[i]); |
_xmlWritter_encodeURIChar(encodedString, utf8[i]); |
} | } |
| |
return encodedString; | return encodedString; |
|
|
{ | { |
out << "<NAMESPACE NAME=\"" << p << "\"/>\n"; | out << "<NAMESPACE NAME=\"" << p << "\"/>\n"; |
} | } |
delete nameSpaceCopy; |
free(nameSpaceCopy); |
| |
out << "</LOCALNAMESPACEPATH>\n"; | out << "</LOCALNAMESPACEPATH>\n"; |
} | } |
|
|
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
inline void _appendValue(Array<Sint8>& out, Boolean x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Boolean x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Uint8 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Uint8 x) |
{ | { |
XmlWriter::append(out, Uint32(x)); | XmlWriter::append(out, Uint32(x)); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Sint8 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Sint8 x) |
{ | { |
XmlWriter::append(out, Sint32(x)); | XmlWriter::append(out, Sint32(x)); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Uint16 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Uint16 x) |
{ | { |
XmlWriter::append(out, Uint32(x)); | XmlWriter::append(out, Uint32(x)); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Sint16 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Sint16 x) |
{ | { |
XmlWriter::append(out, Sint32(x)); | XmlWriter::append(out, Sint32(x)); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Uint32 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Uint32 x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Sint32 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Sint32 x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Uint64 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Uint64 x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Sint64 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Sint64 x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Real32 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Real32 x) |
{ | { |
XmlWriter::append(out, Real64(x)); | XmlWriter::append(out, Real64(x)); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Real64 x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, Real64 x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, const Char16& x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, const Char16& x) |
{ | { |
XmlWriter::appendSpecial(out, x); | XmlWriter::appendSpecial(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, const String& x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, const String& x) |
{ | { |
XmlWriter::appendSpecial(out, x); | XmlWriter::appendSpecial(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, const CIMDateTime& x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, const CIMDateTime& x) |
{ | { |
out << x.toString(); //ATTN: append() method? | out << x.toString(); //ATTN: append() method? |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, const CIMObjectPath& x) |
inline void _xmlWritter_appendValue(Array<Sint8>& out, const CIMObjectPath& x) |
{ | { |
XmlWriter::appendValueReferenceElement(out, x, true); | XmlWriter::appendValueReferenceElement(out, x, true); |
} | } |
| |
void _appendValueArray(Array<Sint8>& out, const CIMObjectPath* p, Uint32 size) |
void _xmlWritter_appendValueArray(Array<Sint8>& out, const CIMObjectPath* p, Uint32 size) |
{ | { |
out << "<VALUE.REFARRAY>\n"; | out << "<VALUE.REFARRAY>\n"; |
while (size--) | while (size--) |
{ | { |
_appendValue(out, *p++); |
_xmlWritter_appendValue(out, *p++); |
} | } |
out << "</VALUE.REFARRAY>\n"; | out << "</VALUE.REFARRAY>\n"; |
} | } |
| |
template<class T> | template<class T> |
void _appendValueArray(Array<Sint8>& out, const T* p, Uint32 size) |
void _xmlWritter_appendValueArray(Array<Sint8>& out, const T* p, Uint32 size) |
{ | { |
out << "<VALUE.ARRAY>\n"; | out << "<VALUE.ARRAY>\n"; |
| |
while (size--) | while (size--) |
{ | { |
out << "<VALUE>"; | out << "<VALUE>"; |
_appendValue(out, *p++); |
_xmlWritter_appendValue(out, *p++); |
out << "</VALUE>\n"; | out << "</VALUE>\n"; |
} | } |
| |
|
|
{ | { |
Array<Boolean> a; | Array<Boolean> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Uint8> a; | Array<Uint8> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Sint8> a; | Array<Sint8> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Uint16> a; | Array<Uint16> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Sint16> a; | Array<Sint16> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Uint32> a; | Array<Uint32> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Sint32> a; | Array<Sint32> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Uint64> a; | Array<Uint64> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Sint64> a; | Array<Sint64> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Real32> a; | Array<Real32> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Real64> a; | Array<Real64> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<Char16> a; | Array<Char16> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<String> a; | Array<String> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<CIMDateTime> a; | Array<CIMDateTime> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
{ | { |
Array<CIMObjectPath> a; | Array<CIMObjectPath> a; |
value.get(a); | value.get(a); |
_appendValueArray(out, a.getData(), a.size()); |
_xmlWritter_appendValueArray(out, a.getData(), a.size()); |
break; | break; |
} | } |
| |
|
|
// Has to be separate because it uses VALUE.REFERENCE tag | // Has to be separate because it uses VALUE.REFERENCE tag |
CIMObjectPath v; | CIMObjectPath v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
} | } |
else | else |
{ | { |
|
|
{ | { |
Boolean v; | Boolean v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Uint8 v; | Uint8 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Sint8 v; | Sint8 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Uint16 v; | Uint16 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Sint16 v; | Sint16 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Uint32 v; | Uint32 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Sint32 v; | Sint32 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Uint64 v; | Uint64 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Sint64 v; | Sint64 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Real32 v; | Real32 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Real64 v; | Real64 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
Char16 v; | Char16 v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
String v; | String v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
{ | { |
CIMDateTime v; | CIMDateTime v; |
value.get(v); | value.get(v); |
_appendValue(out, v); |
_xmlWritter_appendValue(out, v); |
break; | break; |
} | } |
| |
|
|
// do that in client today. Permanent change is to retry until spec | // do that in client today. Permanent change is to retry until spec |
// updated. This change is temp to finish tests or until the retry | // updated. This change is temp to finish tests or until the retry |
// installed. Required because of change to wbemservices cimom | // installed. Required because of change to wbemservices cimom |
#if defined PEGASUS_SNIA_INTEROP_TEST || defined PEGASUS_FORCE_POST_METHOD |
|
out << "POST /cimom HTTP/1.1\r\n"; |
|
#else |
|
if (httpMethod == HTTP_METHOD_M_POST) | if (httpMethod == HTTP_METHOD_M_POST) |
{ | { |
out << "M-POST /cimom HTTP/1.1\r\n"; | out << "M-POST /cimom HTTP/1.1\r\n"; |
|
|
{ | { |
out << "POST /cimom HTTP/1.1\r\n"; | out << "POST /cimom HTTP/1.1\r\n"; |
} | } |
#endif |
|
out << "HOST: " << host << "\r\n"; | out << "HOST: " << host << "\r\n"; |
out << "Content-Type: 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"; |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// _printAttributes() |
// _xmlWritter_printAttributes() |
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
static void _printAttributes( |
void _xmlWritter_printAttributes( |
PEGASUS_STD(ostream)& os, | PEGASUS_STD(ostream)& os, |
const XmlAttribute* attributes, | const XmlAttribute* attributes, |
Uint32 attributeCount) | Uint32 attributeCount) |
|
|
os << attributes[i].name << "="; | os << attributes[i].name << "="; |
| |
os << '"'; | os << '"'; |
_appendSpecial(os, attributes[i].value); |
_xmlWritter_appendSpecial(os, attributes[i].value); |
os << '"'; | os << '"'; |
| |
if (i + 1 != attributeCount) | if (i + 1 != attributeCount) |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// _indent() |
// _xmlWritter_indent() |
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
static void _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; |
| |
|
|
{ | { |
case XmlEntry::XML_DECLARATION: | case XmlEntry::XML_DECLARATION: |
{ | { |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
| |
os << "<?" << entry.text << " "; | os << "<?" << entry.text << " "; |
_printAttributes(os, entry.attributes, entry.attributeCount); |
_xmlWritter_printAttributes(os, entry.attributes, entry.attributeCount); |
os << "?>"; | os << "?>"; |
break; | break; |
} | } |
| |
case XmlEntry::START_TAG: | case XmlEntry::START_TAG: |
{ | { |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
| |
os << "<" << entry.text; | os << "<" << entry.text; |
| |
if (entry.attributeCount) | if (entry.attributeCount) |
os << ' '; | os << ' '; |
| |
_printAttributes(os, entry.attributes, entry.attributeCount); |
_xmlWritter_printAttributes(os, entry.attributes, entry.attributeCount); |
os << ">"; | os << ">"; |
stack.push(entry.text); | stack.push(entry.text); |
break; | break; |
|
|
| |
case XmlEntry::EMPTY_TAG: | case XmlEntry::EMPTY_TAG: |
{ | { |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
| |
os << "<" << entry.text << " "; | os << "<" << entry.text << " "; |
_printAttributes(os, entry.attributes, entry.attributeCount); |
_xmlWritter_printAttributes(os, entry.attributes, entry.attributeCount); |
os << "/>"; | os << "/>"; |
break; | break; |
} | } |
|
|
if (!stack.isEmpty() && strcmp(stack.top(), entry.text) == 0) | if (!stack.isEmpty() && strcmp(stack.top(), entry.text) == 0) |
stack.pop(); | stack.pop(); |
| |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
| |
os << "</" << entry.text << ">"; | os << "</" << entry.text << ">"; |
break; | break; |
|
|
case XmlEntry::COMMENT: | case XmlEntry::COMMENT: |
{ | { |
| |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
os << "<!--"; | os << "<!--"; |
_appendSpecial(os, entry.text); |
_xmlWritter_appendSpecial(os, entry.text); |
os << "-->"; | os << "-->"; |
break; | break; |
} | } |
| |
case XmlEntry::CONTENT: | case XmlEntry::CONTENT: |
{ | { |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
_appendSpecial(os, entry.text); |
_xmlWritter_appendSpecial(os, entry.text); |
break; | break; |
} | } |
| |
case XmlEntry::CDATA: | case XmlEntry::CDATA: |
{ | { |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
os << "<![CDATA[...]]>"; | os << "<![CDATA[...]]>"; |
break; | break; |
} | } |
| |
case XmlEntry::DOCTYPE: | case XmlEntry::DOCTYPE: |
{ | { |
_indent(os, stack.size(), indentChars); |
_xmlWritter_indent(os, stack.size(), indentChars); |
os << "<!DOCTYPE...>"; | os << "<!DOCTYPE...>"; |
break; | break; |
} | } |
|
|
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
|
|