The fact that you would need to be able to load, edit and save would make LinqToXml teh best candidate for you.
LinqToXml will integrate with pretty much anything you need to do, its easy to learn, performs fast and queries against data are as easy as sql queries (and share some similiarities... sort of).
When the going get's tough, the tough outsource and take a vacation... lol I wish :(
First sorry to say that your xml doesn't format well,and when I copy the whole xml contents into a blank xml file,there comes a lot of error or warnings……
Second,if you want to do edit, open or save xml,a better way is to find a xml-supported editor such as NotePad++;if you want to program with that,either XmlDocument or XDocument will be fine to you:-)
Toystoy
Member
16 Points
12 Posts
Editing xml file
May 27, 2012 04:25 PM|LINK
Hi,
How should I open, edit and save xml (wsdl) file in consol app? I need to add schemalocation to imports.
I've got this code:
<?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://rl.com.pl/esb/PartService" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://rl.com.pl/esb/PartService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <xsd:schema targetNamespace="http://rl.com.pl/esb/PartService/Imports"> <xsd:import namespace="http://rl.com.pl/esb/CarService" /> <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> <xsd:import namespace="http://schemas.datacontract.org/2004/07/Cars" /> </xsd:schema> </wsdl:types>And I need to add schemalocation tag.
<?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://rl.com.pl/esb/PartService" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://rl.com.pl/esb/PartService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <xsd:schema targetNamespace="http://rl.com.pl/esb/PartService/Imports"> <xsd:import schemaLocation="file:///C:/Users/Desktop/ble/rl.com.pl.esb.CarService.xsd" namespace="http://rl.com.pl/esb/CarService" /> <xsd:import schemaLocation="file:///C:/Users/Desktop/ble/schemas.microsoft.com.2003.10.Serialization.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> <xsd:import schemaLocation="file:///C:/Users/Desktop/ble/Cars.xsd" namespace="http://schemas.datacontract.org/2004/07/Cars" /> </xsd:schema> </wsdl:types>I need to automate this process :]
magicmike201...
Contributor
2021 Points
481 Posts
Re: Editing xml file
May 27, 2012 08:15 PM|LINK
The fact that you would need to be able to load, edit and save would make LinqToXml teh best candidate for you.
LinqToXml will integrate with pretty much anything you need to do, its easy to learn, performs fast and queries against data are as easy as sql queries (and share some similiarities... sort of).
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Editing xml file
May 29, 2012 01:32 AM|LINK
Hello:)
First sorry to say that your xml doesn't format well,and when I copy the whole xml contents into a blank xml file,there comes a lot of error or warnings……
Second,if you want to do edit, open or save xml,a better way is to find a xml-supported editor such as NotePad++;if you want to program with that,either XmlDocument or XDocument will be fine to you:-)