Questions tagged [xmltextwriter]

Represents a writer that provides a fast, non-cached, forward-only way of generating streams

Represents a writer that provides a fast, non-cached, forward-only way of generating streams or files containing XML data that conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.

http://msdn.microsoft.com/en-us/library/system.xml.xmltextwriter%28v=vs.110%29.aspx

120 questions
0
votes
0 answers

How can I reset XmlTextWriter.WriteValue after it fails to write

In certain conditions that I cannot predict the following expression that uses a XmlTextWriter writer.WriteValue(value) throws an ArgumentException because the data does contain invalid XML characters. When the Exception is thrown I can fix the XML…
Andrea Nagar
  • 1,233
  • 2
  • 13
  • 23
0
votes
1 answer

refactoring question

Given a method public static string[] Foo(System.IO.Stream stream) { XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII); xmlWriter.WriteStartDocument(); …
sympatric greg
  • 2,969
  • 2
  • 24
  • 29
0
votes
1 answer

Token StartElement in state Epilog would result in an invalid XML document

I am getting the error "Token StartElement in state Epilog would result in an invalid XML document." when i get the data from datatable and try to convery it to xml file . Code : DataTable dtTest = new…
ABCD
  • 379
  • 1
  • 8
  • 25
0
votes
1 answer

Is there a way to have XmlTextWriter not write redundant name spaces

I am writing out all of my nodes and the XML I get is this:
David Thielen
  • 28,723
  • 34
  • 119
  • 193
0
votes
1 answer

In .NET how can I write an XmlElement to an XmlTextWriter, where the element may have children

Is there an easy (single call) way in .NET to write an XmlElement to a XmlTextWriter where that element is written out in full to the output? Where the XmlElement may have many child elements and they have children, etc. And where it explicitly adds…
David Thielen
  • 28,723
  • 34
  • 119
  • 193
0
votes
2 answers

Why is chevron being encoded differently when I use XmlTextWriter class?

Seem to have some funny behaviour going on when I call the XMLTextWriter... XmlTextWriter writer = new XmlTextWriter(targetFileName, Encoding.UTF8); writer.WriteValue("< ?xml version=\"1.0\"…
Exitos
  • 29,230
  • 38
  • 123
  • 178
0
votes
2 answers

continue writing on same XML file without deleting in c#

I have done this code so far works well, but the only issue is that the XML file gets deleted every time I use the method addUser, I want the code to continue writing under it the code I wrote in c#: public static void AddUser(PersonData pd) …
Majd Sadi
  • 49
  • 7
0
votes
2 answers

which format of XmlTextWriter for answer xmlhttprequest

for answer a xmlhttprequest in .ashx file with xml that created with XmlTextWriter class how I must Outputting it ? to a file/string/memory ?
biglibigli
  • 59
  • 3
  • 8
0
votes
1 answer

how can i make xml for myXMLHttpRequest.responseXML with XmlTextWriter in .ashx

i try it in my .ashx page but i got error 500 in myXMLHttpRequest.status and i can't understand where is the problem. a simple code for generate a simple xml would be very good. like:
812 Gwyn Ave
biglibigli
  • 59
  • 3
  • 8
0
votes
1 answer

Nest xmlDoc into existing xmlTextWriter

I think I'm missing something trivial but I'm losing a bunch of time on this, so its solution may be useful to others too: I'm working with libxml2 2.9.8 (pure C, not C++ bindings) under linux. I have an external (non-libxml) tree structure…
Zoten
  • 3
  • 5
0
votes
2 answers

Skip item if null for xml text writer

I have Windows form C# application that takes values from the GUI and uses XML Textwriter to create an XML file from them. The problem is some of these values are meant to be optional and when the user leaves them blank, the application gets a null…
0
votes
1 answer

Copy fragment from XmlTextReader using XmlTextWriter

As I read an XML file using XmlTextReader, I sometimes need to save off a node, and it's children. I do this using XmlTextWriter (I'm not married to this approach). The problem is XmlTextReader is aware of a bunch of namespaces that this fragment…
David Thielen
  • 28,723
  • 34
  • 119
  • 193
0
votes
1 answer

how to append element to xml document dynamically?

As per following code I have created xml file and writing on it iteratively. But the problem is it is overwriting on the file. I want to append new element to file, here the foreach is iteratively writing contents of wrobj to xml, but again…
0
votes
2 answers

XmlTextWriter not working in my VB .ASP page Literal

I'm getting the error below when I try usign the XmlTextWriter in my VB aspx page Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and…
William Calleja
  • 4,055
  • 11
  • 41
  • 51
0
votes
1 answer

C# Ashx Google xml sitemap generation error

I'm using a ashx to deliver my websites sitemap for Google. Its all worked perfectly until I recently. When requesting the sitemap in Google at http://www.naughtyfancydress.com/sitemap.ashx I get: XML Parsing Error: not well-formed Location:…
asn1981
  • 237
  • 1
  • 7
  • 20