SF Tracker [ 1628552 ] XML white space patch

Submitted By: 
Fredrik Svensson - svefredrik

A few modifications to the patch were made:
1) Do not introduce new CRLF's where there were none.
2) Applied the same original idea to two other palces in soap_ctrlpt.c.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@114 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2007-01-06 14:18:18 +00:00
parent 9595ddcf3a
commit ae7ca6a2cf
3 changed files with 49 additions and 34 deletions

View File

@ -146,7 +146,7 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
if( ( child != NULL )
&& ( ixmlNode_getNodeType( child ) ==
eELEMENT_NODE ) ) {
ixml_membuf_append_str( buf, ">\n" );
ixml_membuf_append_str( buf, ">\r\n" );
} else {
ixml_membuf_append_str( buf, ">" );
}
@ -164,7 +164,7 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
&& ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) {
ixml_membuf_append_str( buf, ">" );
} else {
ixml_membuf_append_str( buf, ">\n" );
ixml_membuf_append_str( buf, ">\r\n" );
}
ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling
( nodeptr ), buf );
@ -227,7 +227,7 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
child = ixmlNode_getFirstChild( nodeptr );
if( ( child != NULL )
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
ixml_membuf_append_str( buf, ">\n" );
ixml_membuf_append_str( buf, ">\r\n" );
} else {
ixml_membuf_append_str( buf, ">" );
}
@ -239,7 +239,7 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
// Done with children. Output the end tag.
ixml_membuf_append_str( buf, "</" );
ixml_membuf_append_str( buf, nodeName );
ixml_membuf_append_str( buf, ">\n" );
ixml_membuf_append_str( buf, ">\r\n" );
break;
default:
@ -372,7 +372,7 @@ ixmlPrintDocument(IXML_Document *doc)
}
ixml_membuf_init( buf );
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\n" );
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
ixmlPrintDomTree( rootNode, buf );
return buf->buf;
@ -421,7 +421,7 @@ ixmlDocumenttoString(IXML_Document *doc)
}
ixml_membuf_init( buf );
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\n" );
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
ixmlDomTreetoString( rootNode, buf );
return buf->buf;

View File

@ -196,11 +196,12 @@ addToAction( IN int response,
if( response ) {
sprintf( ActBuff,
"<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
ActionName, ServType, ActionName );
"<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
ActionName, ServType, ActionName );
} else {
sprintf( ActBuff, "<u:%s xmlns:u=\"%s\"></u:%s>",
ActionName, ServType, ActionName );
sprintf( ActBuff,
"<u:%s xmlns:u=\"%s\"></u:%s>",
ActionName, ServType, ActionName );
}
rc = ixmlParseBufferEx( ActBuff, ActionDoc );
@ -274,11 +275,13 @@ makeAction( IN int response,
}
if( response ) {
sprintf( ActBuff, "<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
ActionName, ServType, ActionName );
sprintf( ActBuff,
"<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
ActionName, ServType, ActionName );
} else {
sprintf( ActBuff, "<u:%s xmlns:u=\"%s\"></u:%s>",
ActionName, ServType, ActionName );
sprintf( ActBuff,
"<u:%s xmlns:u=\"%s\"></u:%s>",
ActionName, ServType, ActionName );
}
if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) {

View File

@ -604,10 +604,13 @@ SoapSendAction( IN char *action_url,
off_t content_length;
char *xml_start =
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"
"<s:Envelope "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
"<s:Body>";
char *xml_end = "</s:Body>\n" "</s:Envelope>\n";
char *xml_end =
"</s:Body>\r\n"
"</s:Envelope>\r\n\r\n";
int xml_start_len;
int xml_end_len;
int action_str_len;
@ -742,19 +745,25 @@ SoapSendActionEx( IN char *action_url,
xboolean got_response = FALSE;
char *xml_start =
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n";
char *xml_body_start = "<s:Body>";
char *xml_end = "</s:Body>\n" "</s:Envelope>\n";
"<s:Envelope "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n";
char *xml_header_start =
"<s:Header>\r\n";
char *xml_header_end =
"</s:Header>\r\n";
char *xml_body_start =
"<s:Body>";
char *xml_end =
"</s:Body>\r\n"
"</s:Envelope>\r\n";
int xml_start_len;
int xml_end_len;
char *xml_header_start = "<s:Header>\n";
char *xml_header_end = "</s:Header>\n";
int xml_header_start_len;
int xml_header_end_len;
int xml_header_str_len;
int action_str_len;
int xml_header_end_len;
int xml_body_start_len;
int action_str_len;
int xml_end_len;
off_t content_length;
*response_node = NULL; // init
@ -795,7 +804,7 @@ SoapSendActionEx( IN char *action_url,
url.hostport.text.size,
url.hostport.text.buff ); )
xml_start_len = strlen( xml_start );
xml_start_len = strlen( xml_start );
xml_body_start_len = strlen( xml_body_start );
xml_end_len = strlen( xml_end );
action_str_len = strlen( action_str );
@ -896,15 +905,18 @@ SoapGetServiceVarStatus( IN char *action_url,
off_t content_length;
char *xml_start =
// "<?xml version=\"1.0\"?>\n" required??
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"
"<s:Body>\n"
"<u:QueryStateVariable xmlns:u=\"urn:schemas-upnp-org:control-1-0\">\n"
"<s:Envelope "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
"<s:Body>\r\n"
"<u:QueryStateVariable xmlns:u=\"urn:schemas-upnp-org:control-1-0\">\r\n"
"<u:varName>";
char *xml_end = "</u:varName>\n"
"</u:QueryStateVariable>\n" "</s:Body>\n" "</s:Envelope>\n";
char *xml_end =
"</u:varName>\r\n"
"</u:QueryStateVariable>\r\n"
"</s:Body>\r\n"
"</s:Envelope>\r\n";
*var_value = NULL; // return NULL in case of an error