Hi all
I came across some unusual behaviour with XMLToCursor which the following code clearly demonstrates:
Local lcXML Create Cursor curSource (A N(1), B N(1), C N(1)) Insert Into curSource Values(0,1,2) CursorToXML("curSource","lcXML") Browse Nowait XMLToCursor(lcXML,"curTarget") Browse Nowait
lcXML looks like this: <?xml version = "1.0" encoding="Windows-1252" standalone="yes"?> <VFPData> <cursource> <a>0</a> <b>1</b> <c>2</c> </cursource> </VFPData>
In curTarget fields A and B are logical. Can anybody throw any light on this, particularly how the XML should be constructed so as to ensure that fields A and B are created as type numeric?
Many thanks
Paul Newton
When you issue the CursortoXML() use this:
CursorToXML("curSource","lcXML", 1, 0, 0, "1")
The final parameter creates an inline schema so that XMLtoCursor knows what the column types are.
Laurie
On 21 July 2016 at 11:50, Paul Newton Paul.Newton@pegasus.co.uk wrote:
Hi all
I came across some unusual behaviour with XMLToCursor which the following code clearly demonstrates:
Local lcXML Create Cursor curSource (A N(1), B N(1), C N(1)) Insert Into curSource Values(0,1,2) CursorToXML("curSource","lcXML") Browse Nowait XMLToCursor(lcXML,"curTarget") Browse Nowait
lcXML looks like this:
<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
<VFPData> <cursource> <a>0</a> <b>1</b> <c>2</c> </cursource> </VFPData>
In curTarget fields A and B are logical. Can anybody throw any light on this, particularly how the XML should be constructed so as to ensure that fields A and B are created as type numeric?
Many thanks
Paul Newton
[excessive quoting removed by server]
Many, many thanks Laurie
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 21 July 2016 12:02 To: profoxtech@leafe.com Subject: Re: XMLToCursor converting numeric values to logical fields
When you issue the CursortoXML() use this:
CursorToXML("curSource","lcXML", 1, 0, 0, "1")
The final parameter creates an inline schema so that XMLtoCursor knows what the column types are.
Laurie
On 21 July 2016 at 11:50, Paul Newton Paul.Newton@pegasus.co.uk wrote:
Hi all
I came across some unusual behaviour with XMLToCursor which the following code clearly demonstrates:
Local lcXML Create Cursor curSource (A N(1), B N(1), C N(1)) Insert Into curSource Values(0,1,2) CursorToXML("curSource","lcXML") Browse Nowait XMLToCursor(lcXML,"curTarget") Browse Nowait
lcXML looks like this:
<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
<VFPData> <cursource> <a>0</a> <b>1</b> <c>2</c> </cursource> </VFPData>
In curTarget fields A and B are logical. Can anybody throw any light on this, particularly how the XML should be constructed so as to ensure that fields A and B are created as type numeric?
Many thanks
Paul Newton
[excessive quoting removed by server]
Further, I believe that, by default, 0 and 1 are treated as Boolean.
Laurie
On 21 July 2016 at 12:01, Laurie Alvey trukker41@gmail.com wrote:
When you issue the CursortoXML() use this:
CursorToXML("curSource","lcXML", 1, 0, 0, "1")
The final parameter creates an inline schema so that XMLtoCursor knows what the column types are.
Laurie
On 21 July 2016 at 11:50, Paul Newton Paul.Newton@pegasus.co.uk wrote:
Hi all
I came across some unusual behaviour with XMLToCursor which the following code clearly demonstrates:
Local lcXML Create Cursor curSource (A N(1), B N(1), C N(1)) Insert Into curSource Values(0,1,2) CursorToXML("curSource","lcXML") Browse Nowait XMLToCursor(lcXML,"curTarget") Browse Nowait
lcXML looks like this:
<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
<VFPData> <cursource> <a>0</a> <b>1</b> <c>2</c> </cursource> </VFPData>
In curTarget fields A and B are logical. Can anybody throw any light on this, particularly how the XML should be constructed so as to ensure that fields A and B are created as type numeric?
Many thanks
Paul Newton
[excessive quoting removed by server]
Another way to get around the issue without relying on the schema is to append the data to an existing pre-defined cursor, like this:
Local lcXML lcXML = "<VFPData><cursource><a>0</a><b>1</b><c>2</c></cursource></VFPData>" Create Cursor curTest(a N(1), b N(1), c N(1)) XMLToCursor(lcXML, "curTest", 8192) Browse
Paul Newton
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul Newton Sent: 21 July 2016 11:50 To: profoxtech@leafe.com Subject: XMLToCursor converting numeric values to logical fields
Hi all
I came across some unusual behaviour with XMLToCursor which the following code clearly demonstrates:
Local lcXML Create Cursor curSource (A N(1), B N(1), C N(1)) Insert Into curSource Values(0,1,2) CursorToXML("curSource","lcXML") Browse Nowait XMLToCursor(lcXML,"curTarget") Browse Nowait
lcXML looks like this: <?xml version = "1.0" encoding="Windows-1252" standalone="yes"?> <VFPData> <cursource> <a>0</a> <b>1</b> <c>2</c> </cursource> </VFPData>
In curTarget fields A and B are logical. Can anybody throw any light on this, particularly how the XML should be constructed so as to ensure that fields A and B are created as type numeric?
Many thanks
Paul Newton
[excessive quoting removed by server]