Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 21st, 2008, 05:07 AM
Authorized User
 
Join Date: May 2008
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prafullaborade
Default convert string to xml

 public static string xmlServiceType()
            {
                string path;
                path = Convert.ToString(HttpContext.Current.Server.MapPat h("~/App_Data/xml1.xml"));
                return path;
            }
           // convert string into xml
            public static string getReportBackUp(string MailID)
            {

                XmlDocument doc = new XmlDocument();
                doc.Load(xmlServiceType());
                XmlElement newElem = doc.CreateElement("Mail");
                XmlAttribute MailTo = doc.CreateAttribute("MailTo");
                MailTo.Value = MailID;

                newElem.Attributes.Append(MailTo);
                // doc.DocumentElement.AppendChild(newElem);
                doc.DocumentElement.AppendChild(newElem);
                string s = Convert.ToString(MailID);

                doc.Save(xmlServiceType());
                //string s = newElem.ToString();
                return s;

            }

i convert string coming from text box to xml and also wrie it uin xml & database
but if i fired more than 1 email id from textbox in xml file it comes to 1 line
but i want 1 email id at 1 line and 2 at 2 line even if it is fired at atime i want code for that

 
Old May 21st, 2008, 05:27 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please say what technology you are using - you can't expect people to read your code to discover whether it's Java or C#, Oracle or Microsoft.

And please phrase your question in English. We aren't all teenagers versed in text shorthand:

i want 1 email id at 1 line and 2 at 2 line even if it is fired at atime i

Oh, and please say "please".



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 21st, 2008, 06:40 AM
Authorized User
 
Join Date: May 2008
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prafullaborade
Default

 public static string xmlServiceType()
            {
                string path;
                path = Convert.ToString(HttpContext.Current.Server.MapPat h("~/App_Data/xml1.xml"));
                return path;
            }
           // convert string into xml
            public static string getReportBackUp(string MailID)
            {

                XmlDocument doc = new XmlDocument();
                doc.Load(xmlServiceType());
                XmlElement newElem = doc.CreateElement("Mail");
                XmlAttribute MailTo = doc.CreateAttribute("MailTo");
                MailTo.Value = MailID;

                newElem.Attributes.Append(MailTo);
                // doc.DocumentElement.AppendChild(newElem);

                doc.DocumentElement.AppendChild(newElem);
                string s = Convert.ToString(MailID);

                doc.Save(xmlServiceType());
                //string s = newElem.ToString();
                return s;

            }
 This code is in c# which convert String to XML & write it in xml file & database.
I am fired string from TextBox. But in XML file multiple Email ID come at single line
I want 1 Email ID at 1 Line next at next line if nos od Email ID is fired
plese send me code if any one know

 
Old May 21st, 2008, 06:56 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

What exactly do you mean by 'multiple EMail ID come at single line'.

Perhaps show us the XML it is producing and show us what you would like it to look like.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert to string prafullaborade XML 7 May 29th, 2008 02:59 PM
code of convert xml data type in string by C# prafullaborade XML 2 May 24th, 2008 07:49 AM
Convert 1 big XML to multiple smaller XML victorcorey XSLT 1 March 20th, 2008 05:59 AM
VB.NET: Convert String and append to Xml files toytoy Pro VB.NET 2002/2003 0 September 2nd, 2004 10:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.