Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XMLtoCursor
Message
De
21/06/2009 13:02:21
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01406273
Message ID:
01407427
Vues:
67
Dear Sergey,
thank you very much for your reply. I have taken your advice and am trying to work out some code to do it useing XMLDOM or XMLSAX. I am finding this hard going (ie very slow) and am using the code in MegaFox as a basis. Hopefully I will get there and I greatlyt appreciate yor reply.

KInd Regards,
David

The XMLTOCURSOR() is designed to process simple XML created by CURSORTOXML() or similar to it. You can consider using XmlAdapter that can process more complex XML. Still it's limited capabilities. It also required XML schema in order to convert XML into VFP cursors. As last resort you can use XmlDom to parse any XML.

>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
--sb--
MVP VFP
VFP Tips, tricks and code

"We are here on Earth to do good to others. What the others are here for, I don't know." -- W. H. Auden
"Strange as it seems, no amount of learning can cure stupidity, and higher education positively fortifies it." -- Stephen Vizinczey
There are 10 types of people: Those who can read binary, and those who can't.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform