sandie
04-12-2005, 10:34 AM
hi,
I have a document like
<resources>
<resource>
<name>name1</name>
<parent>root</parent>
<properties>
<property>prop1</property>
<property>prop2</property>
</properties>
</resource>
<resource>
<name>name2</name>
<parent>Node</parent>
<properties>
<property>prop1</property>
<property>prop2</property>
<property>prop3</property>
</properties>
</resource>
<resource>
<name>name3</name>
<parent>name2</parent>
<properties>
<property>prop1</property>
<property>prop3</property>
</properties>
</resource>
</resources>
and I am trying to parse it to populate some internal data structure but I am stuck and need some help.
I want to print all the data in the right order including properties. something like
<canvas height="250" width="500" bgcolor="#D4D0C8" debug="true">
<dataset name="myData" src="./constants.xml" />
<datapointertr name="ptr" />
<datapointer xpath="myData:/resources/" ondata="processData()">
<method name="processData">
this.selectChild(0);
do {
debug.write(" name = " + this.xpathQuery('name/text()'));
debug.write(" parent = " + this.xpathQuery('parent/text()'));
debug.write(" properties = " + this.xpathQuery('properties/property[1]/text()'));
var dp = this.xpathQuery('properties/');
ptr.setXPath( dp );
ptr.selectChild();
do {
debug.write(" property = " + ptr.xpathQuery('property/text()'));
} while (ptr.selectNext());
} while (this.selectNext());
</method>
</datapointer>
</canvas>
Now, I know this is worng, but this is what I want to do, print the properties attribute for every resource...
can anyone help pls.... The xml data is the content of constants.cml file.
Thanks for your help.
cheers,
sandie
I have a document like
<resources>
<resource>
<name>name1</name>
<parent>root</parent>
<properties>
<property>prop1</property>
<property>prop2</property>
</properties>
</resource>
<resource>
<name>name2</name>
<parent>Node</parent>
<properties>
<property>prop1</property>
<property>prop2</property>
<property>prop3</property>
</properties>
</resource>
<resource>
<name>name3</name>
<parent>name2</parent>
<properties>
<property>prop1</property>
<property>prop3</property>
</properties>
</resource>
</resources>
and I am trying to parse it to populate some internal data structure but I am stuck and need some help.
I want to print all the data in the right order including properties. something like
<canvas height="250" width="500" bgcolor="#D4D0C8" debug="true">
<dataset name="myData" src="./constants.xml" />
<datapointertr name="ptr" />
<datapointer xpath="myData:/resources/" ondata="processData()">
<method name="processData">
this.selectChild(0);
do {
debug.write(" name = " + this.xpathQuery('name/text()'));
debug.write(" parent = " + this.xpathQuery('parent/text()'));
debug.write(" properties = " + this.xpathQuery('properties/property[1]/text()'));
var dp = this.xpathQuery('properties/');
ptr.setXPath( dp );
ptr.selectChild();
do {
debug.write(" property = " + ptr.xpathQuery('property/text()'));
} while (ptr.selectNext());
} while (this.selectNext());
</method>
</datapointer>
</canvas>
Now, I know this is worng, but this is what I want to do, print the properties attribute for every resource...
can anyone help pls.... The xml data is the content of constants.cml file.
Thanks for your help.
cheers,
sandie