473,799 Members | 3,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating an XML Document to return from function

Ok, I've spent all this time creating a program to read an XML Document via
XPaths and my boss is pretty thrilled, but now I have to return an XML
document, so can someone point me to some sample code that creates an XML
Doc and adds a field/element to it?

Thanx!

--
TFWBWY...A
Dec 9 '05 #1
4 2408
Bryan:

The following KB article may be a useful reference, depending on your exact
needs.

http://support.microsoft.com/default...b;en-us;317665

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Bryan Dickerson" <tx******@netsc ape.net> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ok, I've spent all this time creating a program to read an XML Document via
XPaths and my boss is pretty thrilled, but now I have to return an XML
document, so can someone point me to some sample code that creates an XML
Doc and adds a field/element to it?

Thanx!

--
TFWBWY...A

Dec 9 '05 #2
I think that's close, but I'm still grappling with trying to understand some
of the details and how to translate them to my situation. All that to say,
I don't get it yet.

If I want to pass back a very simple XML Document that looks like this:

<?xml version="1.0" encoding="UTF-16" ?>
<Results>
<OrderNumber>12 3456</OrderNumber>
<Error>[Error messages, if any, go here]</Error>
</Results>

.... what would a sample piece of code look like?

Thanx!
"David Lloyd" <Da***@NoSpamPl ease.com> wrote in message
news:%z******** ******@bignews7 .bellsouth.net. ..
Bryan:

The following KB article may be a useful reference, depending on your
exact
needs.

http://support.microsoft.com/default...b;en-us;317665

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.
"Bryan Dickerson" <tx******@netsc ape.net> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ok, I've spent all this time creating a program to read an XML Document
via
XPaths and my boss is pretty thrilled, but now I have to return an XML
document, so can someone point me to some sample code that creates an XML
Doc and adds a field/element to it?

Thanx!

--
TFWBWY...A

Dec 9 '05 #3
Bryan:

The following code sample would create a similar document.

Private Sub btnXML_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btnXML.Click

Dim doc As XmlDocument = New XmlDocument

Dim dec As XmlDeclaration = doc.CreateXmlDe claration("1.0" , "UTF-16",
String.Empty)
Dim eResults As XmlNode = doc.CreateEleme nt("Results")

doc.InsertBefor e(dec, doc.DocumentEle ment)

doc.AppendChild (eResults)

Dim eOrderNum As XmlNode = doc.CreateEleme nt("OrderNumber ")

eOrderNum.Inner Text = "123456"

eResults.Append Child(eOrderNum )

Dim eError As XmlNode = doc.CreateEleme nt("Error")

eError.InnerTex t = "[Error messages, if any, go here]"

eResults.Append Child(eError)

doc.Save(("C:\T estXML.xml"))

End Sub
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Bryan Dickerson" <tx******@netsc ape.net> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
I think that's close, but I'm still grappling with trying to understand some
of the details and how to translate them to my situation. All that to say,
I don't get it yet.

If I want to pass back a very simple XML Document that looks like this:

<?xml version="1.0" encoding="UTF-16" ?>
<Results>
<OrderNumber>12 3456</OrderNumber>
<Error>[Error messages, if any, go here]</Error>
</Results>

.... what would a sample piece of code look like?

Thanx!
"David Lloyd" <Da***@NoSpamPl ease.com> wrote in message
news:%z******** ******@bignews7 .bellsouth.net. ..
Bryan:

The following KB article may be a useful reference, depending on your
exact
needs.

http://support.microsoft.com/default...b;en-us;317665

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.
"Bryan Dickerson" <tx******@netsc ape.net> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ok, I've spent all this time creating a program to read an XML Document
via
XPaths and my boss is pretty thrilled, but now I have to return an XML
document, so can someone point me to some sample code that creates an XML
Doc and adds a field/element to it?

Thanx!

--
TFWBWY...A


Dec 10 '05 #4
Thanx! That was exactly what I needed!

"David Lloyd" <Da***@NoSpamPl ease.com> wrote in message
news:r1******** ********@bignew s5.bellsouth.ne t...
Bryan:

The following code sample would create a similar document.

Private Sub btnXML_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btnXML.Click

Dim doc As XmlDocument = New XmlDocument

Dim dec As XmlDeclaration = doc.CreateXmlDe claration("1.0" , "UTF-16",
String.Empty)
Dim eResults As XmlNode = doc.CreateEleme nt("Results")

doc.InsertBefor e(dec, doc.DocumentEle ment)

doc.AppendChild (eResults)

Dim eOrderNum As XmlNode = doc.CreateEleme nt("OrderNumber ")

eOrderNum.Inner Text = "123456"

eResults.Append Child(eOrderNum )

Dim eError As XmlNode = doc.CreateEleme nt("Error")

eError.InnerTex t = "[Error messages, if any, go here]"

eResults.Append Child(eError)

doc.Save(("C:\T estXML.xml"))

End Sub
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.
"Bryan Dickerson" <tx******@netsc ape.net> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
I think that's close, but I'm still grappling with trying to understand
some
of the details and how to translate them to my situation. All that to
say,
I don't get it yet.

If I want to pass back a very simple XML Document that looks like this:

<?xml version="1.0" encoding="UTF-16" ?>
<Results>
<OrderNumber>12 3456</OrderNumber>
<Error>[Error messages, if any, go here]</Error>
</Results>

... what would a sample piece of code look like?

Thanx!
"David Lloyd" <Da***@NoSpamPl ease.com> wrote in message
news:%z******** ******@bignews7 .bellsouth.net. ..
Bryan:

The following KB article may be a useful reference, depending on your
exact
needs.

http://support.microsoft.com/default...b;en-us;317665

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.
"Bryan Dickerson" <tx******@netsc ape.net> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ok, I've spent all this time creating a program to read an XML Document
via
XPaths and my boss is pretty thrilled, but now I have to return an XML
document, so can someone point me to some sample code that creates an XML
Doc and adds a field/element to it?

Thanx!

--
TFWBWY...A


Dec 12 '05 #5

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

Similar topics

20
3127
by: svend | last post by:
I'm messing with some code here... Lets say I have this array: a1 = ; And I apply slice(0) on it, to create a copy: a2 = a1.slice(0); But this isn't a true copy. If I go a1 = 42, and then alert(a2) I will see 42 there too. I'm doubting, but I was
12
10177
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical scrollbar, you get the height of the entire document, screwing up any chance of centering a window in the browser using these values. Is there a way to get the height of the actual browser window and not the entire page height? Thanks.
6
2953
by: NotGiven | last post by:
I want to learn moer of what I saw in a recent example. They create a page that created new fields/element. It's not like they were hidden and they displayed them, they were not there, then the script created them. It used things like parentnode, insertBefore, appendChildNode,... Any ideas/direction is appreciated.
24
3267
by: jonathon | last post by:
Hi all, I have a web app with a popup window for entering data. I don't want to access the web every time this window is opened, as most of the app is AJAX. But I can't figure out how to open a new window and build it with DOM rather than having to provide a src. Even a blank.html as src takes time to fetch. How can I create a popup and dynamically add DOM content without any html at all?
6
7258
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those changes just don't make it onto the screen. Am I doing something wrong here? If not, is there a better feature test I can use than "appName.match()"?
2
4993
by: SAL | last post by:
I would like to create a VB.net function, that builds a dynamic hyperlink using System.Web.UI.WebControls.HyperLink, but I can not find any examples on how to generate a dynamic hyperlink. Has anyone done this before? I do not want to dynamically create my hyperlink on an ASP page, but rather a behind the scenes link that a user can paste into a Word document or Email, as an embedded link that points to a particular file. This would be...
4
1242
by: deadlyicon | last post by:
So I wanted an object to have a reference to a string in side of an array some where else and so here is how I made that possible: <div id="something"> </div> <script> var obj = document.getElementById('something'); var vars = {
1
2402
by: Rako | last post by:
My problem is: I want to create an index to any of the available picture-groups. This index is a table of thumbs with a scrollbar. If you click on the thumb, you get the full picture displayed. This table must be created from scratch. (The function must be reusable, and speed up the load-time: only one of the various possible picture-groups will be indexed. any other will be loaded by request. The picture-groups are defined in flexible...
6
4967
by: cleary1981 | last post by:
I have adapted code from http://dunnbypaul.net/js_mouse/ I want to use a button to create new draggable divs but i keep getting error "is null or not an object" heres the code <html> <head> <title>Drag and drop module</title> <style type="text/css"> #canvas {
0
9538
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10247
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...
1
10214
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
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
7561
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
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
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
4135
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

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.