Hi Everyone,
I am constructing an xml file, but when I try to read it there are some
extra slashes in the output. Can anoyone tell me why there are some extra
slashed and can i send the file to web service with those extra slashes.
below I am constructing the document
StringWriter sWriter;
SqlDataReader dr;
dr = SqlHelper.Execu teReader(connec tionString,"SP_ UsersData_Get") ;
XmlTextWriter w;
sWriter = new StringWriter();
//w = new XmlTextWriter(" C:/text.txt", System.Text.Enc oding.UTF8);
w= new XmlTextWriter(s Writer);
w.Formatting=Fo rmatting.Indent ed;
w.Indentationfi ltered=2;
w.WriteStartDoc ument(true);
w.WriteStartEle ment("test");
w.WriteStartEle ment("system");
w.WriteAttribut eString("id", "UML");
w.WriteElementS tring("version" , "1.0");
w.WriteStartEle ment("configura tion");
w.WriteElementS tring("update_p assword","True" );
w.WriteEndEleme nt();
w.WriteStartEle ment("users");
while(dr.Read() )
{
w.WriteStartEle ment("user");
w.WriteElementS tring("firstnam e", dr["first_name "].ToString());
w.WriteElementS tring("lastname ", dr["last_name"].ToString());
w.WriteElementS tring("email", dr["email"].ToString());
w.WriteElementS tring("loginid" , dr["Login"].ToString());
w.WriteElementS tring("status", "A");
w.WriteStartEle ment("roles");
w.WriteStartEle ment("role");
w.WriteString(" Agent");
w.WriteStartEle ment("groups");
w.WriteStartEle ment("group");
w.WriteElementS tring("path", "Services/irvine/" +
dr["supervisor "].ToString());
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteStartEle ment("relations ");
w.WriteStartEle ment("relation" );
w.WriteElementS tring("type", "UML");
w.WriteElementS tring("external id", dr["Login"].ToString());
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteEndEleme nt();
}
w.WriteEndEleme nt();
w.WriteEndDocum ent();
w.Close();
}
When I do sWriter.ToStrin g , It gives me an output file like below:
"<?xml versionfiltered =\"1.0\" encoding=\"utf-16\"
standalone=\"ye s\"?>\r\n<a>\r\ n <system id=\"UMA\">\r\n
<version>1.0</version>\r\n <configuration> \r\n
<update_passwor d>True</update_password >\r\n </configuration>\ r\n <users>\r\n
<user>\r\n <firstname>
This is not the full xml, but as you can see I have \r\n slashes all over my
output xml. can I send my xml to web service like this.
Thanks.
--
vinki 1 1567
Hey,
The '\r\n' are the symbols for new line, as you are finally packing with
XMLTextWriter class, these doesn't effect your file. Hence you can pass the
file to webservice, will not be a problem
To calrify you in details, better save that stream to a file on to the disk
and try to open it from IE. What do you see ?
--
Every thing is perfect, as long as you share!!!
"vinki" wrote:
Hi Everyone,
I am constructing an xml file, but when I try to read it there are some
extra slashes in the output. Can anoyone tell me why there are some extra
slashed and can i send the file to web service with those extra slashes.
below I am constructing the document
StringWriter sWriter;
SqlDataReader dr;
dr = SqlHelper.Execu teReader(connec tionString,"SP_ UsersData_Get") ;
XmlTextWriter w;
sWriter = new StringWriter();
//w = new XmlTextWriter(" C:/text.txt", System.Text.Enc oding.UTF8);
w= new XmlTextWriter(s Writer);
w.Formatting=Fo rmatting.Indent ed;
w.Indentationfi ltered=2;
w.WriteStartDoc ument(true);
w.WriteStartEle ment("test");
w.WriteStartEle ment("system");
w.WriteAttribut eString("id", "UML");
w.WriteElementS tring("version" , "1.0");
w.WriteStartEle ment("configura tion");
w.WriteElementS tring("update_p assword","True" );
w.WriteEndEleme nt();
w.WriteStartEle ment("users");
while(dr.Read() )
{
w.WriteStartEle ment("user");
w.WriteElementS tring("firstnam e", dr["first_name "].ToString());
w.WriteElementS tring("lastname ", dr["last_name"].ToString());
w.WriteElementS tring("email", dr["email"].ToString());
w.WriteElementS tring("loginid" , dr["Login"].ToString());
w.WriteElementS tring("status", "A");
w.WriteStartEle ment("roles");
w.WriteStartEle ment("role");
w.WriteString(" Agent");
w.WriteStartEle ment("groups");
w.WriteStartEle ment("group");
w.WriteElementS tring("path", "Services/irvine/" +
dr["supervisor "].ToString());
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteStartEle ment("relations ");
w.WriteStartEle ment("relation" );
w.WriteElementS tring("type", "UML");
w.WriteElementS tring("external id", dr["Login"].ToString());
w.WriteEndEleme nt();
w.WriteEndEleme nt();
w.WriteEndEleme nt();
}
w.WriteEndEleme nt();
w.WriteEndDocum ent();
w.Close();
}
When I do sWriter.ToStrin g , It gives me an output file like below:
"<?xml versionfiltered =\"1.0\" encoding=\"utf-16\"
standalone=\"ye s\"?>\r\n<a>\r\ n <system id=\"UMA\">\r\n
<version>1.0</version>\r\n <configuration> \r\n
<update_passwor d>True</update_password >\r\n </configuration>\ r\n <users>\r\n
<user>\r\n <firstname>
This is not the full xml, but as you can see I have \r\n slashes all over my
output xml. can I send my xml to web service like this.
Thanks.
--
vinki
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Cyde Weys |
last post by:
I'm currently working on converting a simulator program from Visual
Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but
there's still one thing I haven't gotten to and I've never really had
to deal with it before. I'm programming a front-end for what is a
compiled Fortran program. The VB source does the following to call
the Fortran:
'Defines the subroutine.
Declare Sub Cycle_DW Lib "cycdw.dll" Alias "CYCDW" (ByRef...
|
by: Edward Diener |
last post by:
I received no answers about this the first time I posted, so I will try
again. My inability to decipher an MSDN topic may find others who have the
same inability and someone who can decipher and explain it.
I have some questions about the instructions for creating a mixed mode DLL
in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure
Intermediate Language to Mixed Mode" in the "Managed Extensions for C++
Reference"....
|
by: Paraic Gallagher |
last post by:
Hi,
This is my first post to the list, I hope somebody can help me with this
problem. Apologies if it has been posted before but I have been internet
searching to no avail.
What I am trying to do is provide a simple method for a user to change a
config file, for a test suite.
The config file consists of a number of keys, eg. build number, target
device, etc.
|
by: Wallace |
last post by:
Hai,
Can anyone tell how to convert an object into string?
Please help me.... urgent..
Thanx in advance...
|
by: gg9h0st |
last post by:
i'm a newbie studying php.
i was into array part on tutorial and it says
i'll get an array having keys that from member variable's name
by converting an object to array.
i guessed "i can get public members but not protected, private, static
members"
| |
by: Terry |
last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces.
One of the major uses is to be able to split out Read-only access to an
obect. Let me give you a simple (contrived) example:
In Project RoObjDefs:
RoPerson.cls file:
Public Property Get FirstName() as String
Public Property Get LastName() as String
<end of file RoPerson.cls>
RoPersons.cls file
Public Function Count() as Integer
|
by: SMichal |
last post by:
Hi, how can I parse string "? 20.000" to double ?
|
by: nvx |
last post by:
Hi,
I'm looking for a simple way to convert a Double to a String exactly
the .ToString() does, except these two differences:
- the number of decimals is given (rounding is applied if
necessary), and
- trailing zeroes are kept.
This means I need it to be converted using the scientific notation if
the number is greater than a certain value etc., not just a simple
"this number of digits (or more if needed) before the decimal point
|
by: CoreyWhite |
last post by:
Problem:
You have numbers in string format, but you need to convert them to a
numeric type, such as an int or float.
Solution:
You can do this with the standard library functions. The functions
strtol, strtod, and strtoul, defined in <cstdlib>, convert a null-
terminated character string to a long int, double, or unsigned long.
You can use them to convert numeric strings of any base to a numeric
|
by: Hank Stalica |
last post by:
I'm having this weird problem where my code does the following
conversion from string to float:
27000000.0 -27000000.00
2973999.99 -29740000.00
2989999.13 -2989999.25
The number on the left is the string I get after tokenizing a bigger
string. The number on the right is the number I get after the conversion.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |