473,402 Members | 2,061 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,402 software developers and data experts.

Merging XML Documents XmlTextReader against XmlDocument

I wrote some code to save layout of forms in my application to an XML File.
One of the forms has a control which can emit its own layout in the form of
XML....so for this controls, I obviously just want to dump the configuration
from the Control right into a sub node of the control node....crude example
<Form>
<Controls>
<Control Name="MyControl1">
<--- insert controls xml output here.
</Control>
</Controls>
</Form>

So....what I did was wrote the output to an XmlTextWriter with a
StringWriter base....then loaded an XmlTextReader with the StringWiter's
StringBuilder.ToString();

Now that I have a filled reader...I am reading through the object and
appending child nodes to the current control node. AKA
controlNode.AppendChild(doc.CreateElement(reader.N ame))

And I have additional code to figure out where the child nodes go....but its
kind of messy and I think there is a much easier way to do this....can
anyone point me in the right direction? A bit of a noob on programmatic xml
generation.

Thanks,

dec
Nov 12 '05 #1
2 1770
decrypted wrote:
I wrote some code to save layout of forms in my application to an XML File.
One of the forms has a control which can emit its own layout in the form of
XML....so for this controls, I obviously just want to dump the configuration
from the Control right into a sub node of the control node....crude example
<Form>
<Controls>
<Control Name="MyControl1">
<--- insert controls xml output here.
</Control>
</Controls>
</Form>

So....what I did was wrote the output to an XmlTextWriter with a
StringWriter base....then loaded an XmlTextReader with the StringWiter's
StringBuilder.ToString();


So why don't you write that xml data at the first step - along with
writing to XmlTextWriter?

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
decrypted wrote:
I wrote some code to save layout of forms in my application to an XML File.
One of the forms has a control which can emit its own layout in the form of
XML....so for this controls, I obviously just want to dump the configuration
from the Control right into a sub node of the control node....crude example
<Form>
<Controls>
<Control Name="MyControl1">
<--- insert controls xml output here.
</Control>
</Controls>
</Form>

So....what I did was wrote the output to an XmlTextWriter with a
StringWriter base....then loaded an XmlTextReader with the StringWiter's
StringBuilder.ToString();


So why don't you write that xml data at the first step - along with
writing to XmlTextWriter?

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #3

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

Similar topics

4
by: Andy Neilson | last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This...
0
by: decrypted | last post by:
I wrote some code to save layout of forms in my application to an XML File. One of the forms has a control which can emit its own layout in the form of XML....so for this controls, I obviously just...
2
by: Joris Janssens | last post by:
I'm trying to write a program for validating XHTML 1.1-documents against the XHTML 1.1 DTD (which is actually the same as validating an XML-file) but I always get a "(404) Not found" error. This...
5
by: Geoff Bennett | last post by:
While parsing an XML document, my TextReader instance skips nodes. For example, in this fragment: <Person Sex="Male" FirstHomeBuyer="No" YearsInCurrentProfession="14"> <RelatedEntityRef...
7
by: SQLScott | last post by:
I have a Web Service in which I am trying to pass an XMLDocument as a parameter to one of the methods. I would like to use the XMLTextReader to read the XML but I am getting the following error: ...
1
by: soupaman | last post by:
Im trying to output some filtered xml using the xmlTextReader I know the code and commenting needs cleaned up and eventually plan to add the values to a dataset. currently what this is doing is...
3
by: Patrick | last post by:
I have got 2 XML documents, both of which conform to the same XSD Schema, which define possible optional elements. The 2 XML documents contain 2 disjoint set of XML elements. What is the best,...
1
by: Ryan | last post by:
I was easily able to merge 2 XML files using the guide at http://support.microsoft.com/kb/311530/EN-US/. However, the two XML files may contain duplicate tags. Is there an easy way to merge so that...
17
by: Slonocode | last post by:
Is there any relation between the NodeType and the Text when using the XmlTextReader? The documentation uses select/case while using the xmltextreader. While reader.Read() Select Case...
2
by: josh | last post by:
Hi, I am trying to validate cXML documents against cXML.dtd using the XmlValidatingReader. If I set the XMLValidatingReader's ValidatingType to ValidationType.DTD, I get the following...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.