Author: Rafael Copquin
Posted: 2007-06-13 at 06:04:09
Gee, that's very good !!
I have no clue on how you did that, but I will use it and see if this is what I need.
BTW, where can I read what is necessary to understand this schema thing and how to accomplish what you did, on my own? I read the VFP9 help on this subject, but it shows no examples and deciphering the meaning, at least to a newbie on XML as me, is a humongous task!!
Rafael
----- Original Message -----
From: Eyvind Axelsen
To: profoxtech@leafe.com
Sent: Wednesday, June 13, 2007 7:51 AM
Subject: Re: VFP9 - cursortoxml
I have not worked with the XMLAdapter, so I am afraid I can't help you much with that, but here's a sample xml schema that validates against your example - hope it helps!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--W3C Schema generated by XMLSpy v2006 sp2 U (http://www.altova.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="articulo" type="xs:long"/>
<xs:element name="cambio">
<xs:complexType>
<xs:sequence>
<xs:element ref="articulo"/>
<xs:element ref="origen"/>
<xs:element ref="destino"/>
<xs:element ref="cantidad"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cantidad" type="xs:int"/>
<xs:element name="destino" type="xs:long"/>
<xs:element name="origen" type="xs:long"/>
<xs:element name="xml">
<xs:complexType>
<xs:sequence>
<xs:element ref="cambio" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Eyvind.
-----Opprinnelig melding-----
Fra: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] PÃÂ¥ vegne av Rafael Copquin
Sendt: 13. juni 2007 10:45
Til: profox@leafe.com
Emne: 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]