473,394 Members | 1,781 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,394 software developers and data experts.

Line Feed XML File

I am using SqlXmlCommandType component to generate an XML file in a VB.net
Console Application. Everything ran perfect except one thing. I need to know
if there is anyway to make this XML file Line feed file. In other words, I
need to put each tag in one line instead of mixing them up.

Do I have to create an XSL file to do this transformation, or there is
another way on the .net framework to do it?
Nov 12 '05 #1
3 2838
Nader Shahin wrote:
I am using SqlXmlCommandType component to generate an XML file in a VB.net
Console Application. Everything ran perfect except one thing. I need to know
if there is anyway to make this XML file Line feed file. In other words, I
need to put each tag in one line instead of mixing them up.
Why do you need this? Every compilant XML parser shouldn't have any
problems with even all XML in one line.

Do I have to create an XSL file to do this transformation, or there is
another way on the .net framework to do it?


The simplest way I know is inheriting a custom class from XmlTextWriter
and overwrite the Write.. Methods to add an '\n' to every written token.
(for example in public override WriteEndElement(){
base.WriteEndElement(); ...Write('\n'); })

Maybe indentation can also help you? It is not exactly what you
described but...

--
Pascal Schmitt
Nov 12 '05 #2
I know that Every XML parser doesn't have any problems with this, but it's
required in my project.

I know that i can do it by XmlTextWriter but i don't need to write one by one.
This is why i used "ExecuteToStream" so i don't need to worry about each
element.

So I was thinking if i can create an XSL transformer i can solve this
problem but i am not sure if this is the right way or i can find something in
the .net can help.

"Pascal Schmitt" wrote:
Nader Shahin wrote:
I am using SqlXmlCommandType component to generate an XML file in a VB.net
Console Application. Everything ran perfect except one thing. I need to know
if there is anyway to make this XML file Line feed file. In other words, I
need to put each tag in one line instead of mixing them up.


Why do you need this? Every compilant XML parser shouldn't have any
problems with even all XML in one line.

Do I have to create an XSL file to do this transformation, or there is
another way on the .net framework to do it?


The simplest way I know is inheriting a custom class from XmlTextWriter
and overwrite the Write.. Methods to add an '\n' to every written token.
(for example in public override WriteEndElement(){
base.WriteEndElement(); ...Write('\n'); })

Maybe indentation can also help you? It is not exactly what you
described but...

--
Pascal Schmitt

Nov 12 '05 #3
Yes, there are ways you can use .Net Methods to format your XML file or use XSl for your specific problem. If you are using an XMLTextWriter to generate the XML just set the Formatting property of the writer to Formatting.Indented

MyXmlTextWriter.Formatting = Formatting.Indented;

you can also set the number of characters per indentation by setting the indentation property to an int value corresponding to the number of characters. I think this will take care of your needs. We can discuss more on several other possibilities if you have any other specific queries on this.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 12 '05 #4

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

Similar topics

6
by: Andrew | last post by:
I have created a program that downloads a web page and then performs some text processing on it . The problem is in the text processing , every line (in the downloaded txt file ) ends with a...
3
by: David N. | last post by:
Hi All, I spent too much time on trying to get the CrLf into a string, which contains embedded SQL statements that can be executed by the SQLClient.SqlCommand. Note that these SQL statements...
5
by: james | last post by:
I'm using "FILE" function to write an array in a file and in this way I see that when is present a line feed (10) the function automatically insert a carriage return(13). This cause an error when i...
5
by: Lyle A. Sieren | last post by:
I posted this earlier with another question but did not explain myself well... How do get a line feed character on the end of a line using the streamwriter.writeline fuction? Following are a list...
4
by: Carsten | last post by:
Hello, on my website I'm using the Drupal CMS. But I have a problem. All the output which is generated doesn't start at the first line (when you look at the source). All output starts at the...
6
by: Stick | last post by:
Hi, I am trying to start my email app (in this case Eudora) with a programatically generated email. However, Eudora does not seem to recognize any of the ways I have tried to create line...
12
by: Seller | last post by:
I am using Wordpress 2.0.6 on Fedora Core 5. An RSS feed is not working for http://survivalofthesickestthebook.com/blog/?feed=rss2 When I use feed validator...
13
by: charliefortune | last post by:
I am fetching some product feeds with PHP like this $merch = substr($key,1); $feed = file_get_contents($_POST); $fp = fopen("./feeds/feed".$merch.".txt","w+"); fwrite ($fp,$feed); fclose...
1
by: Nalaka | last post by:
Hi, We are sending SMS messages using our ASDP.net site (C# code).... How do I add a "Line Feed" character to the string that we are sending? Any help is deeply appreciated Thanks Nalaka
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.