.NETGURU
XML doc and FileStream
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngxml' list.


Andrew Munro
-- Moved from [aspngfreeforall] to [aspngxml] by Rachel Reese <Click here to reveal e-mail address> --

Hi,
i've loaded an xml doc using filestream and modified some of its elements,
now i need to load another document using another filestream and concatenate
the second stream on to the first stream as an additional element of the
modified xml doc.

Any suggestions and cheers in advance

Reply to this message...
 
    
Dan Wahlin
You won't be able to concatenate the streams because you'd have two root
elements as a result and the XML wouldn't be well-formed. So, I'm
guessing you just want to import the second document and "merge" it into
the first document. You can do that using the ImportNode() method of
the XmlDocument object. You'll find a complete example here:

http://www.xmlforasp.net/codeSection.aspx?csID=8

HTH,
Dan Wahlin

Wahlin Consulting LLC
Microsoft MVP - ASP.NET
http://www.XMLforASP.NET
XML for ASP.NET Developers by Dan Wahlin in bookstores everywhere!

-----Original Message-----
From: Andrew Munro [mailto:Click here to reveal e-mail address]
Sent: Thursday, June 27, 2002 4:15 AM
To: aspngxml
Subject: [aspngxml] XML doc and FileStream

-- Moved from [aspngfreeforall] to [aspngxml] by Rachel Reese
<Click here to reveal e-mail address> --

Hi,
i've loaded an xml doc using filestream and modified some of its
elements,
now i need to load another document using another filestream and
concatenate
the second stream on to the first stream as an additional element of
the
modified xml doc.

Any suggestions and cheers in advance
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 06/20/2002

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 06/20/2002

Reply to this message...
 
    
Andrew Munro
please ignore this i managed it

-----Original Message-----
From: Andrew Munro [mailto:Click here to reveal e-mail address]
Sent: 27 June 2002 12:15
To: aspngxml
Subject: [aspngxml] XML doc and FileStream

-- Moved from [aspngfreeforall] to [aspngxml] by Rachel Reese
<Click here to reveal e-mail address> --

Hi,
i've loaded an xml doc using filestream and modified some of its elements,
now i need to load another document using another filestream and concatenate
the second stream on to the first stream as an additional element of the
modified xml doc.

Any suggestions and cheers in advance
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Andrew Munro
i managed it with the following

StreamReader sr = File.OpenText(FILE_NAME);
            string input;
            XmlElement eCert = doc.CreateElement("myElem");
            while ((input=sr.ReadLine())!=null)
            {
                //Response.Write(input);
                XmlText tCert = doc.CreateTextNode(input);
                eCert.AppendChild(tCert);
            }
            doc.DocumentElement.AppendChild(eCert);
            sr.Close();

but cheers for the response anyway

-----Original Message-----
From: Dan Wahlin [mailto:Click here to reveal e-mail address]
Sent: 27 June 2002 16:47
To: aspngxml
Subject: [aspngxml] RE: XML doc and FileStream

You won't be able to concatenate the streams because you'd have two root
elements as a result and the XML wouldn't be well-formed. So, I'm
guessing you just want to import the second document and "merge" it into
the first document. You can do that using the ImportNode() method of
the XmlDocument object. You'll find a complete example here:

http://www.xmlforasp.net/codeSection.aspx?csID=8

HTH,
Dan Wahlin

Wahlin Consulting LLC
Microsoft MVP - ASP.NET
http://www.XMLforASP.NET
XML for ASP.NET Developers by Dan Wahlin in bookstores everywhere!

-----Original Message-----
From: Andrew Munro [mailto:Click here to reveal e-mail address]
Sent: Thursday, June 27, 2002 4:15 AM
To: aspngxml
Subject: [aspngxml] XML doc and FileStream

-- Moved from [aspngfreeforall] to [aspngxml] by Rachel Reese
<Click here to reveal e-mail address> --

Hi,
i've loaded an xml doc using filestream and modified some of its
elements,
now i need to load another document using another filestream and
concatenate
the second stream on to the first stream as an additional element of
the
modified xml doc.

Any suggestions and cheers in advance
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 06/20/2002

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 06/20/2002

| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.IO.File
System.IO.FileStream
System.IO.StreamReader
System.Xml.XmlDocument
System.Xml.XmlElement
System.Xml.XmlText




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification