----------------------------------------------------------------------
Name PureXML
Version 1.0 Beta
Date Feb. 2005
Descr. A Purebasic XML Userlibrary based on the 'xmlparser.dll'
Written by Philippe Carpentier - flype@altern.org
Compil. Compiled with Purebasic 3.93 Beta 3
UserLibrary made with TailBite 1.2 Beta 2
Tested on Windows 98, 2000, XP
Requir. You must place the xmlparser.dll in same directory
----------------------------------------------------------------------
Main functions :
Result.b = PureXML_ParseFile(xmlFile.s)
Result.b = PureXML_ParseString(xmlString.s)
Result.s = PureXML_LastError()
The goal of this UserLib is two read XML data from
a file or from a string. Here are the functions :-)
----------------------------------------------------------------------
Callback functions ( no return value ) :
PureXML_SetOpenHandler(*funcPtr.l)
PureXML_SetCloseHandler(*funcPtr.l)
PureXML_SetDataHandler(*funcPtr.l)
PureXML_SetCommentHandler(*funcPtr.l)
PureXML_SetInvalidHandler(*funcPtr.l)
You should set those functions to catch XML events.
Then you can easily process what you need for each tag name.
;-
Procedure MyXML_o()
debug PureXML_Name()
EndProcedure
PureXML_SetOpenHandler(@MyXML_o)
;-
----------------------------------------------------------------------
Properties functions :
Result.s = PureXML_Name()
Result.s = PureXML_Data()
Result.s = PureXML_Attr(attrName.s)
This help you process data from XML tags.
An example :
<software id='0' name='purebasic'>
A great 'not so basic' language
</software>
PureXML_Name() >>> "software"
PureXML_Data() >>> " A great 'not so basic' language"
PureXML_Attr("id") >>> "0"
PureXML_Attr("name") >>> "purebasic"
----------------------------------------------------------------------
Have fun
flype - 2005
It is beta state - So please report bugs...
Best regards.
Last edited by Flype on Sat Mar 04, 2006 1:19 am, edited 1 time in total.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
By the way, TaileBite 1.2 Beta 2 used with Purebasic 3.93 Beta 3 reports me a syntax error when i click on the 'Check for errors' buttons. But no problem, TailBite compile it anyway
Seems to be the same index problem than jaPBe...
Last edited by Flype on Tue Mar 01, 2005 12:48 pm, edited 1 time in total.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
The list of the return errors codes is different from previous version of Purebasic because of new linkers.
So you have to update your messages return code list ( if i have well understood - see jaPBe last posts ).
Or maybe it is because the PureXML userlibrary make use of the XMLPARSER & the xmlparser.lib created using DLL Importer.
So in my internal code i use some functions like XMLzGetTag_(*node)...
Just wondering... if you need the PureXML source code for debugging say me hello
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Well, I'll check that. But the text that appears when you run TailBite is the text that the compiler outputs. It's PBCompiler saying "Syntax error", not TailBite.
Weird anyway, so I'll have a look (feel free to send me the source for checking).
And i notice that it is the same with another userlib test...
not only on my PureXML userlib.
It's only a problem which occur in TBManager by clicking on 'Check for errors'. Even with the brand new Purebasic 3.93 Full.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Fixed, thank you for the report, Flype. TailBite is not yet fully compatible with 3.93, though. I need to fix the array/linked lists handling.
EDIT: Ok, I misunderstood something; there's no problem with TailBite and PB 3.93 (yet , but you need to recompile UserLibraries made before PureBasic 3.93 in order to get them working now. I think. Or maybe only if you use Arrays or Linked Lists.
Is the XMLParser library cross-platform? Are there versions for Linux and MacOS X ?
If so, by using Callbacks you're limiting it to Windows - if the XMLParser is available on those other platforms, would it be possible to make a cross-platform version of the PureXML-Lib available?
This looks pretty sweet, from the sample in the post, it looks like it automatically reads the schema thats in the XML already ... if so, that's awesome ...
One question though, any chance you can remove the dependency (DLL) for this userlib?
you are true.
the <![CDATA[ ... ]]> are making trouble with the provided dll. i know that but i can't modify the dll for this. reading rss was the goal of this userlib.
but now that there is PBOSL / MSXML i'm happy 'cause it works so well.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
I'm sorry but No i don't think so and the reason is simple :
there's the MSXML3 userlibrary of the PBOSL collection which is a good choice, believe me.
The Microsoft's one is powerful and works very well even with CDATA section of course.
But maybe...
I will have a look just to test PB4 beta5...
By the way do you have / do you want the source of PureXML ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer