PDA

View Full Version : Questions regarding extending XML files?



Lightning91
Dec 3rd, '06, 12:06 AM
I have been playing around with making a template, and have some questions regarding the rules for extending from Main.hdt or one of the other templates.

For the purposes of discussion, lets assume the following is an element from the source hdt file from which I am extending:

<PARENT ATTR1="first attribute" ATTR2="second attribute" ATTR3="fnord">
<CHILD1>Boy</CHILD1>
<CHILD2>Girl</CHILD2>
<CHILD3>Puppy</CHILD3>
</PARENT>

Most of my questions concern how much of the text I need to cut and paste from the parent file into the new template. These questions may seem redundant, but I just want to be clear as to how this works.

1. If I need to only change a single attribute, and I type:

<PARENT ATTR1="first time for everything">
</PARENT>

My understanding, is that at the very least I have lost the other two attributes in the new template. Do I also lose the information stored in the CHILD elements?

2. If I type:

<PARENT ATTR1="first time for everything" ATTR2="second attribute" ATTR3="fnord">
</PARENT>

Have I lost access to the information stored in the CHILD elements? I have I affected anything else in the PARENT element, that I am unaware of?


3. If I type:

<PARENT>

<CHILD1>Elementx</CHILD1>
</PARENT>

Have I lost the ATTR information? Have I lost the information from the last two CHILD elements?

4. If I type:

<PARENT>

<CHILD1>Elementx</CHILD1>
<CHILD2>Girl</CHILD2>
<CHILD3>Puppy</CHILD3>
</PARENT>

Have I lost the ATTR information? Will Powerpuff Girl fans be upset that I swapped the boy with ElementX?

5. Are there any other precautions, for mucking with the hdt files, of which I must be aware?

Lightning91

PS Thanks for saving me the money from buying an XML book, which would then sit on my shelf unread for 4 to 5 years.

RPMiller
Dec 3rd, '06, 09:33 AM
I'm not quite following what you are trying to do. Maybe posting an actual example will get you through anything that isn't working right. Until then...

The easiest way to create a Custom Character Template is to start by copying the entire entry that you wish to change from the appropriate Character Template, most likely Main.hdt. You only need to modify that one entry and it will merge it into the Main template overriding it with your changes.

Also, if you haven't already you should read the Character Templates section of the manual as it explains rather clearly how to get started (Thanks RJCurrie :thumbup:).

Starwolf
Dec 3rd, '06, 11:31 AM
One word of caution... make sure you EXTEND main.hdt and not modify it. You can get really scary results and even cause HD to quit functioning properly if you change the MAIN.HDT module directly.

Lightning91
Dec 3rd, '06, 09:36 PM
Starwolf - Thanks for the advice. I understand that editing main.hdt would lead to chaos (at least until I downloaded the next update, which would overwrite the file). :)

RPMiller - I tried very hard in my initial post to be clear (obviously I failed :( ). What my question concerns is: if I edit elements in part, when do I overwrite or remove information that is being extended from the parent xml file. :)

Since it may be clearer if I use an actual element from the main.hdt file, lets restate my questions assuming I wanted to modify the Intelligence characteristic (which is applicable, since I would like to create a Valdorian Age template). :think:

Main.hdt has the following intry for the Intelligence characteristic:

<INT DISPLAY="INT" BASE="10" LVLCOST="1" LVLVAL="1" PERINCREASE="1" PERINCREASELEVELS="5"

MINVAL="-999" MAXVAL="999" POSITION="5" NCM="20" NCM40="25" NCM60="30" NCM10="15"
NCM10NICE="15">
<SOURCE>Hero System Fifth Edition Rule Book</SOURCE>
<SOURCE>Sidekick</SOURCE>
<DEFINITION>(Hero System Fifth Edition Rule Book, page 23; Revised, page 37) Intelligence represents a
character's ability to take in and process information quickly.</DEFINITION></INT>

Using this, my questions would be restated as the following:

1. If I need to only change a single attribute, and I type:

<INT BASE="8">
</INT>

My understanding, is that at the very least I have lost the other attributes (i.e. LVLCOST, LVLVAL etc...) in the new template. Do I also lose the information stored in the SOURCE and DEFINITION elements?

2. If I type:

<INT DISPLAY="INT" BASE="8" LVLCOST="1" LVLVAL="1" PERINCREASE="1" PERINCREASELEVELS="5"
MINVAL="-999" MAXVAL="999" POSITION="5" NCM="20" NCM40="25" NCM60="30" NCM10="15"
NCM10NICE="15">
</INT>

Have I lost access to the information stored in the SOURCE and DEFINITION elements? Have I affected anything else in the INT element, that I am unaware of?

3. If I type:

<INT>

<SOURCE>5er and FREd</SOURCE>
</INT>

Have I lost the attribute (BASE, LVLCOST, LVLVAL, etc.) information? Have I lost the information from the last second SOURCE element and the DEFINITION element?

4. If I type:

<INT>

<SOURCE>5er and FREd</SOURCE>
<SOURCE>Sidekick</SOURCE>
<DEFINITION>(Hero System Fifth Edition Rule Book, page 23; Revised, page 37) Intelligence represents a
character's ability to take in and process information quickly.</DEFINITION>
</INT>

Have I lost the attribute information?

5. Are there any other precautions, for mucking with the hdt files, of which I must be aware?

Hopefully that is a little bit clearer. If not, I guess I will just have to settle for having to buy the XML book.

I sincerely appreciate the responses,
Lightning91

RPMiller
Dec 3rd, '06, 09:44 PM
Yup. Much clearer. As far as I know, all information is merged. Which means that only the changes from the custom template overwrite the Main.hdt so all other aspects of the element, characteristic in this case, remain the same.

I will admit to never done partial edits, but based on what I recall Dan saying I believe I'm correct. I'm sure I'll be corrected tomorrow if I'm not. ;) Dan made a VERY intelligent program so I'm sure he has this handled in every detail.

Simon
Dec 4th, '06, 05:05 AM
Step 1: Read through the documentation on editing templates.

Step 2: When editing an ability, you need to copy the ENTIRE ability into your new template, not just part of it. To do anything else would require a rather cumbersome and complex scheme to delete attributes/child element that you don't want to define, etc. Much easier to just have the entire definition in one place.

RPMiller
Dec 4th, '06, 09:06 AM
I knew someone more "in the know" would be by. ;)

Lightning91
Dec 4th, '06, 11:04 AM
Step 1: Read through the documentation on editing templates.

Step 2: When editing an ability, you need to copy the ENTIRE ability into your new template, not just part of it. To do anything else would require a rather cumbersome and complex scheme to delete attributes/child element that you don't want to define, etc. Much easier to just have the entire definition in one place.

Step 1: Check (did this before I wrote the first post)

Step 2: I was afraid that would be the answer.

Thanks for the quick response Simon. Much appreciated!:D