View Full Version : compilation warnings re: extended dataset
mcgaffin
02-16-2005, 06:12 AM
I created a class to extend dataset for session tracking as described here (http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=2145&highlight=cookie).
Here is its definition:
<script>
var jsessionid = "";
</script>
<class name="sessiondataset" extends="dataset" getresponseheaders="true">
<method name="doRequest">
this.setHeader("Cookie", jsessionid);
super.doRequest();
</method>
<method event="ondata" args="d">
jsessionid = this.getResponseHeader('Set-Cookie');
</method>
</class>
The code works and instances of sessiondataset have their sessions tracked correctly.
However, the compiler complains thusly:
element "sessiondataset" not allowed in this context. Check whether it is spelled correctly, and whether a class with this name exists.
Is there any way to suppress this warning or is extending dataset not supported/recommended?
Pedro
12-27-2005, 06:54 AM
Hello!!
I have exactly the same problem. I need to extend the dataset class to introduce some common properties and I can't. Actually, I have the warnings but then it works fine.
This is specially useful to have two environments (Development and Production), and not to have to modify the "src" attribute of the dataset to point to producction environment. You can simply have an XML file where is written the path to where your bussiness logic is located. Then if you have the program tested in development, you only have to FTP the new SWF file.
Something like this:
<dataset name="dsConfig" src="config.xml" autorequest="true"/>
<class name="myDataset" extends="dataset">
<attribute name="call"/>
<attribute src="$once{dsConfig.getPointer().xpathQuery('dsConfig:/config/@BLPath')}"/>
</class>
<myDataset name="test" call="myprogram.php"/>
...and the config.xml file could be simply:
<config BLPath="http://myserver.com/myfolder/"/>
I guess that the warnings appear because datasets are special objects. That's why all the datasets always are hanged directly to the canvas.
I hope that someone from LaszloSystems reads this and tell us something, jejeje...
Enjoy Laszlo,
Pedro.
jshood
01-02-2006, 07:01 PM
We've got the same problem. I'm currently extending the dataset class to enforce our security model. Adding authentication information and checking session ID.
Anyone have an idea where to start looking in the compiler to disable this message?
-Jeff
laszfellow
09-06-2006, 01:30 PM
Subclass of dataset would not work properly.
WRT the following code:
==================================================
<class name='zDataset' extends='dataset'>
<method name='httpPost' args='paramname, msgds'>
var dsxml = msgds.serialize();
setQueryParam(paramname, dsxml);
setQueryType("POST");
doRequest();
</method>
</class>
<zDataset name="zDdata" src="data/zData.xml"/>
<dataset name="dData" src="data/zData.xml"/>
==================================================
Serializing dData would produce the expected contents from the zData.xml, encapsulated in <dData></dData> tags.
However, serializing zData would produce an empty tag <zData/>.
laszfellow
09-07-2006, 11:11 AM
Furthermore, I am unable to insert xml data within the subclass of dataset.
The following xml does not present a problem.
<dataset name='hcal8'>
<HolyDay>
<day>Rosh HaShannah</day>
<datetime zip='06106'>
2006-09-22 18:49
</datetime>
<hdate>1 Tishri 5767</hdate>
<greet>L'Shana Tova</greet>
</HolyDay>
</dataset>
However, using the subclass of dataset,
compilation errors appear:
<zDataset name='hcal8'>
<HolyDay>
<day>Rosh HaShannah</day>
<datetime zip='06106'>
2006-09-22 18:49
</datetime>
<hdate>1 Tishri 5767</hdate>
<greet>L'Shana Tova</greet>
</HolyDay>
</zDataset>
element "zDataset" not allowed in this context. Check whether it is spelled correctly, and whether a class with this name exists.
element "HolyDay" not allowed in this context. Check whether it is spelled correctly, and whether a class with this name exists.
found an unknown attribute named "zip" on element datetime, check the spelling of this attribute name
laszfellow
09-11-2006, 03:00 PM
Laszlo XML structure does not allow dataset node to be located below canvas level, but LzDataset function does.
Refer to rpc/ajax.lzx for XMLHttpRequest class to see how Laszlo does it. The basic approach is to define a dataset container class.
<library>
<class name='datasetContainer' extends='node'>
<attribute name='dataset' value='null'/>
<attribute name='ptr' value='null'/>
<attribute name='rootXPath' type='string'/>
<method name='init'>
super.init();
if (this.dataset == null)
this.dataset = new LzDataset(this);
this.ptr = this.dataset.getPointer();
</method>
</class>
</library>
To "reflect" dataset methods, e.g. the setXPath method, we could insert a method.
<method name="setXPath" args="xpath">
if (this.ptr != null)
this.ptr.setXPath(xpath);
</method>
Such use of LzDataset() allows burying datasets deep into substrata beneath the canvas.
jamesej
01-11-2007, 06:50 AM
Has anyone from OL been able to answer the question as to whether it is actually safe to subclass a dataset despite the compilation warning? I'm doing it it works fine but would like to have it officially blessed.
James
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.