Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing XML Files Using VFP

Status
Not open for further replies.

moppsy

IS-IT--Management
Dec 22, 2004
22
US
We are having some problems with parsing xml files. Some of entities don't exist for every record and this is the only way we came up with to keep the program from erroring out. Does anyone have any better suggestions for writing this code and account for those entities that don't exist in every record. Thanks in advance. Here's what we coded:

bPubDateFailed = .f.
ON ERROR bPubDateFailed=.t.
oPubDate = oJournalIssue.getElementsByTagName("PubDate").item(0)
ON ERROR

IF bPubDateFailed <> .t. THEN
ON ERROR strJournalIssuePubDateYear = ""
strJournalIssuePubDateYear =
oPubDate.getElementsByTagName("Year").item(0).text
ON ERROR

ON ERROR strJournalIssuePubDateMonth = ""
strJournalIssuePubDateMonth =
oPubDate.getElementsByTagName("Month").item(0).text
ON ERROR
ELSE
strJournalIssuePubDateYear = ""
strJournalIssuePubDateMonth = ""
ENDIF
 
Could you use XMLAdapter to throw the data into cursors instead of parsing by hand?

Tamar
 
Thanks Tamar, could you or someone out there please give me more information about how to use the XMLAdapter to do what we want. Thanks so much for the help.
 
Take a look at the Help for XMLAdapter. Also, there are a couple of XMLAdapter examples in the Solution Samples.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top