.NETGURU
Need Help with XML in .NET?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngxml' list.


Khanh Nguyen
-- Moved from [aspngfreeforall] to [aspngxml] by Tony Stark <Click here to reveal e-mail address> --

I have this task. After reading what I need to do, can anyone offer what
techique I should use to do this most efficiently.

I have to pass an xml message to a remote object for authorization. The xml
message is quite large. There are over 50 elements to this document.
I only need to set 5 elements with values. Do I have to build the entire
xml document with string builder to just set 5 elements, or is there a way
for
me to create a simple 5 element XML and mapp it to the necessary ones on the
larger xml document?

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com

| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngfreeforall.asp = JOIN/QUIT

Reply to this message...
 
    
Andrew Munro
If i think this what you want have a look below

This'll map a querystring (or what ever you like) and allocate the
querystring name values to those in the xml doc, just get the names into the
collection first

string[] arr2;
string[] arr1;
// Load NameValueCollection object.
            NameValueCollection coll=Request.QueryString;

            // Get names of all keys into a string array.
            arr1 = coll.AllKeys;

            //load xml doc and set path
            //XmlDocument doc = new XmlDocument();
            string path = Server.MapPath("/x_test/");
            FileStream sXP = new FileStream(path + "xpt.xml",
FileMode.Open);
            doc.Load(sXP);
            

            //loop thru inserting the keys into the xml file
            for (int loop1 = 0; loop1 < arr1.Length; loop1++)
                {
                
                    XmlNode nNode =
doc.GetElementsByTagName(arr1[loop1])[0];
                    arr2 = coll.GetValues(arr1[loop1]);

                 for (int loop2 = 0; loop2 < arr2.Length;
loop2++)
                        {
                            nNode.InnerText =
arr2[loop2];
                        }

                }

Hope it helps

-----Original Message-----
From: Khanh Nguyen [mailto:Click here to reveal e-mail address]
Sent: 11 July 2002 07:21
To: aspngxml
Subject: [aspngxml] Need Help with XML in .NET?

-- Moved from [aspngfreeforall] to [aspngxml] by Tony Stark
<Click here to reveal e-mail address> --

I have this task. After reading what I need to do, can anyone offer what
techique I should use to do this most efficiently.

I have to pass an xml message to a remote object for authorization. The xml
message is quite large. There are over 50 elements to this document.
I only need to set 5 elements with values. Do I have to build the entire
xml document with string builder to just set 5 elements, or is there a way
for
me to create a simple 5 element XML and mapp it to the necessary ones on the
larger xml document?

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com

| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngfreeforall.asp = JOIN/QUIT

| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.Collections.Specialized.NameValueCollection
System.IO.FileMode
System.IO.FileStream
System.Xml.XmlDocument
System.Xml.XmlNode




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification