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

Help required to update information in an XML

Hello dear VB experts.
I am very new to VB scripting.
I wanted to know if this is possible.

This is the requirement.
I have an XML file. I need an application that updates the information represented by the XML tags ( say "Name" and "Description" in the example below.)
Consider the XML file to have following structure.

<Start>
<Item>
<Name> ABC </Name>
<Description> I need to change this.</Description>
</Item>
<Item>
<Name> XYZ </Name>
<Description> I need to change also this. </Description>
</Item>
<Item>
<Name> PQR </Name>
<Description>I need to change Name and Description here
</Description>
</Item>
</Start>

I need the application to change the segments given in bold.
Solutions to this or suggestions are welcome.
Thanks in advance.

Regards,
Shyam
Feb 22 '07 #1
2 1062
Killer42
8,435 Expert 8TB
I believe there are a lot of tools available to work with XML. However, if you insist on doing it yourself, you should be able to get away with reading the file as plain text, line by line, and using Instr() function to find the tags and Mid() to pull out the text. Then change or replace the string, and concatenate the line back together.

It depends a bit on how consistent the layout is. For instance, if you know that it will always be formatted with each entry on a single line like your sample, then you could just do something really simple like...
Expand|Select|Wrap|Line Numbers
  1. If Left(strText, 6) = "<Name>" Then
  2.   strName = Mid(strText, 7, Len(strText) - 13)
  3.   ' Make your change to strName, then...
  4.   strText = "<Name>" & strName & "</Name>"
  5. End If
Of course, for a real application I would try to write this as a more generally applicable algorithm rather than hard-coding things like strings and lengths.
Feb 23 '07 #2
vijaydiwakar
579 512MB
Hello dear VB experts.
I am very new to VB scripting.
I wanted to know if this is possible.

This is the requirement.
I have an XML file. I need an application that updates the information represented by the XML tags ( say "Name" and "Description" in the example below.)
Consider the XML file to have following structure.

<Start>
<Item>
<Name> ABC </Name>
<Description> I need to change this.</Description>
</Item>
<Item>
<Name> XYZ </Name>
<Description> I need to change also this. </Description>
</Item>
<Item>
<Name> PQR </Name>
<Description>I need to change Name and Description here
</Description>
</Item>
</Start>

I need the application to change the segments given in bold.
Solutions to this or suggestions are welcome.
Thanks in advance.

Regards,
Shyam
Dear Shyam
XML files are not that much supported in VB
if possible try to use vb.net
Its very easy in .net
Feb 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
2
by: MyNameIsnt | last post by:
Can anyone tell me why, when I click on the buttons it register 2 characters on the display? if you use the right mousebutton it works ok, but the buttons dont flash?? it works fine without the...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
3
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
2
by: cryon.b | last post by:
Hi To All, I took up the IBM sample testfor Exam 700 today and I have the test tomorrow,I have some questions for which Iam not sure about the right answer,can anyone please guide me as to what is...
1
by: foothills bhc | last post by:
I have a problem with verifying content of controls on a form before closing the form or moving to the next form "record" (i.e., when moving to the next row of my form's record source). HERE'S THE...
23
by: casper christensen | last post by:
Hi I run a directory, where programs are listed based on the number of clicks they have recieved. The program with most clicks are placed on top and so on. Now I would like people to be apple to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.