473,395 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Preserving white space in XML

Hi,
I am consuming a web service in my asp.net application. I added the
web references in Visual Studio by pointing to a wsdl file. Visual
Studio automatically creates the Reference.cs file and the code that
is used to serialize the classes used in the server's service. I
create an instance of the input variable, set my values, and pass it
to a method. The class is serialized/deserialized for me into an XML
string that is sent to the server. Pretty easy using Visual Studio.

This is all great except that I want to preserve spaces that I pass to
the web service. If I set a public variable in the input class to a
space (" "), the space will be stripped out when the serialization
takes place.

How do I edit the Reference.cs file to change this behavior? Or, can
this be defined in the wsdl file so that as I refresh my Web Reference
in Visual Studio, I will not have to make the change each time. Is
there a way to globally set preserve xml:space="preserve" for all of
my input classes?

Here is a chunk of my Reference.cs file and the code that actually
makes the method call. (although I do not think you need this)
Can someone show me how to alter it to make my resulting xml contain a
xml:space="preserve" tag?
Thanks,
Mike
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.573
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

//
// This source code was auto-generated by Microsoft.VSDesigner,
Version 1.1.4322.573.
//
namespace MHS.jacada {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Web.Services.WebServiceBindingAttribute(Nam e="svcProvider",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public class svcProvider :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

public JIHeader JIHeaderValue;

/// <remarks/>
public svcProvider() {
this.Url = "http://blah:8080/JIWSVC/services/svcProvider";
}

/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("JIDe bugResponse",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public string
JIDebug([System.Xml.Serialization.XmlElementAttribute("JIDe bug",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
JIDebug JIDebug1) {
object[] results = this.Invoke("JIDebug", new object[] {
JIDebug1});
return ((string)(results[0]));
}

/// <remarks/>
public System.IAsyncResult BeginJIDebug(JIDebug JIDebug1,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("JIDebug", new object[] {
JIDebug1}, callback, asyncState);
}

/// <remarks/>
public string EndJIDebug(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}

/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute( "JIHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("imth ExitSuccessOrLockResponse",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public imthExitSuccessOrLockResponse
imthExitSuccessOrLock([System.Xml.Serialization.XmlElementAttribute("imth ExitSuccessOrLock",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
imthExitSuccessOrLock imthExitSuccessOrLock1) {
object[] results = this.Invoke("imthExitSuccessOrLock",
new object[] {
imthExitSuccessOrLock1});
return ((imthExitSuccessOrLockResponse)(results[0]));
}

/// <remarks/>
public System.IAsyncResult
BeginimthExitSuccessOrLock(imthExitSuccessOrLock
imthExitSuccessOrLock1, System.AsyncCallback callback, object
asyncState) {
return this.BeginInvoke("imthExitSuccessOrLock", new
object[] {
imthExitSuccessOrLock1}, callback,
asyncState);
}

/// <remarks/>
public imthExitSuccessOrLockResponse
EndimthExitSuccessOrLock(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((imthExitSuccessOrLockResponse)(results[0]));
}

/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute( "JIHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("imth TimeoutFailureResponse",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public imthTimeoutFailureResponse
imthTimeoutFailure([System.Xml.Serialization.XmlElementAttribute("imth TimeoutFailure",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
imthTimeoutFailure imthTimeoutFailure1) {
object[] results = this.Invoke("imthTimeoutFailure", new
object[] {
imthTimeoutFailure1});
return ((imthTimeoutFailureResponse)(results[0]));
}

/// <remarks/>
public System.IAsyncResult
BeginimthTimeoutFailure(imthTimeoutFailure imthTimeoutFailure1,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("imthTimeoutFailure", new object[]
{
imthTimeoutFailure1}, callback, asyncState);
}

/// <remarks/>
public imthTimeoutFailureResponse
EndimthTimeoutFailure(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((imthTimeoutFailureResponse)(results[0]));
}

/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute( "JIHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("mthA ddINProviderResponse",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public mthAddINProviderResponse
mthAddINProvider([System.Xml.Serialization.XmlElementAttribute("mthA ddINProvider",
Namespace="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
mthAddINProvider mthAddINProvider1) {
object[] results = this.Invoke("mthAddINProvider", new
object[] {
mthAddINProvider1});
return ((mthAddINProviderResponse)(results[0]));
}
/// <remarks/>
public System.IAsyncResult
BeginmthAddINProvider(mthAddINProvider mthAddINProvider1,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("mthAddINProvider", new object[] {
mthAddINProvider1}, callback, asyncState);
}

/// <remarks/>
public mthAddINProviderResponse
EndmthAddINProvider(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((mthAddINProviderResponse)(results[0]));
}

}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public class mthAddINProviderResponseOutVar_0MthAddINProvider_o utputStatus
{

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string host_message;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string jacada_statuscode;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public class mthAddINProviderInVar_0 {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public mthAddINProviderInVar_0MthAddINProvider_input
mthAddINProvider_input;
}


/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://svcProvider.wsdlgen.provider.jacada.blah.com")]
public class mthAddINProviderInVar_0MthAddINProvider_input {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string input_a;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string input_b;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string input_c;

}
}

--------------- end of Reference.cs ------------------
public string Add()
{
MHS.jacada.mthAddINProvider input = new
MHS.jacada.mthAddINProvider();
MHS.jacada.mthAddINProviderInVar_0 inVar = new
MHS.jacada.mthAddINProviderInVar_0();
MHS.jacada.mthAddINProviderInVar_0MthAddINProvider _input inVarInput =
new MHS.jacada.mthAddINProviderInVar_0MthAddINProvider _input();
// sure wish these spaces were preserved!
inVarInput.input_a = " y ";
inVarInput.input_a = " ";
inVarInput.input_a = " ";
inVar.mthAddINProvider_input = inVarInput;
input.InVar_0 = inVar;
MHS.jacada.mthAddINProviderResponse output =
jacadaService.mthAddINProvider( input );
return output.OutVar_0.mthAddINProvider_output.Status.jac ada_statuscode;
}
Nov 12 '05 #1
0 2123

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Grumble | last post by:
Hello all, I want to read lines from a text file, where each line has the following syntax: token1:token2:token3 There could be white space between tokens and ':'
2
by: Malcolm Dew-Jones | last post by:
I am looking at xslt 1.0 and trying to understand if empty text nodes are supposed to be stripped or not as the default behaviour. 3.4 starts by listing rules for when white space is not stripped...
17
by: Stanimir Stamenkov | last post by:
Is it possible to make two inline elements to appear adjacent stripping any white space appearing in between in the source? Example: <span class="adj">1</span> <span class="adj">2</span>...
0
by: Mark Moore | last post by:
I'm trying to layout a couple text input fields and their corresponding labels without using a table. When I was trying to debug my understanding of CSS, I was *very* surprised to see that span's...
38
by: Xah Lee | last post by:
sometimes i wish to add white space in <p> as to achived effects similar to tab. what should i do? using empty image seems the sure way but rather complicated. (and dosen't change size with...
8
by: TheDude5B | last post by:
Hi, I have some data which is stored in my MySQL database as TEXT. when the data is entered in, it has some carriage returns in it, and this can be seen when querying the data using MySQL Query...
2
by: shagy | last post by:
Hi, I'm having a problem with a <select><option> which has white space in values... When I post the data I only get the first word (up to the white space). "Testing white space" becomes...
3
by: zjw2112 | last post by:
Hello. I have some javascript code that dynamically creates a textarea and sets the wrap value to hard, which I thought would preserve CR/LF in the textarea: var otherTextArea =...
4
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.