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

Binary data in XmlNode?

How can I read binary data, specifically a microsoft word document into an XmlNode?

Thanks in advance.

Adam Smith
Nov 11 '05 #1
7 3586
Read in the File by whatever means you wish and then use

Convert.ToBase64String(byte[] here)

and Append that to the InnerText of the node you wish.

Public Function ReadFileAsByteArray(ByVal path As String) As Byte()
Dim fs As New System.IO.FileStream(path, IO.FileMode.Open,
IO.FileAccess.Read, IO.FileShare.Read)
Dim by(Convert.ToInt32(fs.Length - 1)) As Byte
fs.Read(by, 0, by.Length)
fs.Close()
Return by
End Function

is a basis for converting a file to a byte array.

Joe Feser

"Adam Smith" <ad*********@hotmail.com> wrote in message
news:cd**************************@posting.google.c om...
How can I read binary data, specifically a microsoft word document into an XmlNode?
Thanks in advance.

Adam Smith

Nov 11 '05 #2
Thanks for the quick response.

Additionally, how would I read the data back from the XmlNode so that I
could write it to an output file.

Thanks.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #3
You would have to do a Convert.FromBase64String

and take the byte array and do whatever you want with it.

open a file and perform a Write.

Joe Feser

"Adam Smith" <ad*********@hotmail.com> wrote in message
news:O%****************@tk2msftngp13.phx.gbl...
Thanks for the quick response.

Additionally, how would I read the data back from the XmlNode so that I
could write it to an output file.

Thanks.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 11 '05 #4
This is really cool. Thanks a million. Read in a doc from database,
posted it in a SOAP xmlnode to a webservice and wrote it back out.

Thanks again.

Adam Rabin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #5
"Adam Smith" <ad*********@hotmail.com> wrote in message
news:Oa****************@TK2MSFTNGP09.phx.gbl...
This is really cool. Thanks a million. Read in a doc from database,
posted it in a SOAP xmlnode to a webservice and wrote it back out.

Thanks again.

Adam Rabin

A different approach would be to send it as an attachment using DIME.

--

Joe (MVP - xml)
Nov 11 '05 #6
But, that is Microsoft specific, no? We might use Unix web services.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #7
No, DIME is not MS-specific.

In addition to microsoft's support of DIME with WSE,
Apache AXIS does DIME
as does TME GLUE
and gSoap
and some others
"Adam Smith" <ad*********@hotmail.com> wrote in message
news:Ot*************@TK2MSFTNGP10.phx.gbl...
But, that is Microsoft specific, no? We might use Unix web services.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 11 '05 #8

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

Similar topics

3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
1
by: Chris Hoare | last post by:
I am writing a prototype data collection application; teh data for this project is being streamed in from a TCP port. Example of the XM...
1
by: andrej | last post by:
hi, ich habe eine anwendung, welche ein xml document erstellt. um festzustellen, ob ein element bereits vorhanden ist, verwende ich die funktion selectsinglenode( ....) diese funktion...
5
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
3
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the...
2
by: dotnetnoob | last post by:
i got a program with a dropdown combobox that will go and grab data off of a xml file that was selected from dropdown after the user chose a file then click select button it add data into an...
4
by: Derek Hart | last post by:
For testing purposes, I need some code that will loop through all attributes and elements in an XML file, and replace the data with the element or attribute name? Does anybody have code that will...
11
by: Tony Girgenti | last post by:
Hello. I have attached the XML data in question at the end of this post. I don't understand what is between <TripDataand </TripData>. When i talked to the publisher of the XML document, he...
0
by: saravanaVijayakumar | last post by:
I'm new to xml .. I had created a application such a way that I have to display the xml file in treeview control in C#.Net Application ... If I select the particular Node it should display the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.