473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Transforming to an XmlWriter

The following blog gives a neat example of how to transform directly into a
node:

http://blogs.msdn.com/xmlteam/

However, the code doesn't seem to work as it is presented in the blog. I
have put together the following three test cases to show this. The first two
work correctly, the last one doesn't. BTW...the last one is codes according
to the blog entry.

------------------------------

System.Xml.Xsl.XslCompiledTransform xslt = new
System.Xml.Xsl.XslCompiledTransform();
System.Xml.XmlDocument OutputDoc = null;
System.Xml.XmlWriter w = null;
xslt.Load(@"test.xslt");

OutputDoc = new System.Xml.XmlDocument();
using (w = OutputDoc.CreateNavigator().AppendChild()) {
xslt.Transform(@"test.xml", null, w);
}
OutputDoc.Save(@"out1.xml");

OutputDoc = new System.Xml.XmlDocument();
w = OutputDoc.CreateNavigator().AppendChild();
xslt.Transform(@"test.xml", null, w);
w.Flush();
w.Close();
OutputDoc.Save(@"out2.xml");

OutputDoc = new System.Xml.XmlDocument();
xslt.Transform(@"test.xml", null,
OutputDoc.CreateNavigator().AppendChild());
OutputDoc.Save(@"out3.xml");
Nov 15 '05 #1
0 1129

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sergio Otoya | last post by:
Hi all, I need to transform an xml document, using xsl to a HTML output. I can do this successfully using the XslTransform class as below: Dim oTrans As New XslTransform ...
3
by: Michael Malinak | last post by:
Since XmlWriter offers so many nice options for formatting, I thought it would be nice to read in via XmlReader, and write back out via XmlWriter. It might be overkill, but I'd also like to be able...
1
by: jschell | last post by:
The following two cases behave differently in Net 2.0. The Case_Create_StringWriter throws an exception while the Case_XmlTextWriter does not. Is there a problem with this code? Or is this a...
2
by: Harry | last post by:
Hi, I am using XMLWriter to build xml and I need to build the element below. How do I do this? <Password format="encrypted">password</Password> Thanks
5
by: Gustaf | last post by:
I've been trying to update my code to the new XslCompiledTransform class without success. The following method takes an XML and XSL file, and returns an XmlDocument object. Can anyone figure out...
0
by: Janusz Nykiel | last post by:
I've stumbled upon unexpected behavior of the .NET 2.0 System.Xml.XmlWriter class when using it to write data to a binary stream (System.IO.Stream). If the amount of data is less than a certain...
1
by: MAF | last post by:
Is there a simple way to get the text, xml, from an xmlwriter. I have a XML writer that writes to a file, and I want another function to return the text that the xml writer is produced. Any...
2
by: darrel | last post by:
I want to make my XML as such: <parentItem> <childItem attribute="myAttribute">myContent</childItem> </parentItem> I thought I could just do this: ...
9
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a .net application and am using the xml writer class to create an xml file that opens as an excel file. I am trying to write out the following but am having difficulty. <Row> <Cell...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.