Click here to Skip to main content
15,891,662 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Simple Reports/ RTF output Pin
david@mindplay.com25-Jan-05 11:26
david@mindplay.com25-Jan-05 11:26 
QuestionHow to load data from XML String to tables Pin
Cuu24-Jan-05 6:00
Cuu24-Jan-05 6:00 
GeneralWSE 2.0 security... Pin
Jason Weibel21-Jan-05 10:56
Jason Weibel21-Jan-05 10:56 
Generalxml treeview using dataset Pin
ashushere21-Jan-05 8:17
ashushere21-Jan-05 8:17 
GeneralRe: xml treeview using dataset Pin
DavidNohejl21-Jan-05 12:19
DavidNohejl21-Jan-05 12:19 
GeneralWSE 2.0 - UsernameToken Pin
Jason Weibel20-Jan-05 9:22
Jason Weibel20-Jan-05 9:22 
GeneralRe: WSE 2.0 - UsernameToken Pin
Jason Weibel21-Jan-05 10:02
Jason Weibel21-Jan-05 10:02 
GeneralScheme or no scheme I can not use XmlDocument.LoadXML Pin
Anonymous20-Jan-05 4:11
Anonymous20-Jan-05 4:11 
I can not read a XML file with or without a scheme using XMLDocument.LoadXML() without getting an exception.

Thanks for your suggestions.

Given this XML file name 'simple1.xml'

<?xml version="1.0" encoding="utf-8" ?>
<book>
<title> my books title</title>
</book>

I had hoped to read it in with this code.
string pathfilename = @"C:\XML_Class\Example\ReadWriteFamily\simple1.xml";
try
{
XmlNode currNode;
XmlDocument doc = new XmlDocument();
//The LoadXml statement throws this exception
//"System.Xml.XmlException: The data at the root level is invalid.
//Line 1, position 1.\r\n at System.Xml.XmlTextReader.ParseRoot()\r\n
//at System.Xml.XmlTextReader.Read()\r\n at System.Xml.XmlValidatingReader.ReadWithCollectTextToken()\r\n
//at System.Xml.XmlValidatingReader.Read()\r\n at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)\r\n
//at System.Xml.XmlDocument.Load(XmlReader reader)\r\n at System.Xml.XmlDocument.LoadXml(String xml)\r\n
//at ReadWriteFamily.Form1.ReadSimple1_Click(Object sender, EventArgs e)
//in c:\\xml_class\\example\\readwritefamily\\form1.cs:line 236" string

doc.LoadXml(pathfilename); //exception throw here


XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
docFrag.InnerXml="<title>inserted title</title>" ;
// insert the availability node into the document
currNode = doc.DocumentElement.FirstChild;
currNode.InsertAfter(docFrag, currNode.LastChild);
//save the output to a file
//doc.Save(pathfilename2);
}
catch (Exception eException)
{
string s =eException.ToString();
Console.WriteLine ("Exception: {0}", s);
}

}

}
GeneralRe: Scheme or no scheme I can not use XmlDocument.LoadXML Pin
DavidNohejl20-Jan-05 4:36
DavidNohejl20-Jan-05 4:36 
GeneralRe: Scheme or no scheme I can not use XmlDocument.LoadXML Pin
mcgahanfl20-Jan-05 10:20
mcgahanfl20-Jan-05 10:20 
GeneralHelp please !! transform returns unprintable chars Pin
atmeyer119-Jan-05 11:14
atmeyer119-Jan-05 11:14 
GeneralRe: Help please !! transform returns unprintable chars Pin
DavidNohejl19-Jan-05 12:26
DavidNohejl19-Jan-05 12:26 
GeneralRe: Help please !! transform returns unprintable chars Pin
atmeyer119-Jan-05 12:38
atmeyer119-Jan-05 12:38 
GeneralSchema Validation Pin
cobyjone19-Jan-05 9:45
cobyjone19-Jan-05 9:45 
GeneralRe: Schema Validation Pin
DavidNohejl19-Jan-05 10:06
DavidNohejl19-Jan-05 10:06 
GeneralRe: Schema Validation Pin
cobyjone19-Jan-05 10:16
cobyjone19-Jan-05 10:16 
GeneralRe: Schema Validation Pin
cobyjone19-Jan-05 10:30
cobyjone19-Jan-05 10:30 
GeneralNon-Microsoft XML DOM parser Pin
bowlermonk19-Jan-05 8:52
bowlermonk19-Jan-05 8:52 
GeneralRe: Non-Microsoft XML DOM parser Pin
DavidNohejl19-Jan-05 10:41
DavidNohejl19-Jan-05 10:41 
Generaladfas Pin
Anonymous18-Jan-05 8:32
Anonymous18-Jan-05 8:32 
QuestionHow to get a particular node? Pin
Johny Ng17-Jan-05 16:41
Johny Ng17-Jan-05 16:41 
AnswerRe: How to get a particular node? Pin
DavidNohejl18-Jan-05 1:19
DavidNohejl18-Jan-05 1:19 
Generalhelp with relations tables Pin
kaiowa5117-Jan-05 1:36
kaiowa5117-Jan-05 1:36 
GeneralRe: help with relations tables Pin
DavidNohejl17-Jan-05 6:28
DavidNohejl17-Jan-05 6:28 
GeneralRe: help with relations tables Pin
Anonymous17-Jan-05 20:54
Anonymous17-Jan-05 20:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.