Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLtoCursor
Message
From
16/06/2009 00:14:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Title:
XMLtoCursor
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01406273
Message ID:
01406273
Views:
128
I have to admit I am struggling with XML. Some things seem so easy and others so hard to follow or know where to go. It took me ages to get the syntax right for XMLtoCursor and I was so excited when it worked so easily and well (up to a point). My problem is that is doesn;t go quite low enough using 512 and I get an error "XML Parse error: Invalid at the top level of the document. Line 1, Position 1 . Image.xml" when I try 8192

eg
CREATE CURSOR curTemp (austr C(40), doseform c(22))
xmlCnt = XMLTOCURSOR("image.xml","curTemp",8192)

The XML file is below

<?xml version="1.0" encoding="ISO-8859-1" ?>
	<MedicationImageData>
    	<Header>
       	<Title>healthlinks.net image listing for August </Title>
       	<Timestamp>07/08/2008 10:56</Timestamp>
       	<SchemaVersion>2.2</SchemaVersion>
       	<Sequence>0</Sequence>
	</Header>

	<Medication>
		<Austr>65271</Austr>
		<Name>Acenorm</Name>
		<Strength>12.5mg</Strength>
		<eCMILink>
			<FriendlyName>Acenorm</FriendlyName>
			<HLAustr>65271</HLAustr>
		</eCMILink>
		<VersionSequence>1</VersionSequence>
		<DateEffective>20/06/2008 10:56</DateEffective>
		<DateWithdrawn></DateWithdrawn>
		<IsASubpackOfAUSTR></IsASubpackOfAUSTR>
		<HasSubpacks>
			<SubpackAUSTR></SubpackAUSTR>
		</HasSubpacks> 
		<Phase>
			<PhaseItem>1</PhaseItem>
			<DoseForm>Tablets</DoseForm>
			<Colour>white</Colour>
			<Scoring>scored</Scoring>
			<Shape>capsule-shaped</Shape>
			<Side1Marking>CL</Side1Marking>
			<Side2Marking></Side2Marking>
			<Image>65271-C01-01.jpg</Image>
		</Phase>
	</Medication>	

when I use 

xmlCnt = XMLTOCURSOR("image.xml","curTemp",512)
I am given a beautiful cursor so easily but the cursor contains all of the eCMILink, HasSubpacks and Phase subfields in the one field eg instead of doseform, colour, scoring etc in their own fields I get them all joined together in a Phase Field

I would greatly appreciate any help on this as it would be so good to be able to do this in VFP especially as XML is becoming more and more common for data exchange.

KInd Regards,
David
Next
Reply
Map
View

Click here to load this message in the networking platform