Re: Please help:need to read XML, edit, and write back to XML file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Ed,

If you were only looking for a few tags, it would be simple enough to parse
out the text strings in a VBA routine using InStr and Mid functions but I
gather you're dealing with a more complex scenario.

Try doing a web search using the term
MSXML2.DOMDocument
and I think you may find some helpful links with examples of using that
object within VBA.

Steve




"Ed from AZ" <prof_ofwhat@xxxxxxxxx> wrote in message
news:65d2f8aa-9dbc-46fb-ad3e-c57bd7019b8e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm using Word 2003. I use a proprietary Java program that takes all
the information in the various forms and generates an XML file. There
are times I need to move information between files. I tried to
explore this in the Excel and Access NG, because the data format would
lend itself very well to a spreadsheet or table. But I reached a dead
end.

My thought is to create a macro that would find the proper tags and
parse out all the data in between the correct tags into a table or
spreadsheet. Then, after I have cut / pasted / mutilated the data as
required, I can write the new data back into an array, append the
correct tags, and write it back into the original XML file.

One problem is that when I open an XML file in Word 2003, I see on
screen the cute little visual representations of the tags - but they
aren't really there. At least, they don't show up in Print Preview,
and Paragraph.Range.Text doesn't see them. I found a clue in one NG
post and opened the Script Editor (ALT + SHIFT + F11), and saw tags
and much more. But I still have no idea how to accomplish what seems
to be the simple project of writing out the data from certain tags and
then writing it back when I'm done.

Can anyone please drop-kick me in a good direction to get started
towards this?

Ed


.



Relevant Pages

  • Re: Please help:need to read XML, edit, and write back to XML file
    ... of the code can be used in a VBA routine. ... then have the confidence of writing it back into the XML file. ... If you were only looking for a few tags, it would be simple enough to ... the information in the various forms and generates an XML file. ...
    (microsoft.public.word.vba.general)
  • Re: How Do I search an XML File?
    ... If the XML file is well-formed and the data structure is stable, you could read the file in using the scriptlet library filesystemobject in Access 2000; look up createfileobject for some code examples. ... Or, you can use the old dos style file open, read the file in a line at a time, look for the tags that encapsulate the content you want, pop that information into an array, then deal with the 'hits' after you have completed your line by line scan of the file. ... or is the skill a child node of the employee? ... I also need to scan for the employee skill set if it matches a certain ...
    (microsoft.public.access.externaldata)
  • Re: Please help:need to read XML, edit, and write back to XML file
    ... And it's perfect - it puts everything in a string with all the tags, ... of the code can be used in a VBA routine. ... the information in the various forms and generates an XML file. ...
    (microsoft.public.word.vba.general)
  • Re: Reading Reults of txt file - and then...
    ... I need it to execute another file if it finds ... >>I am using FSO to read a XML file, using the ReadAll method. ... First how does an XML file appear to wsh? ... > Once you have found these tags (or not, depending on whether or not they are ...
    (microsoft.public.scripting.vbscript)
  • newbie: how to change webpage element dynamically
    ... I need to come up with a way so that when this xml file is opened up ... say class2, the text in between the value tags must change to class2 ... This code will let me display a drop down menu, ... take the selected value and change the text in the value tags. ...
    (comp.lang.javascript)