Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Craig A
  Where is Craig A?
 United Kingdom
 Craig A
 To: Joriveek Joriveek
  Where is Joriveek Joriveek?
 Joriveek Joriveek
Subject: RE: XML Schema
Thread ID: 78892 Message ID: 79116 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: XML
Date: Thursday, October 13, 2005 12:27:13 AM         

> That's what I did eventually. But I want to understand more about the schemas and their role in XMLtoCURSOR() and CURSORtoXML(),
> Can you point me for any more information on this?
> Regards,
> J
> > > want to produce XML file where the tag name width is more than the my fox table field name width...
> > >
> > > any idea how can i resolve this problem

> >
> > An easy/lazy way to do this would be to rename your fields in a select statement before you use CURSORTOXML(), e.g.
> >
> > SELECT field1 as longfieldname1,;
> > 	field2 as longfieldname2;
> > 	FROM mytable;
> > 	INTO CURSOR cursMyTable
> > CURSORTOXML("cursMyTable", "c:\mytable.xml", 1, 512)
> > 

> > Hope this helps,
> > Craig.
> > Irrelevant link, if you're bored

I'm no expert when it comes to XML schema, so I will offer my basic understanding if it helps...

The schema defines the data structure that defines the XML dataset, particularly the field types and lengths. This information can then be used by FoxPro, or indeed some other application to correctly model the dataset.

When you use XMLTOCURSOR() to convert some XML without a schema, FoxPro has a good attempt at recreating the cursor with the correct types, but it does it by inference. For example...
LOCAL lcXML_NoSchema, lcXML_WithSchema

CREATE CURSOR test (string_long c(30), string_number c(10))
INSERT INTO test VALUES ("one", "1")
INSERT INTO test VALUES ("two", "3")
INSERT INTO test VALUES ("three", "3")

CURSORTOXML("test", "lcXML_WithSchema", 1, 0, 0, "1")
CURSORTOXML("test", "lcXML_NoSchema")

XMLTOCURSOR(lcXML_NoSchema, "curs_NoSchema")
XMLTOCURSOR(lcXML_WithSchema, "curs_WithSchema")

*!* With the schema, the cursor is created with the correct field sizes and types

SELECT curs_WithSchema

*!* Using the XML without schema, FoxPro guesses that column "string_long" is of length 5, rather than 30
*!* and "string_number" is a Numeric rather than c(10), purely by the data that is contained in the XML

SELECT curs_NoSchema

So I suppose whether or not you use the schema depends on whether the recipient of the XML knows/does not know/cares about the correct data structure!
I can suggest W3Schools as a starting point if you're interested in the finer points of schema.

Sorry I can't be of more help!

Irrelevant link, if you're bored


XML Schema Posted by Joriveek Joriveek @ 10/10/2005 5:44:19 PM
RE: XML Schema Posted by Craig Ashbridge @ 10/11/2005 12:12:25 PM
RE: XML Schema Posted by Joriveek Joriveek @ 10/12/2005 6:06:28 PM
RE: XML Schema Posted by Craig Ashbridge @ 10/13/2005 12:27:13 AM