Page 1 of 1

XML Reader

Posted: Sat Feb 26, 2011 2:08 pm
by modicr
Hello!

Is there an XML reader for Harbour/FWH available?
Maybe something like PHP XMLReader pull parser:

http://www.ibm.com/developerworks/libra ... ngphp.html

Thanks, Roman

Re: XML Reader

Posted: Sat Feb 26, 2011 5:16 pm
by frose
Roman,

I'm using TXmlDocument() to read from a XML file.

From the documentation:
Description
The TXmlDocument() class provides objects for reading and creating XML files. XML stands for eXtensible Markup Language which is similar to HTML, but designed to describe data rather to display it. To learn more about XML itself, the internet provides very good free online tutorials. The website http://www.w3schools.com is is a good place to quickly learn the basics on XML.
A TXmlDocument object maintains an entire XML document and builds from it a tree of TXmlNode() objects which contain the actual XML data. The first XML node is stored in the :oRoot instance variable, which is the root node of the XML tree. Beginning with the root node, an XML document can be traversed or searched for particular data. The classes TXmlIteratorScan() and TXmlIteratorRegEx() are available to find a particular XML node, based on its tag name, attribute or data it contains.
But it's an extension for xHarbour not for Harbour :(

Re: XML Reader

Posted: Mon Feb 28, 2011 7:54 pm
by IBTC
frose wrote:I'm using TXmlDocument() to read from a XML file.
me too.
frose wrote:But it's an extension for xHarbour not for Harbour :(
It is also available for Harbour. You only have to include xhb.lib, see also e.g. contrib/xhb/tests/xml1.prg

Re: XML Reader

Posted: Tue Mar 01, 2011 3:02 am
by xProgrammer
Hi Roman

I use TXml_Document class a lot in my Harbour code and have found it to be very good. Make sure you also check out the TXML_Iter* classes. It's really quite powerful and easy to use.

Regards
Doug

Re: XML Reader

Posted: Sat Mar 05, 2011 7:32 pm
by modicr
Hello!

I have installed xHarbour 1.21 from http://free.xharbour.com/free.xHarbour. ... loads.html
but there is no xhb.lib. There are only rtl.lib, rtlmt.lib, harbour.lib and many others ...

Regards, Roman

Re: XML Reader

Posted: Sun Mar 06, 2011 12:19 am
by xProgrammer
Hi Roman

My understanding is that as you are using xHarbour rather than Harbour you wouldn't have and wouldn't need xhb.lib because it is a Harbour library to provide Harbour users with xHarbour compatability.

Regards
Doug

Re: XML Reader

Posted: Sun Mar 06, 2011 3:50 pm
by modicr
Aha, now I understand ... I use "Harbour 1.0.1dev Intl. (Rev. 9361)" and there is no xhb.lib inside it. So I thought that xhb.lib is part of xHarbour so I've installed it. But the truth is that I must use newer harbour. What is the latest that is compatible with FWH 9.01?

Thanks, Roman

Re: XML Reader

Posted: Mon Mar 07, 2011 6:28 am
by xProgrammer
Hi Roman

I am using Harbour 2.0.0 (which most definitely has the xhb library) but I am using it under 64 bit Linux so I can't answer your latest question in any detail. But I am sure Antonio can.

Regards
Doug