C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 08-23-2006, 02:09 PM   #1
Registered User
 
Joelito's Avatar
 
Join Date: Mar 2005
Location: Tijuana, BC, México
Posts: 282
XmlTextWriter

Code:
//
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Xml;
//
pDoc = new XmlDocument();
		XmlProcessingInstruction pPI = pDoc.CreateProcessingInstruction("xml", "version='1.0' encoding='ISO-8859-1'");
		pDoc.AppendChild(pPI);
		XmlTextWriter writer = new XmlTextWriter("boop.xml", null);
		writer.Formatting = Formatting.Indented;
		pDoc.Save(writer);
		writer.Flush();
Why the above code generates an error of XmlTextWriter?
__________________

* Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM
* Kubuntu 9.10; Kernel 2.6.31-14-generic.
* lighttpd: php5, perl, eruby and python.
* Codeblocks & geany: HTML & CSS & JavaScript, Gtk+, QT4, wxWidgets, bash, openjdk.
* Coming soon: Kubuntu 10.04 or Debian 6.0.
Joelito is offline   Reply With Quote
Old 08-24-2006, 10:02 AM   #2
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
What error?

(The reason is that the XML declaration is not a processing instruction. Read the XML spec.)
But when you get an error, you should still post it.
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Old 08-24-2006, 05:34 PM   #3
Registered User
 
Joelito's Avatar
 
Join Date: Mar 2005
Location: Tijuana, BC, México
Posts: 282
Thanks... i read some tutos and seems that main error is that I don't have a root element.
Fixed

I would post the error, but I have the .NET SDK in spanish and the debugger dumps all in spanish.
__________________

* Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM
* Kubuntu 9.10; Kernel 2.6.31-14-generic.
* lighttpd: php5, perl, eruby and python.
* Codeblocks & geany: HTML & CSS & JavaScript, Gtk+, QT4, wxWidgets, bash, openjdk.
* Coming soon: Kubuntu 10.04 or Debian 6.0.
Joelito is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 02:14 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22