Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / November 2003

Tip: Looking for answers? Try searching our database.

Transformation problems...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew Connell - 26 Nov 2003 18:26 GMT
I have an XML document and an XSLT transformation sheet.  My first issue is that my XML file won't load into the XPathDocument object.  However, when I use an obsolete transformation method where I specify the XML input file and output file, I get the same error.  The error is:

An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll
Additional information: System error.

Here's my code... commented to show where the errors are...
//XmlDocument xmlDoc = new XmlDocument();
XslTransform xslDoc = new XslTransform();

// ++++++ IF I UNCOMMENT THIS, THE FILE LOADS JUST FINE
//xmlDoc.Load(this.xmlFilePath.Text);
//xmlDoc.Save(@"c:\temp\xml.xml");

xslDoc.Load(this.xslFilePath.Text, null);

// +++++ ERROR HAPPENS HERE...
XPathDocument xpathdocument = new XPathDocument(@"C:\Temp\xml.xml");

XmlTextWriter writer = new XmlTextWriter(@"C:\temp\output.html", System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;// never reaches this part
xslDoc.Transform(xpathdocument, null, writer, null);
// +++++ IF I CHANGE THIS TO THE FOLLWOING, I GET THE SAME ERROR:
xslDoc.Transform(@"c:\temp\xml.xml", @"c:\temp\output.html");
Dare Obasanjo [MSFT] - 27 Nov 2003 03:20 GMT
Why don't you catch the exception and print it out to see what the error is? It looks like there is an error in your file.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
 I have an XML document and an XSLT transformation sheet.  My first issue is that my XML file won't load into the XPathDocument object.  However, when I use an obsolete transformation method where I specify the XML input file and output file, I get the same error.  The error is:

 An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll
 Additional information: System error.

 Here's my code... commented to show where the errors are...
//XmlDocument xmlDoc = new XmlDocument();
XslTransform xslDoc = new XslTransform();

// ++++++ IF I UNCOMMENT THIS, THE FILE LOADS JUST FINE
//xmlDoc.Load(this.xmlFilePath.Text);
//xmlDoc.Save(@"c:\temp\xml.xml");

xslDoc.Load(this.xslFilePath.Text, null);

// +++++ ERROR HAPPENS HERE...
XPathDocument xpathdocument = new XPathDocument(@"C:\Temp\xml.xml");

XmlTextWriter writer = new XmlTextWriter(@"C:\temp\output.html", System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;// never reaches this part
xslDoc.Transform(xpathdocument, null, writer, null);
// +++++ IF I CHANGE THIS TO THE FOLLWOING, I GET THE SAME ERROR:
xslDoc.Transform(@"c:\temp\xml.xml", @"c:\temp\output.html");

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.