473,390 Members | 1,378 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,390 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 1066
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
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...

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.