Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing XML with DOM
Message
From
21/11/2004 16:55:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/11/2004 00:02:30
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
00962465
Message ID:
00963355
Views:
7
Don,
In fact at that moment I was doing a lot other things and could only spare 1-2 mins to it. The secret behind I didn't do it manually. Just copied and saved as an xml file, loaded it in a VS.Net project and requested it to generate an XSD from dataset (and at that time I already had the tables and rows navigatable in .Net IDE). That's xsd content I pasted here.
This is basically what I'm trying to say. If widely used languages\tools\IDE is doing it for you I don't see myself in position of learning XML syntax at all (well I find schemas very hard understand). If I were only doing VFP probably I wouldn't even dare to reply with my next to none XML knowledge (if you give me an XML file I can parse it by hand but that's all - you could be sure I wasn't parsing it using schema at top at all).
Currently I also spared some time to master (if I ever could) .NET and might check the utility and try to write a .NET counterpart. Not sure, scared seeing it's a 6+Mb download (still dnloading the zip). I'l try to directly find the web service call it makes and do it in .NET (I'm not bad at VFP but bad at VFP+webservice. VFP returns result as XML w/o any deserialization).
Cetin


>Hi Cetin -
>
>Wow! It looks like you did a lot of work there for me. I'll give it a look and try to understand it. The overall problem is a personal learning exercise for me that starts with a project called 'xmltv'. This is a linux based open source project that allows the user to d/l TV listings for just about anywhere in the world. There is a windows port that I am using to capture the data stream. I was hoping to write a VFP utility that I could make available to others who might be interested.
>
>The xmltv zip comes with a set of utilities to d/l from the web service and do some processing on the result file. There is a parser in the package that converts the raw data stream into a modified xml file. Thus I have the option of working with the raw data file or the parsed result. The file samples you have seen in my posts are from the raw or main data download. I'm not sure which would be easier to work with (I have tried both and there are issues either way).
>
>The built in parser comes with a dtd that could probably be modified if I knew what I was doing but I thought it would be easier to start with simpler subsections of the raw file.
>
>There is also a utility to convert the parsed xml file into a text file but the conversion loses some of the data which is why I'm trying to write my own handler. I can process the text file but some of the interesting descriptive data isn't there.
>
>You can download the package at:
>http://sourceforge.net/project/showfiles.php?group_id=39046
>
>Be sure to get the win32 version and not the linux tar.
>
>The setup is pretty simple. Just unzip the files into a directory created for the project. Then log on to www.labs.zap2it.com and set up a free account that includes the tv stations you want listings for. There is a code bundled in the docs for the project that you will need to set up the account.
>
>The program runs in a DOS window. Your first command will be something like
>
>xmltv tv_grab_na_dd --configure
>
>followed by
>
>xmltv tv_grab_na_dd --days 2 --dd-data dddata.RAW --output mylistings.xml
>
>The call to "tv_grab_na_dd" is for north america, so if you want some other location like Turkey or France there will be a different syntax. Anyway, the above call creates 2 days worth of listings in 2 files. The RAW file is the primary data stream and the xml is the result of the built in parser. Their content is the same but with different formats.
>
>The xmltv.dtd file is fairly well documented but I'm so new to this subject I still couldn't make much sense out of it. Its probably a good place to start though.
>
>Let me know if you decide to take a look at it. Since this is supposed to be a learning exercise for me, I suppose the first question would be should I work with a dtd or a schema and why?
>
>My approach thus far has been to split the RAW file up into pieces and try to create individual cursors from them. Some of these have worked and some haven't. Based on your previous post I have tried:
>
>schedules.xml
>
snipped...
>
>but this gives me a parse error that says
>"element content is invalid according to the dtd/schema Line 5 position 99"
>
>So far I haven't been able to figure out what that means.
>
>Thanks again
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform