Post by jsager on Jul 15, 2008 22:02:24 GMT
This post will serve as an example of how to parse and read the existing LoneWolf XML for a screen reader program.
The code is written in C Sharp, however, as a programmer you shoudl be able to read through the code and apply similar concepts spelled out in your language of choice. While, if you're not working in the .NET framework, you won't have access to LINQ which I used to sift through the XML, nearly every programming language out there has tools for working with XML. Learning those tools is up to you; however hopefully my examples will serve to illustrate what parts of the XML concern you.
All of the files that you need to look at (with extensions of .cs and .aspx) can be opened in any old text browser.
This .NET solution consists of three projects:
1. Sandbox Bootstrap
This is simply an executable that launches the book parser and requests a specific section, it calls a method that writes its that section to the console.
2. LoneWolfBusinessTier
This is the core of the project, right now it's really only one class. That class is BookInformation and it's in the DataAccess namespace.
BookInformation does a couple of things.
First, it contains an enumeration of the LoneWolf books. An enum is really just a way to reference a value programatically, basically like declaring a variable "FlightFromTheDark = 1". I'm not going to go into a long dissertation on enums right now, but it basically lets me request things by name and not much more than that.
In addition, it goes out and grabs the Project Aon current XML and caches it in memory so that it doesn't take long to access it a second time.
Finally, it contains a method to grab any section from any book. It returns that data in the form of a .NET XElement. To see how I use that XElement, read further.
Right now I've only implemented books 1-3, but you could add additional books in approximately 15 seconds apiece by just adding to the enumeration and the getLocation methods...
3. SampleLWReader
This project is a fairly functional AJAX enabled HTML book reader. It only works on Flight From The Dark at the moment, but you could easily modify it to work with all of them (I just hardcoded FFTD arbitrarily).
It's a single web page reader, consisting of an aspx page (Default.aspx, the .NET thing that eventually turns into HTML) and what's called a "codebehind" file Default.aspx.cs that contains my application logic.
Take a look at the codebehind. You'll see how I use my XElement object that I got from book information and turn it into the appropriate parts of my HTML page.
Here is the link to it: lonewolf.dcubedmedia.com/lonewolf.rar
It's a rar archive, unzip it with winrar or something.
Also, everything is copyright by Joe Dever and Project Aon. use my code all you want, but respect the aon license - don't be a jerk.
I will answer any and all questions that come my way.
The code is written in C Sharp, however, as a programmer you shoudl be able to read through the code and apply similar concepts spelled out in your language of choice. While, if you're not working in the .NET framework, you won't have access to LINQ which I used to sift through the XML, nearly every programming language out there has tools for working with XML. Learning those tools is up to you; however hopefully my examples will serve to illustrate what parts of the XML concern you.
All of the files that you need to look at (with extensions of .cs and .aspx) can be opened in any old text browser.
This .NET solution consists of three projects:
1. Sandbox Bootstrap
This is simply an executable that launches the book parser and requests a specific section, it calls a method that writes its that section to the console.
2. LoneWolfBusinessTier
This is the core of the project, right now it's really only one class. That class is BookInformation and it's in the DataAccess namespace.
BookInformation does a couple of things.
First, it contains an enumeration of the LoneWolf books. An enum is really just a way to reference a value programatically, basically like declaring a variable "FlightFromTheDark = 1". I'm not going to go into a long dissertation on enums right now, but it basically lets me request things by name and not much more than that.
In addition, it goes out and grabs the Project Aon current XML and caches it in memory so that it doesn't take long to access it a second time.
Finally, it contains a method to grab any section from any book. It returns that data in the form of a .NET XElement. To see how I use that XElement, read further.
Right now I've only implemented books 1-3, but you could add additional books in approximately 15 seconds apiece by just adding to the enumeration and the getLocation methods...
3. SampleLWReader
This project is a fairly functional AJAX enabled HTML book reader. It only works on Flight From The Dark at the moment, but you could easily modify it to work with all of them (I just hardcoded FFTD arbitrarily).
It's a single web page reader, consisting of an aspx page (Default.aspx, the .NET thing that eventually turns into HTML) and what's called a "codebehind" file Default.aspx.cs that contains my application logic.
Take a look at the codebehind. You'll see how I use my XElement object that I got from book information and turn it into the appropriate parts of my HTML page.
Here is the link to it: lonewolf.dcubedmedia.com/lonewolf.rar
It's a rar archive, unzip it with winrar or something.
Also, everything is copyright by Joe Dever and Project Aon. use my code all you want, but respect the aon license - don't be a jerk.
I will answer any and all questions that come my way.