473,320 Members | 1,865 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,320 software developers and data experts.

Problem in creating XML using string.format..

Please have a look at below code snippet -

in the first snippet I have made constant to provide a static format to string.. the second uses the constant to string.format the values received at runtime. But problem i m facing is - I am loosing the tag names, for example - <PolicyNumber> , <UserID>; I only recieve the value in xml nodes not the node names.. Please let me know if there is any way to maintain the xml structure from snippet 2.



************************************************** ******************************************
#1.
public static string conststrReportXML =
"<PARAMETERS><ReportPath>\\\\%COMPUTERNAME%\\ezsb\ \PMS\\</ReportPath><ReportName>ZZPMS</ReportName><ForceReport>True</ForceReport><DataConnectionString>DSN=COSPROD</DataConnectionString><ReturnType>5</ReturnType><DisplayFormat>5</DisplayFormat>" +
"<PolicyNumber>{0}</PolicyNumber>" +
"<CrystalReportName>{1}</CrystalReportName>" +
"<CrystalConnection>{2}</CrystalConnection>" +
"<UserID>{3}</UserID>" +
"<Password>{4}</Password>" +
"<DataBaseName>{5}</DataBaseName>" +
"<REPORTPARAMETERS>" +
"{6}{7}{8}{9}{10}{11}" +
"</REPORTPARAMETERS>" +
"</PARAMETERS>";

************************************************** ******************************************
#2
strXmlReportRequest = string.Format(conststrReportXML, strPolicyNumber, "rptMainLocationActivity.rpt",
Session["ReportServerName"].ToString(), Session["ReportUserID"].ToString(),
Session["ReportPassword"].ToString(), Session["ReportDatabaseName"].ToString(),
"<BeginDate>" + strBeginDate + "</BeginDate>",
"<EndDate>" + strEndDate + "</EndDate>",
"<PolicyNumbers>" + strPolicyNumbers + "</PolicyNumbers>",
"<UserName>" + strUserName + "</UserName>",
"<LocationTypes>" + strLocationTypes + "</LocationTypes>",
"<LocationTypeNames>" + strLocationTypeNames + "</LocationTypeNames>");
************************************************** ****************************************

Thanks in advance
Sep 13 '08 #1
0 927

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: csgraham74 | last post by:
Hi guys, im attempting to build a querystring to use in a window.open to display a popup box. Unfortunately im quite new to javascript and find it quite difficult to get this functioning...
3
by: Boz | last post by:
Hi, I am trying to use string.Format() to output the value of a double. double da = 100000000000.99994; double db = 100000000000.9994; double dc = 100000000000.994; double dd =...
2
by: Bob | last post by:
I'm having trouble the string.Format() throwing exceptions and I can't figure out what I am doing wrong. Given the following setup code: string str = { "one", "two", "three", "four" }; double...
1
by: William F. Robertson, Jr. | last post by:
I have a question about the string formatting function. I have a field in a database that is coming back as a 6 digit date: 061503 I would like to format this out to 06/15/03 to be displayed...
3
by: mavrick101 | last post by:
Why is String.format better than just concatenating the string? is it just the cost of creating a new string? or any thing more?
1
by: Alan Foxmore | last post by:
Hello all, Is it possible to use String.Format() to specify a maximum length for a formatted item? For example, let's say I have: String.Format("{0}", "FREDDY"); How can I specify that the...
8
by: Lucky | last post by:
hi guys! back again with another query. the problem is like this. i want to print a line like this: "---------------------------------------------" the easiest way is to simply assign it to...
0
by: kelvin.koogan | last post by:
Does .NET have an equivalent to using * to specify the width of a field in printf? I.e. is there an equivalent to: printf(“%*s”, width, “String”) when using String.Format or similar? TIA,...
4
by: Dev | last post by:
Can replacing this with stringbuilder advisable. Or since iteration is less only 20 times, the time taken by using strings and string builder will be the same. for( int i = 0; i< 20; i++ ) { ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.