Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I use SAX in VFP?
Message
De
31/01/2002 10:21:15
 
 
À
31/01/2002 09:28:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00613336
Message ID:
00613392
Vues:
30
This message has been marked as a message which has helped to the initial question of the thread.
Hi Ramil.

>I was wondering if SAX can be implemented using VFP?

Yes, but only in VFP 7. First do MODI COMM SOMEFILE.PRG to open an editor window for an empty PRG. Then open the VFP 7 Object Browser, open the Microsoft XML COM library, expand the Interfaces node, and drag the IVBSAXContentHandler node to the PRG editor window. That will create code similar to the following (I changed the name of the class in the generated code):
DEFINE CLASS SFXMLSAXParser AS session OLEPUBLIC

IMPLEMENTS IVBSAXContentHandler IN "c:\winnt\system32\msxml3.dll"

PROCEDURE IVBSAXContentHandler_documentLocator() AS VARIANT;
  HELPSTRING "Receive an object for locating the origin of SAX document events."
* add user code here
ENDPROC

PROCEDURE IVBSAXContentHandler_startDocument() AS VOID;
  HELPSTRING "Receive notification of the beginning of a document."
* add user code here
ENDPROC

*** other code removed for brevity

ENDDEFINE
To use this class, use code similar to the following (where lcXML is the XML you want to parse):
local loReader as msxml2.SAXXMLReader
loReader = createobject('msxml2.SAXXMLReader')
loParser = createobject('SFXMLSAXParser') && this is the class created above
loReader.ContentHandler = loParser
loReader.Parse(lcXML)
Hope this helps.

Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform