Viewing and Parsing XML files

H

Hafeez Esmail

I'm using Word 2003.
My XML files are defined as follows:
Record
AccountInfo
TransactionInfo
ProductInfo
There are multiple sub-tags, and sub-sub-tags within the ones I've listed,
but let's ignore them for the time being.
1) How do I open the document in Word and show the tags as they would
appear in Notepad? Some of the information in the XML file is not showing
because it's hidden in the tag name. For example...<Record id="1"> is what
appears in NotePad, but only a Tag Named "Record" appears in Word.
2) Is there a quick way for me to Isolate all of the details associated with
(for example) Record numbers 3, 9, 14, and 45, and place that information
(copying the exact same struture) in a new file?
 
B

Bob Buckland ?:-\)

Hi Hafeez,

Generally, the ID= attribute wouldn't appear. In Word 2003 the capabilities for XML documents vary. Full support of external
Schemas/XSLT is provided in standalone Word and Word in the Professional Edition. You can defined a Schema and attach it to the
XML pane using the dialog accessed under
Tools=>Templates and Addins (Alt, T, I).

The XML Structure Task Pane (View=>TaskPane) will let you navigate the structure of the record content.

If you want to work on the raw XML data you can use
Tools=>Options=>General
and turn on
[x] Confirm Conversions at Open
then when you open the XML file choose Text file rather than XML document as the file type, but opening the .XML file in an XML
Editor will usually be easier to work with.

================
I'm using Word 2003.
My XML files are defined as follows:
Record
AccountInfo
TransactionInfo
ProductInfo
There are multiple sub-tags, and sub-sub-tags within the ones I've listed,
but let's ignore them for the time being.
1) How do I open the document in Word and show the tags as they would
appear in Notepad? Some of the information in the XML file is not showing
because it's hidden in the tag name. For example...<Record id="1"> is what
appears in NotePad, but only a Tag Named "Record" appears in Word.
2) Is there a quick way for me to Isolate all of the details associated with
(for example) Record numbers 3, 9, 14, and 45, and place that information
(copying the exact same struture) in a new file? >>
--
Please let us know if this has helped,

Bob Buckland ?:)
MS Office System Products MVP

LINKS
A. Specific newsgroup/discussion group mentioned in this message:
news://msnews.microsoft.com/microsoft.public.office.xml
or via browser:
http://microsoft.com/communities/newsgroups/en-us/?dg=microsoft.public.office.xml

B. MS Office Community discussion/newsgroups via Web Browser
http://microsoft.com/office/community/en-us/default.mspx
or
Microsoft hosted newsgroups via Outlook Express/newsreader
news://msnews.microsoft.com
 
H

Hafeez Esmail

Thanks Bob.
The Confirm Conversion on Open really did the trick....
I'm thinking there must be some tools out there (VB classes, methods) that
would greatly help me parse through this XML document and extract the items
I'm looking for....
But in the mean time, I suppose I can treat the XML document as a text file
(what a shame!) and do try it out that way.

Thanks,

Bob Buckland ?:-) said:
Hi Hafeez,

Generally, the ID= attribute wouldn't appear. In Word 2003 the capabilities for XML documents vary. Full support of external
Schemas/XSLT is provided in standalone Word and Word in the Professional Edition. You can defined a Schema and attach it to the
XML pane using the dialog accessed under
Tools=>Templates and Addins (Alt, T, I).

The XML Structure Task Pane (View=>TaskPane) will let you navigate the structure of the record content.

If you want to work on the raw XML data you can use
Tools=>Options=>General
and turn on
[x] Confirm Conversions at Open
then when you open the XML file choose Text file rather than XML document as the file type, but opening the .XML file in an XML
Editor will usually be easier to work with.

================
I'm using Word 2003.
My XML files are defined as follows:
Record
AccountInfo
TransactionInfo
ProductInfo
There are multiple sub-tags, and sub-sub-tags within the ones I've listed,
but let's ignore them for the time being.
1) How do I open the document in Word and show the tags as they would
appear in Notepad? Some of the information in the XML file is not showing
because it's hidden in the tag name. For example...<Record id="1"> is what
appears in NotePad, but only a Tag Named "Record" appears in Word.
2) Is there a quick way for me to Isolate all of the details associated with
(for example) Record numbers 3, 9, 14, and 45, and place that information
(copying the exact same struture) in a new file? >>
--
Please let us know if this has helped,

Bob Buckland ?:)
MS Office System Products MVP

LINKS
A. Specific newsgroup/discussion group mentioned in this message:
news://msnews.microsoft.com/microsoft.public.office.xml
or via browser:
http://microsoft.com/communities/newsgroups/en-us/?dg=microsoft.public.office.xml

B. MS Office Community discussion/newsgroups via Web Browser
http://microsoft.com/office/community/en-us/default.mspx
or
Microsoft hosted newsgroups via Outlook Express/newsreader
news://msnews.microsoft.com
 
C

Cindy M.

Hi =?Utf-8?B?SGFmZWV6IEVzbWFpbA==?=,
The Confirm Conversion on Open really did the trick....
I'm thinking there must be some tools out there (VB classes, methods) that
would greatly help me parse through this XML document and extract the items
I'm looking for....
But in the mean time, I suppose I can treat the XML document as a text file
(what a shame!) and do try it out that way.
The problem with any XML file is that the structure is arbitrary. So there's
really nothing like a "viewer" that can show you something for editing (as you
could an Excel worksheet, for example).

For "classic VB" (including VBA) you can set a reference to an MSXML library
(if nothing else, one is distributed with Office 2003) to get XML parsing
classes and methods. The .NET applications have those built-in. The Microsoft
Visual Studio "Express" editions - VB.NET Express, for example - are free
downloads.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top