How do I create an xml file and execute in c#...

  • Thread starter Thread starter trint
  • Start date Start date
T

trint

UPS Rates & Service is an xml method of requesting rates on shipping
out boxes from the "checkout" point of online shopping cart software.
Well, I have gotten my c# project all the way to the point of having
all this information stored in variables ready to place in UPS Rates &
Service xml.
How do I create and activate an xml file from within my c#
application?
Can I build it with strings then save it as a file and execute it
somehow?
Any help is appreciated.
Thanks,
Trinity
 
There are a number of ways to do this, but in your particular case I'd say
your best bet is to have a "template" xml saved as a file, with the elements
that are supposed to be filled in for UPS being blank.

You would load the into an XmlDocument class instance using the Load method,
and then, using XPATH methods, you would "fill in" the values before posting
it to the UPS WebSite.

Example:

myUpsXmlDocument.SelectSingleNode("//weight").InnerText= myWeight.ToString();

Peter
 
There are a number of ways to do this, but in your particular case I'd say
your best bet is to have a "template" xml saved as a file, with the elements
that are supposed to be filled in for UPS being blank.

You would load the into an XmlDocument class instance using the Load method,
and then, using XPATH methods, you would "fill in" the values before posting
it to the UPS WebSite.

Example:

myUpsXmlDocument.SelectSingleNode("//weight").InnerText= myWeight.ToString();

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net





- Show quoted text -

Thank you, I will give this a try.
Trint
 
Hi Trinity,

As Peter said, creating a template file to begin with (Notepad is probably good enough for this) is a good starting point. I'm not familiar with UPS Rates @ Services but if what you call 'xml method' is really a webservice then the xml is probably just a description of what is expected as input for that method. If so, your best bet is to try to create a Web Reference to the service, and then hopefully you can use it as you would any other method.

XML is just text and can't be executed in any way. You can build it in any number of ways, but all it does is hold information in a format readable to a bunch of stuff.
 
Hi Trinity,

As Peter said, creating a template file to begin with (Notepad is probably good enough for this) is a good starting point. I'm not familiar with UPS Rates @ Services but if what you call 'xml method' is really a webservice then the xml is probably just a description of what is expected as input for that method. If so, your best bet is to try to create a Web Reference to the service, and then hopefully you can use it as you would any other method.

XML is just text and can't be executed in any way. You can build it in any number of ways, but all it does is hold information in a format readable to a bunch of stuff.

ok, I'm working on it and will let everyone know what it looks like.
Thanks,
Trint
 
Back
Top