Naive XML questions

2020-10-25 Thread Graham Samuel via use-livecode
I feel stupid, but even with Sarah Reichelt’s help, there are very very simple 
things I can’t do with the LC XML functions. My current problem is this:

I have a series of XML files which are in fact .gpx files - a collection of GPS 
coordinates representing a route on the Earth’s surface. There are thousands of 
files around which I can use as test data, so I don’t have to roll my own. 
Taking just one of these examples, I can do the following in LC

1. Get the user to find the file and download it

2. Check it’s a .gpx file

3. Turn it into an LC XML data structure with an integer ID

4. Find out how many child nodes there are.

Then it all goes wrong, because I don’t seem to be able to address the 
individual nodes. This is obviously needed for further progress, in functions 
like revXMLFirstChild  and revXMLNodeContents.

I just don’t know what format to use. Sarah’s tutorial doesn’t help because her 
data structure is too simplified.

If you’re still with me, this is what the beginning of a typical file looks 
like:

> 
> http://www.topografix.com/GPX/1/1; creator="Digital Crow" 
> version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
> xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
> http://www.topografix.com/GPX/1/1/gpx.xsd;>
>  
>  
>

> 
> 169.623637 

> 
> 169.744722 

> 
> 169.744722 

> 
> 169.266626 
> 
etc - there may sometimes be thousands of these “trkpt” elements.

So, suppose I want to get the first instance of the “lon” attribute into a 
local variable. How do I address the first  node etc in order to do it? I 
have attempted various common-sense methods, but none work.

This must be child’s play to a lot of people, just not me.

Hoping for some guidance.

Graham
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Naive XML questions

2020-10-25 Thread Alex Tweedly via use-livecode
I know nothing about it, so I can feel free to answer:-)

Don’t care about the file format- look at the array format, probably in the 
IDE/debugger. That’s probably going to let you see how to address the 
individual nodes.
Alex

Sent from my iPhone

> On 25 Oct 2020, at 17:21, Graham Samuel via use-livecode 
>  wrote:
> 
> I feel stupid, but even with Sarah Reichelt’s help, there are very very 
> simple things I can’t do with the LC XML functions. My current problem is 
> this:
> 
> I have a series of XML files which are in fact .gpx files - a collection of 
> GPS coordinates representing a route on the Earth’s surface. There are 
> thousands of files around which I can use as test data, so I don’t have to 
> roll my own. Taking just one of these examples, I can do the following in LC
> 
> 1. Get the user to find the file and download it
> 
> 2. Check it’s a .gpx file
> 
> 3. Turn it into an LC XML data structure with an integer ID
> 
> 4. Find out how many child nodes there are.
> 
> Then it all goes wrong, because I don’t seem to be able to address the 
> individual nodes. This is obviously needed for further progress, in functions 
> like revXMLFirstChild  and revXMLNodeContents.
> 
> I just don’t know what format to use. Sarah’s tutorial doesn’t help because 
> her data structure is too simplified.
> 
> If you’re still with me, this is what the beginning of a typical file looks 
> like:
> 
>> 
>> http://www.topografix.com/GPX/1/1; creator="Digital Crow" 
>> version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
>> xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
>> http://www.topografix.com/GPX/1/1/gpx.xsd;>
>> 
>> 
>>   
> 
>> 
>> 169.623637 
> 
>> 
>> 169.744722 
> 
>> 
>> 169.744722 
> 
>> 
>> 169.266626 
>> 
> etc - there may sometimes be thousands of these “trkpt” elements.
> 
> So, suppose I want to get the first instance of the “lon” attribute into a 
> local variable. How do I address the first  node etc in order to do it? 
> I have attempted various common-sense methods, but none work.
> 
> This must be child’s play to a lot of people, just not me.
> 
> Hoping for some guidance.
> 
> Graham
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Naive XML questions

2020-10-25 Thread Bernard Devlin via use-livecode
In his reply to you I think Alex is suggesting you use the handlers that
come with the  Datagrid.  These can convert xml to a LC array.  You might
find it easier just to deal with a familair data structure rather than
learn XML.

I found them here: http://revonline2.runrev.com/stack/571/XMLAndArrays

But the handlers are also to be found inside the datagrid library in the
IDE (I suspect they are more up to date).

On Sun, Oct 25, 2020 at 5:22 PM Graham Samuel via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I feel stupid, but even with Sarah Reichelt’s help, there are very very
> simple things I can’t do with the LC XML functions. My current problem is
> this:
>
> I have a series of XML files which are in fact .gpx files - a collection
> of GPS coordinates representing a route on the Earth’s surface. There are
> thousands of files around which I can use as test data, so I don’t have to
> roll my own. Taking just one of these examples, I can do the following in LC
>
> 1. Get the user to find the file and download it
>
> 2. Check it’s a .gpx file
>
> 3. Turn it into an LC XML data structure with an integer ID
>
> 4. Find out how many child nodes there are.
>
> Then it all goes wrong, because I don’t seem to be able to address the
> individual nodes. This is obviously needed for further progress, in
> functions like revXMLFirstChild  and revXMLNodeContents.
>
> I just don’t know what format to use. Sarah’s tutorial doesn’t help
> because her data structure is too simplified.
>
> If you’re still with me, this is what the beginning of a typical file
> looks like:
>
> > 
> > http://www.topografix.com/GPX/1/1; creator="Digital Crow"
> version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
> xsi:schemaLocation="http://www.topografix.com/GPX/1/1
> http://www.topografix.com/GPX/1/1/gpx.xsd;>
> >  
> >  
> >
>
> > 
> > 169.623637 
>
> > 
> > 169.744722 
>
> > 
> > 169.744722 
>
> > 
> > 169.266626 
> >
> etc - there may sometimes be thousands of these “trkpt” elements.
>
> So, suppose I want to get the first instance of the “lon” attribute into a
> local variable. How do I address the first  node etc in order to do
> it? I have attempted various common-sense methods, but none work.
>
> This must be child’s play to a lot of people, just not me.
>
> Hoping for some guidance.
>
> Graham
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to resolve "unable to locate play service dependency base version 9.4.0"

2020-10-25 Thread Richard Gaskin via use-livecode

Panos wrote:

> This will probably help:
>
> https://quality.livecode.com/show_bug.cgi?id=22384

The instructions in your comment there certainly did.  Thank you.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


iOS Emoji keyboard does not print to PDF?!

2020-10-25 Thread William de Smet via use-livecode
Hi there,

A simple iOS app in which the user chooses the iOS keyboard to add text and
an Emoji to a standard LC text field.
I use 'export snapshot' to PDF as PNG to print to PDF.
When there is only text in the field all text is printed to the PDF but
when an Emoji is added the Emoji is not printed to the PDF.
Am I missing something?
Do I need to add some code?

iOS 13
LC 9,6,1 Indy


greetings,

William
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: iOS Emoji keyboard does not print to PDF?!

2020-10-25 Thread Richmond via use-livecode

" 'export snapshot' to PDF as PNG" sounds a bit odd.

On 25.10.20 21:47, William de Smet via use-livecode wrote:

Hi there,

A simple iOS app in which the user chooses the iOS keyboard to add text and
an Emoji to a standard LC text field.
I use 'export snapshot' to PDF as PNG to print to PDF.
When there is only text in the field all text is printed to the PDF but
when an Emoji is added the Emoji is not printed to the PDF.
Am I missing something?
Do I need to add some code?

iOS 13
LC 9,6,1 Indy


greetings,

William
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Naive XML questions

2020-10-25 Thread Alex Tweedly via use-livecode

On 25/10/2020 18:51, Bernard Devlin via use-livecode wrote:


In his reply to you I think Alex is suggesting you use the handlers that
come with the  Datagrid.  These can convert xml to a LC array.  You might
find it easier just to deal with a familair data structure rather than
learn XML.

I found them here: http://revonline2.runrev.com/stack/571/XMLAndArrays

But the handlers are also to be found inside the datagrid library in the
IDE (I suspect they are more up to date).


Or indeed on Trevor's GitHub page, which is where I could vaguely 
remember having seen them.


But wherever you get them from, they do provide a (fairly 
straightforward) familiar interface of a LC array.


(And give us yet another reason to say "thank you" to Trevor :-)

Alex.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Naive XML questions

2020-10-25 Thread Ken Ray via use-livecode
Graham, here's the basic approach (assuming your XML is in the variable 'tXML'):

put revXMLCreateTree(tXML,false,true,false) into tTreeID
put  "/gpx/trk/trkseg/trkpt[1]" into tNode  -- the brackets identify 
the instance of "trkpt" to work with
put revXMLAttribute(tTreeID, tNode,"lon") into tLonValue
put revXMLNodeContents(tTreeID,(tNode & "/ele")) into tEleValue
put tLonValue && "/" && tEleValue

>> 2.128369 / 169.623637

So to work with the third instance of "trkpt", you'd do:

put  "/gpx/trk/trkseg/trkpt[3]" into tNode

Hope this helps,

Ken


> On Oct 25, 2020, at 12:21 PM, Graham Samuel via use-livecode 
>  wrote:
> 
> I feel stupid, but even with Sarah Reichelt’s help, there are very very 
> simple things I can’t do with the LC XML functions. My current problem is 
> this:
> 
> I have a series of XML files which are in fact .gpx files - a collection of 
> GPS coordinates representing a route on the Earth’s surface. There are 
> thousands of files around which I can use as test data, so I don’t have to 
> roll my own. Taking just one of these examples, I can do the following in LC
> 
> 1. Get the user to find the file and download it
> 
> 2. Check it’s a .gpx file
> 
> 3. Turn it into an LC XML data structure with an integer ID
> 
> 4. Find out how many child nodes there are.
> 
> Then it all goes wrong, because I don’t seem to be able to address the 
> individual nodes. This is obviously needed for further progress, in functions 
> like revXMLFirstChild  and revXMLNodeContents.
> 
> I just don’t know what format to use. Sarah’s tutorial doesn’t help because 
> her data structure is too simplified.
> 
> If you’re still with me, this is what the beginning of a typical file looks 
> like:
> 
>> 
>> http://www.topografix.com/GPX/1/1; creator="Digital Crow" 
>> version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
>> xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
>> http://www.topografix.com/GPX/1/1/gpx.xsd;>
>> 
>> 
>>   
> 
>> 
>> 169.623637 
> 
>> 
>> 169.744722 
> 
>> 
>> 169.744722 
> 
>> 
>> 169.266626 
>> 
> etc - there may sometimes be thousands of these “trkpt” elements.
> 
> So, suppose I want to get the first instance of the “lon” attribute into a 
> local variable. How do I address the first  node etc in order to do it? 
> I have attempted various common-sense methods, but none work.
> 
> This must be child’s play to a lot of people, just not me.
> 
> Hoping for some guidance.
> 
> Graham
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Website: https://www.sonsothunder.com




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: iOS Emoji keyboard does not print to PDF?!

2020-10-25 Thread scott--- via use-livecode
I think that emojis not rendering to PDF has been a longstanding issue… and I 
thought that I had filed a bug report on this but looking at bugzilla, I failed 
to find it. (sigh). I have code in two of my apps that alert the user, should 
PDF creation fail, that they should remove emojis from their text.  I have on 
my to-do list a workaround project that would use imageSource to substitute for 
known emoji codes. So, while none of this is of any help, I feel your pain :- )

--
Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web   https://elementarysoftware.com/
email sc...@elementarysoftware.com
booth1-360-734-4701
--

> On Oct 25, 2020, at 2:34 PM, William de Smet via use-livecode 
>  wrote:
> 
> Hi Richmond,
> 
> That’s the short version of the code.
> Like I said it works fine as long as it is text only. When an Emoji from the 
> iOS keyboard is added the Emoji is not printed in the PDF. 
> 
> 
> 
> 
> 
> 
>> Op 25 okt. 2020 om 21:13 heeft Richmond via use-livecode 
>>  het volgende geschreven:
>> 
>> " 'export snapshot' to PDF as PNG" sounds a bit odd.
>> 
>>> On 25.10.20 21:47, William de Smet via use-livecode wrote:
>>> Hi there,
>>> 
>>> A simple iOS app in which the user chooses the iOS keyboard to add text and
>>> an Emoji to a standard LC text field.
>>> I use 'export snapshot' to PDF as PNG to print to PDF.
>>> When there is only text in the field all text is printed to the PDF but
>>> when an Emoji is added the Emoji is not printed to the PDF.
>>> Am I missing something?
>>> Do I need to add some code?
>>> 
>>> iOS 13
>>> LC 9,6,1 Indy
>>> 
>>> 
>>> greetings,
>>> 
>>> William
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: iOS Emoji keyboard does not print to PDF?!

2020-10-25 Thread William de Smet via use-livecode
Hi Richmond,

That’s the short version of the code.
Like I said it works fine as long as it is text only. When an Emoji from the 
iOS keyboard is added the Emoji is not printed in the PDF. 






> Op 25 okt. 2020 om 21:13 heeft Richmond via use-livecode 
>  het volgende geschreven:
> 
> " 'export snapshot' to PDF as PNG" sounds a bit odd.
> 
>> On 25.10.20 21:47, William de Smet via use-livecode wrote:
>> Hi there,
>> 
>> A simple iOS app in which the user chooses the iOS keyboard to add text and
>> an Emoji to a standard LC text field.
>> I use 'export snapshot' to PDF as PNG to print to PDF.
>> When there is only text in the field all text is printed to the PDF but
>> when an Emoji is added the Emoji is not printed to the PDF.
>> Am I missing something?
>> Do I need to add some code?
>> 
>> iOS 13
>> LC 9,6,1 Indy
>> 
>> 
>> greetings,
>> 
>> William
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode