PDA

View Full Version : Calling all XML gurus ....



AdamBrunt
09-22-2004, 03:38 PM
Hi all,

I have a feeling this is going to be a long shot but hopefully there are some XML gurus who could help me out with something ....

I want to have an page in IE that has two "divs" areas on it.

In the left hand one I want an "explorer" tree built from an XML document.

The XML document will look like


<GROUP>
<ID = "1">
<SKILL>
<ID = "1">
</SKILL>
</GROUP>
<GROUP>
<ID = "2">
<SKILL>
<ID = "2">
</SKILL>
<SKILL>
<ID = "3">
</SKILL>
</GROUP>

ie a number of GROUPS each of which contain any number of SKILLS.

The "div" block on the right is initially empty. On clicking on a branch/node in the left hand tree, I want that node/branch added to to the 'tree' on the right. If a branch's node doesn't exist in the right hand tree when a branch is clicked then the branch will need to be added as well.

Clicking on a branch/node in the right hand tree simply removes it from the tree.

Finally, at any time I need to be able to get a list of the (group id, skill id) currently in the right hand tree.

As I say ... I know it's a long shot but does anyone know if the above is possible ?? Or better still got any pointers as to where to start/sample code/working examples ??

TIA for any help.

Regards,

Adam Brunt

magicyte
07-08-2008, 06:45 PM
there should be an error in the xml. you had a tag name with NO END TAG! plus the attribute was assigned to the tag itself!!!

-magicyte

codeexploiter
07-09-2008, 11:41 AM
A number of errors in the mentioned XML. Please find the mentioned issues below:

1. XML version and encoding declaration is missing.

2. In the mentioned XML data there is no root element and without a root element XML is not valid.

3.
<ID = "1"> The above code is incorrect you can't assign a value without an attribute. This can be changed to something like the follow:

<ID value="1">

4.
<ID = "1"> The above tag must close. The XML tag rules are very strict when you compare XML with HTML. I mean the nesting of tag elements must be correct and each tag should be closed properly.

<ID value="1"/>

An example code is below. I've done this with your XML;


<?xml version="1.0" encoding="utf-8"?>
<GROUPS> <!-- Root node begins -->
<GROUP>
<ID value="1"/>
<SKILL>
<ID value="1"/>
</SKILL>
</GROUP>

<GROUP>
<ID value="2"/>
<SKILL>
<ID value="2"/>
</SKILL>
<SKILL>
<ID value="3"/>
</SKILL>
</GROUP>
</GROUPS> <!-- Root node ends -->


Hope this helps. If you need any more assistance post more details with complete XML