|
Rank: Member Groups: Member
Joined: 6/14/2007 Posts: 9
|
I am using 3 of your treeviews in an ASP.NET application; In one of the treeview, I want to be able to display City names which would contain characters like spaces, apostrophes and other problematic characters. Actually, my questions are; 1)- Is the treeview able to display these tag names (SEE: New Holland and O'Neil in my example below) 2)- Taking into account the 1st question, if the answer is YES, how should I present it to XML in order to get valid tag names that can be displayed by the treeview; I went into research about UTF-8 encoding of common ASCII characters in Version 1.0, but found nothing conclusive about using replacement codes to allow such problematic tag names (since Holland f.e., would be considered as an attribute by XML exactly as ID and SsID are, in my example below, without such encoding)
<?xml version="1.0" encoding="utf-8"?> <City> <New Holland ID="20" SsID="9"> </New Holland> <O'Neil ID="30"> </O'Neil> </City>
Thanks for your guidance; My problem has been solved
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, The TreeView only displays attribute values, not tag names. For example, it can works with this kind of XML:
Code: XML
<city name="New Holland" .....>
</city>
This also leads to the answer to the second question: While XML file does allow you to put UTF-8 names, I do not believe you should use city name as tag name. There are a number of reasons, one of the most important reason is that XML supposes to be well structured data. Which means sibling elements with the same structure usually should have the same tagName. Another reason is that you need to escape UTF-8 characters; you also can not have space in tag names --- all these making it an unpractical solution. Thanks
|
|
Rank: Member Groups: Member
Joined: 6/14/2007 Posts: 9
|
Well, I have 3 treeviews, and I simply set their: XmlFile attribute to, say: ~/Dossiers.xml in one case, with the following file content (I just added the name attribute as a test, as in your example)
<?xml version="1.0" encoding="UTF-8"?> <Dossier> <Doss1 name="Doss" ID="-1" SsID="-2"> <Doss2 name="DossA" ID="-2" SsID="2"> <Doss3 name="DossAA" ID="2" SsID="3"> </Doss3> </Doss2> <Doss4 name="DossB" ID="-2" SsID="4"> <Doss5 name="DossBB" ID="4" SsID="5"> </Doss5> </Doss4> </Doss1> </Dossier>
The result, contrarily to what you would expect is that the treeView displays: Doss1 Doss2 Doss3 Doss4 Doss5
AND NOT:
Doss DossA DossAA DossB DossBB
as your explanation tends to imply; Actually, if there many attributes in each XML entry, I dont know how the treeView would know which one to select for display. In fact, if I came with my question. This is because my treeViews always displayed tag names (not attributes); I could provide you a picture as proof; Just tell me how I can do so on your forum. I must specify that I use: E.O. Web Controls 2007.1 Microsoft Visual WEB Developer 2005 Version 8 ... (VSVista) Microsoft Windows Vista Family Premium Edition S.P. 1
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Webideal wrote:Actually, if there many attributes in each XML entry, I dont know how the treeView would know which one to select for display. That's a very good and logical question. In fact you need to tell the TreeView which attribute to use, unless you use certain pre-defined attributes. You can find a working example and detailed information at here: http://www.essentialobjects.com/ViewDoc.aspx?t=MenuCommon%2fDataBinding%2fpopulate_datasource.htmlThanks
|
|