Questions tagged [xmlwriter]

System.Xml.XmlWriter class is part of .NET framework that provides non-cached, forward-only way to generate streams or files that contain XML data.

Documentation:

489 questions
4
votes
1 answer

XmlWriter - Writing xsi:nil=true attribute

I have an issue with an InfoPath 2010 form, that has some code behind it. The purpose of my form is to collect data from a user, and using the answers provided, auto populate a number of required tasks. These tasks are populated in a repeating…
Grant80
  • 61
  • 7
4
votes
1 answer

How to get a Stream from an XMLWriter?

An instance of System.Xml.XmlWriter is writing to an underlying Stream right ?(regardless of what the specific implementation of the XmlWriter is) So how come there are no methods available for a programmer to retrieve the Stream object from the…
K_M
  • 43
  • 1
  • 4
4
votes
2 answers

How to serialize properties with DefaultValueAttribute using XmlSerializer?

I am using XmlSerializer to serialize C# objects to XML. I have DefaultValueAttribute on some of the properties of the classes I am trying to serialize, when I try to serialize them it seems that XmlSerializer does not include value in xml if it…
Mykhailo Seniutovych
  • 3,527
  • 4
  • 28
  • 50
4
votes
3 answers

What's the best way to synchronize XmlWriter access to a file to prevent IOExceptions?

There are multiple places in an application which call XmlWriter.Create on the same file, all accessed through the following function. When one calls while another is still writing, I get an IOException. What's the best way to lock or synchronize…
Jon Galloway
  • 52,327
  • 25
  • 125
  • 193
4
votes
2 answers

How to read/write complex object with XmlWriter/XmlReader

I've been trying to find an easy way to write XML using the XmlReader/XmlWriter. I don't really like using the interface "IXmlSerializable", but I've got no choice for some of my dataclass. Anyway, what I want to do is quite simple: private MyClass…
Sauleil
  • 2,573
  • 1
  • 24
  • 27
4
votes
3 answers

Server A using xmlreader to read XML from xmlwriter on server B

I have two servers Server A reads http://www.some-url.com/xmlwriter_src.php using $reader = new XMLReader(); $reader->open('http://www.some-url.com/xmlwriter_src.php'); while ($reader->read()) { /* -- do something -- */ } Server B creates an…
user326096
  • 307
  • 1
  • 4
  • 11
4
votes
4 answers

(C#) How to modify attribute's value in the existing XML file without loading or rewriting the whole file?

I'm making some huge XML files (several GB) with the help of XmlWriter and Linq2Xml. This files are of type: .... .. ..
I don't know values…
4
votes
2 answers

The type name 'Create' doesn't exist in the type XmlWriter

I'm trying to write an Xml program on Visual Studio 2017 and have error on: using System.Xml; ... XmlWriter.Create("C:\\myxmlfile.xml", settings); With this message: The type name 'Create' doesn't exist in the type XmlWriter. I suspect that…
Mojee KD
  • 181
  • 1
  • 12
4
votes
2 answers

XML writer XML output

I'm working on a PostgreSQL to XML converter. Which should extract the values of different Tables. The relevant code below: $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->startDocument(); …
pguetschow
  • 5,176
  • 6
  • 32
  • 45
4
votes
3 answers

Best approach to write huge xml data to file?

I'm currently exporting a database table with huge data (100000+ records) into an xml file using XmlTextWriter class and I'm writing directly to a file on the physical drive. _XmlTextWriterObject = new XmlTextWriter(_xmlFilePath, null); While my…
Kayes
  • 1,016
  • 3
  • 15
  • 22
4
votes
1 answer

The ':' character, hexadecimal value 0x3A, cannot be included in a name."}

I'm using VS2010, C#, .net, and xmlWriter to create xml documents to HL7 CAT-1 specification. There is an attribute, 'sdtc:ValueSet' that must be created in the document. I am unable to write this attribute name, due to invalid character ":". …
Ken3141
  • 41
  • 1
  • 3
4
votes
1 answer

What's the path to the document cursor?

I'm using System.Xml.XmlTextReader the forward-only reader. When debugging, at any time I can check the properties LineNumber and LinePosition to see the line number and column number of the cursor. Is there any way I can see any kind of "path" to…
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
4
votes
1 answer

Overwriting root element in syndicationfeed, Adding namespaces to root element

I need to add new namespaces to the rss(root) element of my feed, in addition to a10: . . . I am using a SyndicationFeed class serialized to RSS 2.0 and I use a XmlWriter to…
Amin
  • 73
  • 1
  • 7
4
votes
2 answers

ImportError: No module named elementtree.SimpleXMLWriter

In my python code I am trying to display the output in a XML format.For this purpose I am using XMLwriter. But it is showing error: Traceback (most recent call last): File "C:\Users\Ponmani\Desktop\test.cgi", line 8, in from…
prakash .k
  • 635
  • 2
  • 12
  • 24
4
votes
5 answers

VB.NET XMLWriter: How to change what's in the header?

I have a requirement to make an XML file - and the partner is rather sticky about the header. Apparently, the header must be exactly this: But whenever I create an XML file I get extraneous properties like this:
Kyle
  • 963
  • 3
  • 16
  • 32