Contents of a field to XML...

David Bovill david at openpartnership.net
Thu Jan 11 07:40:06 EST 2007


Thanks Jan - a couple of things. First I think Rev"s XML parser seems to
complain with certian entities "Ä" for instance - which surprised me -
I am looking into it now - does anyone now what XML parser RunRe uses -
thought it was XPAT based??? And anyone know what other entities / quirks
cause problems for the Runrev XML parser?

Second xHtml compliance is what I am looking at - which means the "font"
tags are a no-no. I did not notice the non-closure of the image tag - is
that filed as a bug - should be dead easy for Rev to fix no?

On 10/01/07, Jan Schenkel <janschenkel at yahoo.com> wrote:
>
> --- David Bovill <david at openpartnership.net> wrote:
> > Related to the lastpost I'm looking for the most
> > general way to take any
> > text in field an put it into an XML document?
> >
> > I was hoping that htmltext would do the trick but is
> > is not xHTML compliant,
> > so I am thinking about using the unicode functions
> > and UTF8 - would that be
> > the way to go? And if so what are the issues in
> > terms of making the document
> > cross platform?
> >
>
> Hi David,
>
> A while ago I needed a way to make the htmlText of a
> field XML-compliant. The main difficulty was in the
> img tags which aren't closed. Here's what I came up
> with:
> ##
> function htmlText2xml pHtmlText
>   put "<img src=" & quote into kOPENTAG
>   put quote & ">" into kCLOSETAG
>   --
>   put 0 into tStart
>   put offset(kOPENTAG,pHtmlText,tStart) into tOffset
>   repeat until tOffset = 0
>     put offset(kCLOSETAG,pHtmlText,tStart+tOffset)
> into tEnd
>     put " /" after char tStart+tOffset+tEnd of
> pHtmlText
>     add tOffset + 10 to tStart
>     put offset(kOPENTAG,tText,tStart) into tOffset
>   end repeat
>   return "<?xml version=" & quote & "1.0" & quote &
> "?> & return & \
>       "<html>" & return & pHtmlText & return &
> "</html>"
> end htmlText2xml
> ##
>
> As the htmlText will automatically replace any
> non-Latin characters with enity numbers, you don't
> have to worry too much about Unicode.
> Some XML parsers will complain that these entities
> aren't specified anywhere. But at least you can
> process the resulting xml with Rev's xml library
> calls.
>
> Hope this helped,
>
> Jan Schenkel.
>
> Quartam Reports for Revolution
> <http://www.quartam.com>
>
> =====
> "As we grow older, we grow both wiser and more foolish at the same
> time."  (La Rochefoucauld)
>
>
>
>
> ____________________________________________________________________________________
> Yahoo! Music Unlimited
> Access over 1 million songs.
> http://music.yahoo.com/unlimited
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list