New Class TXMLtoHash

Post Reply
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

New Class TXMLtoHash

Post 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
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
hmpaquito
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: New Class TXMLtoHash

Post by hmpaquito »

Cristobal, gracias por tu dedicación.
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: New Class TXMLtoHash

Post by cnavarro »

hmpaquito wrote:Cristobal, gracias por tu dedicación.

Gracias

Other sample
viewtopic.php?f=3&t=37628#p224938
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: New Class TXMLtoHash

Post by cnavarro »

Modify METHOD End() of Class

Code: Select all | Expand



METHOD End() CLASS TXmlToHash
   if !Empty( ::oRoot )
      MxmlDelete( ::oRoot )
   endif
Return nil
 
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
ryugarai27
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines
Contact:

Re: New Class TXMLtoHash

Post 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
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: New Class TXMLtoHash

Post 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.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Post Reply