The new XML, unfortunately, is
bad XML. (IMO.) Bizarrely, some sections that you
don't need use decent XML... but the bits you need are coded such that using, for instance, Adobe Live-Cycle Designer to build a PDF form for it are at a minimum bloody tricky, and quite possibly undoable without Javascript.
For example, there's a section with the base ability scores (before even racial modifiers). That section would be quite usable, if we cared, but we don't. For example, the <AbilityScores> tag here contains a tag called <Strength>, done up with an attribute (in the XML sense) into <Strength value="16" /> or the like. This, we could extract with PDF data bindings. Not too bad. It would have been even better if the tag had actually been a normally closed tag with the value as its contents, like this: <Strength>16</Strength>... but the one they've used is okay.
However... when it comes time to get the values we actually WANT, they've used a completely back-asswards XML setup which renders the data practically inextricable. Here's the data for the actual Strength score:
Code:
<Stat name="Strength" value="16">
<alias name="Strength" />
<alias name="str" />
<statadd value="14" />
<statadd Level="1" value="2" charelem="a171cd0" />
</Stat>
This doesn't look so bad, and indeed is pretty easily parsed by eye... but to the data binding it's practically opaque.
Even <Stat strength="16" /> would have been a better way to do it.
To retrieve the data from my preferred form it'd look something like this:
$return.CharacterSheet.AbilityScores.Strength.value
To retrieve from the this-isn't-so-bad version they've used for the pointless pre-modifier values, you'd use something like:
$return.CharacterSheet.AbilityScores.Strength.getAttribute("value")
Neither of those is too bad, because the name of the tag is indicative to us.
But for the actual one they used? Don't be confused by the
name attribute. The actual
name of a <Stat ... /> tag is
Stat. But there are many "Stat" tags. How do we tell them apart? By the "name" attribute.
How shall I put this... this is terrible code. Because you can't, as far as I can tell in a couple hours of looking at the PDF XML spec, actually sort by attribute
value. I can pull out, say, "the first 'Stat' tag which has an attribute named 'Strength'." But here they're obliging us to ask the code the following question:
"Go through all your tags named 'Stat' with the attribute 'name.' Pull up the value of this 'name' attribute, and compare them to a constant I will tell you - in this case it's 'Strength'. Once you find the one which matches this, then pass the tag (not the attribute, nor its value) to a call which will actually extract the value of the attribute 'value'." Yech!
Imagine you're running a party. You have a guest list; your staff can quickly find each guest by name. Each guest holds a placard which could hold a number. And you get to the question, "Okay. What's Bob's number?" In good XML, this is easy as pie.
Here? WotC has supplied us with the following fancy dress party:
- Every guest is named Sam. Each and every one of them.
- Every guest's placard is inexplicably blank.
- Every guest has a card in their right-hand pocket, in Arabic. On the card is their secret name for the event. You have one staff member, Alain, who picks pockets and reads Arabic.
- Every guest also has a corsage which encodes to their number in the Victorian 'language of flowers'. You have a second staff member, Judith, who can understand this code.
So in order to get Bob's number, you must:
- Tell Alain to go up to every Sam in the room, and pick their pocket.
- Once he finds the one whose card says "Bob", point that person out to Judith.
- Judith looks at that person and infers the number, and tells it to you.
Compare and contrast to the 'guest list and placard' model that XML is supposed to be.
Worse, in the case of PDF forms, as far as I can tell, you don't even have Alain on staff. You have to go hire an external company, Javascript Inc., to send Alain to your party. And you can only communicate with Alain using the company's official forms - no talking to him directly.
Epic. XML. Fail.
(Note - I am relatively new to XML. I understand the theory better than the practice. It may easily be the case that Alain was hiding under the table and I missed him. It may be the case that the guest list, indexed by secret name, is hiding in the refrigerator. And it is possible, even likely, that for some situations (WotC knows that an unknown number of persons named "Pow Ercard" will be coming to the party, but not what their secret names will be), the approach used may be necessary. But for the most part, in a situation like this where all we want to do is ask Strength Smith his number, and we know he'll arrive and there's only one of him? Freakin' horrible.)