471,610 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Best approach to splitting 1 file containing multiple xml docs

Hi

I'm faced with the situation where I could have a single physical file that
could contain multiplie XML documents e.g

file.txt contains the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE doc SYSTEM "1.0b.dtd">
<doc transmission-date="20050715T154340Z" >
<blah seq="6289" xml:lang="en-us" >
stuff here
</blah>
</doc>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE doc SYSTEM "1.0b.dtd">
<doc transmission-date="20050715T154340Z" >
<blah seq="6289" xml:lang="en-us" >
stuff here
</blah>
</doc>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE doc SYSTEM "1.0b.dtd">
<doc transmission-date="20050715T154340Z" >
<blah seq="6289" xml:lang="en-us" >
stuff here
</blah>
</doc>

Does anybody have any good advice on the best way to load, split and parse
the xml documents using c#?

Thanks
Nov 12 '05 #1
1 1600
Hi Andy,

You can use StreamReader to read the .txt file, and StreamWriter to split/write them into multiple xml docs.

Here're the documentation and examples:
http://msdn.microsoft.com/library/en...asp?frame=true
http://msdn.microsoft.com/library/en...asp?frame=true

-- Yingzi

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
--------------------
Thread-Topic: Best approach to splitting 1 file containing multiple xml docs
thread-index: AcWMPXQLaV/VXze8RaKFhbKoLj9lfg==
X-WBNR-Posting-Host: 212.187.154.100
From: =?Utf-8?B?QW5keSBCcml0Y2xpZmZl?= <An************@discussions.microsoft.com>
Subject: Best approach to splitting 1 file containing multiple xml docs
Date: Tue, 19 Jul 2005 01:40:02 -0700
Lines: 33
Message-ID: <09**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.xml
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.xml:7771
X-Tomcat-NG: microsoft.public.dotnet.xml

Hi

I'm faced with the situation where I could have a single physical file that
could contain multiplie XML documents e.g

file.txt contains the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE doc SYSTEM "1.0b.dtd">
<doc transmission-date="20050715T154340Z" >
<blah seq="6289" xml:lang="en-us" >
stuff here
</blah>
</doc>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE doc SYSTEM "1.0b.dtd">
<doc transmission-date="20050715T154340Z" >
<blah seq="6289" xml:lang="en-us" >
stuff here
</blah>
</doc>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE doc SYSTEM "1.0b.dtd">
<doc transmission-date="20050715T154340Z" >
<blah seq="6289" xml:lang="en-us" >
stuff here
</blah>
</doc>

Does anybody have any good advice on the best way to load, split and parse
the xml documents using c#?

Thanks


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

136 posts views Thread by Matt Kruse | last post: by
5 posts views Thread by moumou | last post: by
1 post views Thread by Nelson Smith | last post: by
15 posts views Thread by Rob Meade | last post: by
13 posts views Thread by processoriented | last post: by
4 posts views Thread by Alvin SIU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

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.