473,662 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple XmlDocument OuterXml UTF8 Question

When you do this:

public void someMethod(Xmld ocument xml)
{
XmlDocument localxml = new XmlDocument();
localxml.LoadXm l(xml.OuterXml) ;
}

Are you getting all the data in localxml? I want to send binary data
such as a Microsoft word doc embedded in my xml document. I have
tried this and it is fine and can retrieve it on the other side.
However, I am using OuterXml all over the place to copy from one
document to another. I know I won't get default attributes, but
that's okay. But, again do I need to specify some sort of encoding?

Thanks in advance.

Adam Smith
Nov 12 '05 #1
1 4627
How about using the following instead to avoid the expensive parsing step
all together:
foreach (XmlNode child in xml.ChildNodes) {
localxml.Append Child(localxml. ImportNode(chil d, true));
}
"Adam Smith" <ad*********@ho tmail.com> wrote in message
news:cd******** *************** ***@posting.goo gle.com...
When you do this:

public void someMethod(Xmld ocument xml)
{
XmlDocument localxml = new XmlDocument();
localxml.LoadXm l(xml.OuterXml) ;
}

Are you getting all the data in localxml? I want to send binary data
such as a Microsoft word doc embedded in my xml document. I have
tried this and it is fine and can retrieve it on the other side.
However, I am using OuterXml all over the place to copy from one
document to another. I know I won't get default attributes, but
that's okay. But, again do I need to specify some sort of encoding?

Thanks in advance.

Adam Smith

Nov 12 '05 #2

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

Similar topics

6
7351
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents written to the output stream. We are willing to pay $ to any expert (e.g. MVP) consultant who has to time to help us track down this problem. (we will discuss rates if you can prove your expertise, and problem solving approach).
1
17125
by: Martin Honnen | last post by:
With both .NET 1.0 and 1.1 I have found the following strange behaviour where System.Xml.XmlDocument.LoadXml doesn't throw an error when parsing a text node with a character reference to an invalid characters like &#x1;. Using the CreateTextNode method I create a text node containing "\u0001a" (C# string literal notation). As far as I understand the DOM allows that and an implementation is not required to throw an error. When OuterXml is...
7
5484
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned that an xpath expression can be bounded by either single or double quotation marks. But sometimes I want to search for a title containing both a single and double quote. Any way to do this?
2
6031
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public XmlDocument TransformXmlDoc(XmlDocument docToTransform, string xsltFilePath) { //load the xslt
7
4895
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: Value of type System.xml.xmldocument cannot be converted to System.IO.textreader. I would think this is possible to do. Code snippet is below:
5
1602
by: Bob P | last post by:
I have an example below that is not working correctly. I have a web application that passes a System.Xml.XmlDocument object "oInputDoc" around to functions byval. I do not want the "oInputDoc" object to change when it is passed into "myFunction". I want to use the data in the object, modify it "myFunction" and then pass it out as an "oOutputDoc". On the way back out of the function, the "oInputDoc" is being changed by ..net, not sure why...
3
1264
by: Milsnips | last post by:
hi there, i am currently using the following code to generate an XML object, then save it, then read the contents of the file - but i dont wanna save it, instead read it directly after i;ve created the object.. see below: ------------------------------ Dim w As New XmlTextWriter(Server.MapPath(".") & "\suppliers.xml", System.Text.Encoding.UTF8) w.Formatting = Formatting.Indented w.WriteStartDocument()
1
1289
by: needin4mation | last post by:
Hi, please consider this snippet: string filename "c:\\inetpub\\wwwroot\\getdirections\\Directions.xml"; XmlDocument doc = new XmlDocument(); doc.Load(filename); XmlNodeList authorList = doc.SelectNodes("/NewDataSet/location"); StreamWriter writer = new StreamWriter(); foreach( XmlNode authorNode in authorList ) {
0
1041
by: nano2k | last post by:
Hi Is it possible to find out the output size of an XmlDocument object? I mean, a good-enough approach is this: XmlDocument doc = new XmlDocument(); // load data in doc int length = doc.OuterXml.Length; 1.Advantages: 1.1. It's an approximate value, but the approximation is very good, so I put this as an advantage
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.