Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mirage on Mar 11, 2008 06:18
open dhtmlx forum
XML reffers to not existing parent - Newbie Question[Continuation]

Hi,
I have managed to display the tree following your suggestions. Thank you.
I have some more questions before I take the final plunge :-)

I have an xml file which is very huge and has the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<excelConfig>
<excelGroup>
<excelGroupName>Statistics</excelGroupName>
<excel>
<excelName>External</excelName>
<contentType>SOAP</contentType>
<documentSchema1>someSchema</documentSchema1>
<documentType1>someSchema</documentType1>
</excel>
<excel>
<excelName>Internal</excelName>
<contentType>XML</contentType>
<documentSchema1>someSchema</documentSchema1>
<documentType1>someSchema</documentType1>
</excel>
</excelGroup>
</excelConfig>

 Iam transforming the xml file to the following structure to load it via the tree component.
<?xml version="1.0" encoding="UTF-8"?>
<tree id="0" text="Excel Config">
<item id="excelConfig" text="excelConfig">
<item id="excelGroup" text="excelGroup">
<item id="excelGroupName">Statistics</item>
<item id="excel">
<item id="excelName" text="excelName">External</item> - How to display/edit this?
.... etc
</item>
</tree>

Is it possible to load the real xml file as it is without this transformation and perform insert/edit operations on it?

What sort of validation can be followed when we use this component?
For e.g: while inserting a new node/ editing an existing node - how is invalid values check/ invalid schema check done?
Should I transform between the real xml and rendered xml to perform these checks?

Lastly, how can we display the tree such that it covers a whole window/frame ?

Sorry for the long winded question. Please help me use this component effectively.

Answer posted by Support on Mar 12, 2008 06:48
>> Is it possible to load the real xml file as it is without this transformation and perform insert/edit operations on it?

Tree requires a special xml format and it is not possible to load tree xml in another format.  Please, see the correct tree format here -  http://docs.dhtmlx.info

>> What sort of validation can be followed when we use this component?
>> For e.g: while inserting a new node/ editing an existing node - how is invalid values check/ invalid schema check done?
>> Should I transform between the real xml and rendered xml to perform these checks?

There are no any special API to check nodes values.

Before insertNewItem command will be done, you can simply check the text which is inserted.

Item ids should be unique, so if the new item has the same id with existent item, the id of new item will be changed automatically.

Tree provides "onEdit" event handler which allows to carried out checking data and confirm / deny editing results.