Thank you PT, it is getting near to my point. :)
I can understand what the action of serialize().
But could not on xpathQuery().
According with you said 'raw data', i am wondering xpathQuery() should
return as same as seriarize(), that mean is '<ABCD>'.
Do i misunderstand in 'raw data'?
And where does it parse from '&lt' to '<', *as or LPS?

Thx
mt1

P T Withington wrote:

> When your .lzx file is parsed:
>
> <data>&lt;ABCD&gt;</data>
>
> will be stored internally as a data node with the text `<ABCD>`. You
> have to use &lt; to get past the XML parser:
>
> <data><ABCD></data>
>
> would parse ABCD as an empty child node (and give an error because
> there is no matching end tag). `&lt;` escapes the `<` past the XML
> parser, so that it is treated as text (or character data), rather than
> the beginning of an XML tag. You could also have said:
>
> <data><![CDATA[<ABCD>]]></data>
>
> `<![CDATA[` tells the XML parser to not treat `<` and `&` as special
> characters until the matching `]]>` is hit.
>
> Serialize will unescape the data contents because its contract is to
> create a representation that can be parsed (unserialized) back to the
> original data. So it shows `&lt;ABCD&gt;`. xpathQuery returns the raw
> data `<ABCD>`. If you want the result of the query to be escaped, you
> would have to do it yourself:
>
> Debug.write( "escaped dp xpathQuery: " + LzBrowser.xmlEscape
> (dp.xpathQuery("data/text()")) );
>
>
> On 2007-03-12, at 22:25 EDT, Daniel Williams wrote:
>
>> mt1,
>> I would think that Laszlo would call a 3rd party library for parsing
>> the XML.
>> You may want to ask the developers how they parse the XML for a dataset.
>>
>> Happy hunting...
>>
>> -Daniel
>>
>> mt1 wrote:
>>
>>> Daniel,
>>>
>>> Thank you for your point.
>>> And i am sorry cause of my dump, but i do not understand what you said.
>>> I know i am using a strict character.
>>> My question is
>>> 1. described in the dataset tag &#38;#60;ABCD&#38;#62;
>>> 2. when using serialize() &amp;#60;ABCD&amp;#62;
>>> 3. when using xpathQuery() &#60;ABCD&#62;
>>>
>>> In the case of 2, transferred '&#38' to '&amp'.
>>> In the case of 3, transferred '&#38' to '&'.
>>> And in the example code of setText() transferred '&#60' to '<' when
>>> it shown in then view.
>>>
>>> where those are converted to ? *.as, *.lzx or LPS ?
>>> I could not find out the converting mechanism of strict characters.
>>>
>>> Give me some hints.
>>>
>>> mt1
>>>
>>> Daniel Williams wrote:
>>>
>>>> mt1,
>>>> I missed the #38 before the ">", that's way it was displayed in the
>>>> debug window.
>>>> So the data should read &#38;#60;ABCD&#38;#62;
>>>>
>>>> My point is this http://www.w3.org/TR/REC-xml/#sec-external-ent, your
>>>> working with XML which has a strict character set.
>>>>
>>>> -Daniel
>>>>
>>>>
>>>> mt1 wrote:
>>>>
>>>>> Thank you Daniel, but I am getting confuse more.
>>>>> Your code has shown "&#60;ABCD> " in the debug window and "<ABCD>" in
>>>>> the text area.
>>>>> That mean xpathQuery() could not handle '&#38;#60;' but <text> tag
>>>>> could
>>>>> do it, right?
>>>>> Where your point is ?
>>>>>
>>>>> Thx
>>>>> mt1
>>>>>
>>>>> Daniel Williams wrote:
>>>>>
>>>>>
>>>>>> mt1,
>>>>>> I don't think this is a Laszlo code issue. You may need to use the
>>>>>> numeric reference , here is a list.
>>>>>>
>>>>>> Ampersand &amp; & &#38;#38;
>>>>>> Left angle bracket &lt; < &#38;#60;
>>>>>> Right angle bracket &gt; > &#62;
>>>>>> Straight quotation mark &quot; " &#39;
>>>>>> Apostrophe &apos; ' &#34;
>>>>>>
>>>>>>
>>>>>> Try this code out if you want to display "<ABCD>" to the user,
>>>>>> FYI I'm
>>>>>> running 3.3.3 .
>>>>>>
>>>>>> <canvas debug="true">
>>>>>> <dataset name="ds">
>>>>>> <data>&#38;#60;ABCD&#62;</data>
>>>>>> </dataset>
>>>>>>
>>>>>> <handler name="oninit">
>>>>>> var dp = new LzDatapointer();
>>>>>> dp.setPointer(ds);
>>>>>>
>>>>>> Debug.write( "dp serialize : " + dp.serialize() );
>>>>>> Debug.write( "dp xpathQuery: " + dp.xpathQuery("data/text()") );
>>>>>>
>>>>>> var text = dp.xpathQuery('data/text()');
>>>>>> testText.setAttribute('text', text);
>>>>>>
>>>>>> </handler>
>>>>>>
>>>>>> <view bgcolor="blue" width="100" height="100">
>>>>>> <text id="testText" resize="true" text="Hello"/>
>>>>>> </view>
>>>>>> </canvas>
>>>>>>
>>>>>> Just my 2 cents.
>>>>>> -Daniel
>>>>>>
>>>>>> mt1 wrote:
>>>>>>
>>>>>>
>>>>>>> Any hints?
>>>>>>>
>>>>>>> mt1 wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Yes i thought so, but there were not it in xpathQuery() method or
>>>>>>>> *.as files.
>>>>>>>> So i confused where it has been done.
>>>>>>>> You can see that where is ?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> mt1
>>>>>>>>
>>>>>>>> Not Zippy wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>> I believe the data is being unescaped.
>>>>>>>>> Debug.write(unescape("&lt;ABCD&gt;") )
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 3/5/07, *mt1* < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi forks,
>>>>>>>>>
>>>>>>>>> I am wondering how to handle a escape characters in
>>>>>>>>> LzDatapointer.xpathQuery().
>>>>>>>>> This is a example code.
>>>>>>>>>
>>>>>>>>> <canvas debug="true">
>>>>>>>>> <dataset name="ds">
>>>>>>>>> <data>&lt;ABCD&gt;</data>
>>>>>>>>> </dataset>
>>>>>>>>>
>>>>>>>>> <handler name="oninit">
>>>>>>>>> var dp = new LzDatapointer();
>>>>>>>>> dp.setPointer(ds);
>>>>>>>>>
>>>>>>>>> Debug.write( "dp serialize : " + dp.serialize() );
>>>>>>>>> Debug.write( "dp xpathQuery: " + dp.xpathQuery("data/text ()") );
>>>>>>>>> </handler>
>>>>>>>>> </canvas>
>>>>>>>>>
>>>>>>>>> You can see the data with escaped in <dataset> tag.
>>>>>>>>> And the first debug line ( using serialize() ) shows the strings
>>>>>>>>> without
>>>>>>>>> modification,
>>>>>>>>> but the second debug line ( using xpathQuery() ) shows "<ABCD>"
>>>>>>>>> out of
>>>>>>>>> the way by
>>>>>>>>> operating unescaped.
>>>>>>>>> I took a look around LzDatapointer.as or LzDataElement.as, but
>>>>>>>>> xpathQuery() do not
>>>>>>>>> translate from '&gt' to '<' anywhere.
>>>>>>>>>
>>>>>>>>> Please let me know why xpathQuery() can do such like that ?
>>>>>>>>>
>>>>>>>>> mt1
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>
>

Reply via email to