why XHTML cannot be parsed with RevXML ?
paolo.mazza at neol.it
Mon Mar 17 11:44:57 CDT 2008
I find very difficult to manage the XHTML code with the RevXML tools if
these tools do not manage consistently some special chars like & .
Consider this: I want to change some words in this XHTML page (field
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
I use this script:
put RevCreateXMLTree(field "FieldXML",true,true,false) into NUMERO
revPutIntoXMLNode NUMERO,"html//body/p","Char è "
put revXMLText(NUMERO) into CODICE
put CODICE into message
set the HtmlText of field "browser" to CODICE
The text in field "browser" will be:
What's wrong with my script? How can I get the correct XHTML code?
I thought it was a bug (
http://quality.runrev.com/qacenter/show_bug.cgi?id=6061 ) . But they told
me I was wrong (see the following message from Mark). I can not find a
solution to thi problem.
Thanks for the report.
This change in behaviour is due to the fix to Bug 5283 - the behaviour of
revPutIntoXMLNode, revAppendXMLNode and revXMLText is now correct and
consistent. Both PutIntoXMLNode and AppendXMLNode assume that you are given
them a string of text encoded in the native encoding of the XML file (the
attribute in the ?xml header). In particular, they will escape the uses of
'>' and '&'.
Unless you attach a DTD to you XML document, the only entities defined are
gt, quot, and amp. In particular, if you wish to use entities from HTML you
need to add explicit <!ENTITY ...> definitions to your XML tree. (egrave
Therefore, if you want to read an XML document which uses entities, you
ensure it either has a DTD attached, or the <!ENTITY ...> declarations at
start. After such a document has been read into memory, however, you can
things such as XMLNodeContents and PutIntoXMLNode to manipulate the text
content *without* using entities.
How to use Revolution <use-revolution at lists.runrev.com> writes:
>On Fri, 14 Mar 2008 14:54:05 +0100, David Bovill wrote:
>> Paolo - from memory the issue is not that you cannot parse valid XHTML
>> Revs XML externals, rather that Revs native htmltext is not valid XML
>> therefore cannot be parsed using Revs XML externals! Strange but true.
>> However from memory the problem is caused by html entities not being
>> in htmltext and breaking the XML parsing. You can get around this by
>> replacing the htmltext enitities with XML compliant ones.
>> You should not have any problems with valid XHTML though.
>Right, that's my understanding as well... the main issue for XML
>parsers is that a lot of HTML is not compliant - for example using a
>single <P> instead of <P></P>. This leaves an open tag without a
>closing tag. Now if it is *valid* XHTML, you *should* be able to parse
>the tags with XML parsing tools (Rev's included). Can you provide an
>example of compliant XHTML syntax that doesn't parse? Just curious...
>Sons of Thunder Software, Inc.
>Email: kray at sonsothunder.com
>Web Site: http://www.sonsothunder.com/
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
Società partecipata da Università di Padova
via N. Tommaseo 84
35131 - Padova (Italy)
Tel 049- 2050147 - Fax 049-7964386
More information about the use-livecode