Re: VFP9 - cursortoxml

Author: Wayne Sobers

Posted: 2007-06-13 at 09:50:38

This a good resource - plus some examples.

http://foxcentral.net/microsoft/WhatsNewInVFP9_Chapter10.htm

"Rafael Copquin" <rcopquin@ciudad.com.ar>

Sent by: profoxtech-bounces@leafe.com

06/13/2007 04:45 AM

Please respond to

profox@leafe.com

To

profoxtech@leafe.com

cc

Subject

Re: VFP9 - cursortoxml

Hi Eyvind

You seem to know how to create a schema in VFP 9

I want to use the xmladapter class with the following xmlfile, that I have

to convert into a vfp cursor

<xml>

<cambio>

<articulo>77980147641323</articulo>

<origen>7798777649871</origen>

<destino>7798121754621</destino>

<cantidad>1</cantidad>

</cambio>

<cambio>

<articulo>4258574764577</articulo>

<origen>7358574764745</origen>

<destino>7798133754965</destino>

<cantidad>7</cantidad>

</cambio>

</xml>

I need the structure of the generated cursor to be:

articulo N(13)

origen N(13)

destino N(13)

cantidad N(4)

The above represents a quantity (cantidad) of a stock item (articulo) that

is moved from one position on the shelf (origen) to another position on

another shelf (destino).The values in those fields are the bar codes read

from a data collector device

Would you kindly show me how the schema would look like?

And the commands necessary to generate this cursor using the xmladapter

class with the schema?

I could use the xmltocursor function, but noticed that if the xml file

contains only one record and the value in the CANTIDAD field is either a 1

or a 0, the field generated is of type logic, placing a .T. or a .F.

instead of the 1 or the 0

Thank you very much in advance

Rafael Copquin

----- Original Message -----

From: Eyvind Axelsen

To: profoxtech@leafe.com

Sent: Wednesday, June 13, 2007 4:20 AM

Subject: Re: VFP9 - cursortoxml

An xsl is not the schema (while an xsd file is). The xsl is a style

sheet, that as you mention allows for a browser to pretty-print the xml.

To use an xsl style sheet, include a line like the following at the top

(after the <?xml version="..."?> tag) of the xml file:

<?xml-stylesheet type="text/xsl" href="your_xsl_file_here.xsl"?>

For example:

<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/xsl" href="simple.xsl"?>

<breakfast_menu>

<food>

<name>Belgian Waffles</name>

<price>$5.95</price>

<description>

two of our famous Belgian Waffles

</description>

<calories>650</calories>

</food>

</breakfast_menu>

And the corresponding xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>

<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns="" target="_blank">http://www.w3.org/1999/xhtml">

<body style="font-family:Arial,helvetica,sans-serif;font-size:12pt;

background-color:#EEEEEE">

<xsl:for-each select="breakfast_menu/food">

<div style="background-color:teal;color:white;padding:4px">

<span style="font-weight:bold;color:white">

<xsl:value-of select="name"/></span>

- <xsl:value-of select="price"/>

</div>

<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">

<xsl:value-of select="description"/>

<span style="font-style:italic">

(<xsl:value-of select="calories"/> calories per serving)

</span>

</div>

</xsl:for-each>

</body>

</html>

>From http://w3schools.com/xml/xml_xsl.asp.

Now, show me the money! <g>

Eyvind.

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

©2007 Wayne Sobers