[Dojo-interest] http://dojo.jot.com/Parser

Cameron Braid cameron at braid.com.au
Wed May 4 06:12:00 PDT 2005


I have been looking at the dojo.xml.Parser class to be able to automatically
convert some fragments into javascript objects.

The document at http://dojo.jot.com/Parser describes the object structure -
however it is incorrect.  It implies that attributes are converted to an
array with the value at index 0.  IT does infact produce an array, however
it stores a hash with the value keyed on 'value' in this 0th element.

<dojo:button dataProvider="#buttonDataProvider">
	<dojo:image xlink:href="test.png">
</dojo:button>

Is stated to get parsed to: 

	{"dojo:button"[0]:{
		dataProvider[0]:"#buttonDataProvider",
		"dojo:image"[0]: {
			xlink:href[0]:"test.png"
			tagName:"dojo:image",
			nodeRef:[object DojoImageElement]
		},
		tagName:"dojo:button",
		nodeRef:[object DojoButtonElement]
	}}  

Where as it actually is :

	{"dojo:button"[0]:{
		dataProvider[0]:{ value : "#buttonDataProvider"},
		"dojo:image"[0]: {
			xlink:href[0]:{ value : "test.png" }
			tagName:"dojo:image",
			nodeRef:[object DojoImageElement]
		},
		tagName:"dojo:button",
		nodeRef:[object DojoButtonElement]
	}}  


Which is correct - the documentation or the implementation ?

Also, why are attributes stored in arrays - is it to provide a consistent
'every attribute and every element map to arrays' pattern ?

Thanks.

Cameron



More information about the Dojo-interest mailing list