|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can you insert elements into an XML file that exists as a string?Dim r As String = WS.getInfo("arg1", "arg2", "arg3") Dim dsTest As New DataSet Dim srTest As New System.IO.StringReader(r) dsTest.ReadXml(srTest) This is how I currently populate a DataSet. The web service "WS" returns a single string, within which is an XML document. It works great. There is a problem, though, in that the XML has missing elements sometimes. On the server, when a database column is NULL, the server simply doesn't send it. This is causing my VB.NET app to halt (apprently waiting for the element tags that won't be arriving) indefinitely. This happens whether schema is infered or pre-determined-as one would expect. So what is needed is 2-fold: 1. Determine if there is a missing element, and .. 2. Insert an empty element in its place (<thing></thing>). Considering I'm loading the XML as a string, what is the best approach for this? TIA! pat Show quoteHide quote :) Pat,
Afaik is the most simple solution in this, putting the schema in the dataset as you write it. dstest.WriteXml(sw, XmlWriteMode.WriteSchema) I hope this helps, Cor Cor,
Thanks for the reply! I found the best fix to be at the source, rather than dealing with the output on the client. Parsing inbound XML for missing tags would have been too task intensive! Your idea does highlight my next problem, which is how to load schema from anywhere but a .xsd file. I need the running version of the software to NOT have a bunch of .xsd files laying around for folks to mess with! I'll post another thread for that question. Thanks! pat :) Cor Ligthert [MVP] wrote:Show quoteHide quote > Pat, > > Afaik is the most simple solution in this, putting the schema in the dataset > as you write it. > dstest.WriteXml(sw, XmlWriteMode.WriteSchema) > > I hope this helps, > > Cor
Can't modify instance of a class from within the class!
WebBrowser Control Printing creating independant application vb 2005 express edition Regular Expression Question Fastest way to load jpg images ? Access digital camera How to.... Question..... MIDI guitar sheet music player in .net Refresh my memory on datatables, datasets etc. Enum and FlagsAttribute |
|||||||||||||||||||||||