• NOW LIVE! Into the Woods--new character species, eerie monsters, and haunting villains to populate the woodlands of your D&D games.

Working with XML output from Character Builder

fissionessence

First Post
I'm somewhat familiar with XML and how it works on its own, but not how to interact with it well in other programming languages (or even how to display it through some sort of browser style sheet).

However, I'd like to design a character sheet that can use the XML output from the D&D 4E Insider Character Builder. That is, somehow, the user should be able to click 'import sheet' and grab their XML output to render their sheet; or they should be able to put the XML in a certain folder with the style sheet or something, so that when the style sheet file is opened in the browser it gets the info that way. Having this be web-based would be okay, but I'd prefer that a user can store everything locally (even if it's browser based, it shouldn't require the Internet).

So, for anyone familiar in working with XML, what kind of programming should I be looking at doing, what kind of learning resources do you think would help me, and what kind of developer tools might I need? Also, if you know of any other character sheets using this kind of format that I could look to for an example, that would be great.

Thanks!

~
 

log in or register to remove this ad

I'm somewhat familiar with XML and how it works on its own, but not how to interact with it well in other programming languages (or even how to display it through some sort of browser style sheet).

However, I'd like to design a character sheet that can use the XML output from the D&D 4E Insider Character Builder. That is, somehow, the user should be able to click 'import sheet' and grab their XML output to render their sheet; or they should be able to put the XML in a certain folder with the style sheet or something, so that when the style sheet file is opened in the browser it gets the info that way. Having this be web-based would be okay, but I'd prefer that a user can store everything locally (even if it's browser based, it shouldn't require the Internet).

So, for anyone familiar in working with XML, what kind of programming should I be looking at doing, what kind of learning resources do you think would help me, and what kind of developer tools might I need? Also, if you know of any other character sheets using this kind of format that I could look to for an example, that would be great.

Thanks!

~
Do you have any programming experience?

Something simple might be gained by merely using Cascading Style Sheets (CSS), if you have HTML experience, that could help.

If you want to do "real" programming:

You will need some kind of XML/DOM Parser that can read the XML file. The parser will be used to "traverse" the document and ask for specific values contained in the document. In code, you will use the parser to get the information you need. For example, if you are in the part where you want to write down the feat descriptions, you will look for the node in the XML that contains the feats, and you will go through its content (probably one node for each feat) and retrieve the data you need (like feat name and feat description).


Unfortunately, I think absent of knowing how much you know about programming and - if anything - what you have used in the past, I find it hard to give more specific suggestions.

Once you have settled for a programming language, I suspect the process is relatively straightforward - if you have experience with programming (and the language you use.)
 

I was looking at the new XML today and I'm not sure it is yet enough to do anything with. It doesn't contain any text for the powers so anything you do with it will lack that very important element!
 

Well, it doesn't contain the rules text, but it does contain links to DDI pages for each rules element relevant to the character. So, as long as the user is logged in, you should be able to reference the stuff you need.

I have done programming before, but never worked with any particular language too much. I'm pretty good at learning basics of how to do exactly what it is I need done in any particular programming language (they all share a lot of concepts), but without being really fluent in any language.

Basically I'm looking for something that would best render the character sheet for the user (for printing, generally), and something that wouldn't require too big or complex of a developer's kit in order for me to work with it.

~
 

Check out w3schools (W3Schools Online Web Tutorials) and look at the XPath tutorials. It is language independent, and gives you a good querying method of pulling information out of the XML file.

Most of the XML parsing that I have done has been using vba with Excel, but you could also set up an XSL transformation for use in a web browser.
 

Check out w3schools (W3Schools Online Web Tutorials) and look at the XPath tutorials. It is language independent, and gives you a good querying method of pulling information out of the XML file.

Most of the XML parsing that I have done has been using vba with Excel, but you could also set up an XSL transformation for use in a web browser.

Thanks! Can you point me to any tutorials that show how to use XML in a web language (or some other programming method)?

~
 

I would recommend using a web browser to display the page and grabbing the XML data with javascript. There are already XML parsing routines in javascript so that should be easier. And if you use a javascript framework, such as jQuery (my favorite!), they have simplified ways of reading the XML. In fact, using the jQuery routines, you could prompt the user for a URL, grab the XML data using AJAX, then display a sheet.

The myth-weavers.com and thetangledweb.net character sheet tools use a similar technique without using a framework. (Frameworks are nice because they provide so much support for other things, including cross-browser compatibility, but writing discrete javascript has advantages sometimes too.)

Looking at the two aforementioned character sheet repositories would probably be a good start, since they each do something very similar. (I prefer the one on thetangledweb.net, but they are very similar if not derivatives of the same source.)
 

Into the Woods

Remove ads

Top