Page 1 of 1

New Class TXMLtoHash

Posted: Wed Aug 07, 2019 2:23 am
by cnavarro
With all source and sample
Sample for fivewin, but class is pure harbour

Resumen:
/----------------------------------------------------------------------------//
// Author: Cristobal Navarro
// Date: November - 2018
// Use to Xml files / strings and convert to JSON-HASH
//----------------------------------------------------------------------------//

CLASS TXmlToHash

DATA oRoot
DATA hHash INIT { => }
DATA cXml INIT ""
DATA cXmlString INIT ""
DATA cValString INIT ""
DATA aPairsVals INIT {}
DATA lRepeat INIT .F.
DATA lDataNode INIT .F.

METHOD New( cFile, cXml, cElement, lRepeat ) CONSTRUCTOR
METHOD End()
METHOD AllValues( oXml )
METHOD HashToXml( hHash, cFileXml, cElement, lWrite )
METHOD JsonToXml( cFileJson, cJson, cFileXml )
METHOD NodeToHash( oNode, hHash )
METHOD XmlToHash( pRoot, cElement )
METHOD XmlToJson( cFileJson, lWrite )
METHOD GetAllAttributes( hElem )

ENDCLASS

//----------------------------------------------------------------------------//
https://bitbucket.org/fivetech/fivewin- ... tohash.zip

Re: New Class TXMLtoHash

Posted: Wed Aug 07, 2019 3:46 pm
by hmpaquito
Cristobal, gracias por tu dedicación.

Re: New Class TXMLtoHash

Posted: Tue Aug 13, 2019 1:49 pm
by cnavarro
hmpaquito wrote:Cristobal, gracias por tu dedicación.
Gracias

Other sample
http://forums.fivetechsupport.com/viewt ... 28#p224938

Re: New Class TXMLtoHash

Posted: Tue Aug 13, 2019 1:51 pm
by cnavarro
Modify METHOD End() of Class

Code: Select all


METHOD End() CLASS TXmlToHash
   if !Empty( ::oRoot )
      MxmlDelete( ::oRoot )
   endif
Return nil
 
 

Re: New Class TXMLtoHash

Posted: Sat Oct 05, 2019 6:52 am
by ryugarai27
Hi Cristobal,

I get the following errors when building the test file( xmltohash.prg ):

Error: Unresolved external '_HB_FUN_FW_SETJSONHUMAN' referenced from ....XMLTOHASH.OBJ
Error: Unresolved external '_HB_FUN_FE_XMLTOHASH' referenced from ....XMLTOHASH.OBJ

I am using bcc7 + fw1706 + xHB 1.2.3 Intl (Simplex) Build 20151110

are there any libraries I missed to include during linking?

Best regards,
ryu

Re: New Class TXMLtoHash

Posted: Sat Oct 05, 2019 12:35 pm
by cnavarro
ryugarai27 wrote:Hi Cristobal,

I get the following errors when building the test file( xmltohash.prg ):

Error: Unresolved external '_HB_FUN_FW_SETJSONHUMAN' referenced from ....XMLTOHASH.OBJ
Error: Unresolved external '_HB_FUN_FE_XMLTOHASH' referenced from ....XMLTOHASH.OBJ

I am using bcc7 + fw1706 + xHB 1.2.3 Intl (Simplex) Build 20151110

are there any libraries I missed to include during linking?

Best regards,
ryu
Function FE_XMLTOHASH it is included in the class that accompanies the example in the .zip file that you have downloaded. The function FW_SETJSONHUMAN is from a more recent version of Fivewin: replace that function in the example and / or class code with .T.