Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting header info into my xml string
Message
De
01/05/2006 12:52:36
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
XML
Divers
Thread ID:
01118077
Message ID:
01118091
Vues:
20
>I am passing a ds to a GenXML function, and it's fine.
>
>private string GenXMLOut(DataSet ds)
> {
>
> StringWriter stringWriter = new StringWriter();
> XmlTextWriter W = new XmlTextWriter(stringWriter);
>
> //Use indentation for readability.
> W.Formatting = Formatting.Indented;
> W.Indentation = 4;
>
> W.WriteStartDocument();
> // now fill in the tables / rows / columns
> for (int t = 0; t < ds.Tables.Count; t++)
> {
> > }
> W.Flush();
> return stringWriter.ToString();
> }
>
>I need to add this schema text in line #2 of said string.
>
>bracket here { ExpiredRecurringItemList xmlns ="https://secure.electracash.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>bla bla bla
>
>Where can fetch that from? Or how do I pass in double quotes in C# in a string?
>
>TIA
>
>__Stephen

Stephen,

It looks like you are creating an XML file from the data in a dataset. There is a built-in method to do this using an XmlDataDocument object. You can pass a dataset in the constructor and then use the Save method to write the data to an XML file.

So instead of hard-coding the exact formatting of the file, you would accomplish the same thing by applying attributes to the dataset schema (the XSD file).

To use double-quotes inside of a C# string literal, type \".
// Double quotes
ns = "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform