This code running into xHarbour, but under Harbour, show this error;

   Error description:Error BASE/1004  No exported method: NTYPE
   Args:
     [   1] = U   nil

Stack Calls
===========
Called from ->NTYPE(0)
Called from ../../txml.prg->TXMLITERATORREGEX:FIND(0)
Called from e_xml.prg->GCONFIGHARBOUR:NEW(62)
Called from e_xml.prg->MAIN(8)

I link lib libxhb.a  in GNU/linux, for compatible xHarbour

--------- This code, go bottom view example xml
----------------------------------------------------------------------------

#include "hbclass.ch"
#include "hbxml.ch"

Function Main()
 Local o

 WITH OBJECT o := gConfigHarbour():Create()
      :New()
 END

return nil

// Clase base para configuraciones
CLASS gConfigXml STATIC
      DATA oDoc, cXml, cResponse, cFile
      DATA cNode, cFind
      DATA lOk INIT .T.
      METHOD New() CONSTRUCTOR
ENDCLASS

METHOD New( ) CLASS gConfigXml

   ::cXml := memoread( ::cFile )
   ::oDoc := TXmlDocument():New( ::cXml )

   if ::oDoc:nStatus != HBXML_STATUS_OK
      ::lOk := .F.
      ::cResponse := "Error While Processing File: " + AllTrim( Str(
::oDoc:nLine ) ) + " # "+;
                     "Error: " + HB_XmlErrorDesc( ::oDoc:nError ) + " # " +;
                     "Tag Error on tag: " + ::oDoc:oErrorNode:cName + "
# " +;
                     "Tag Begin on line: " + AllTrim( Str(
::oDoc:oErrorNode:nBeginLine ) )
      return Self
   endif


RETURN Self

// Configurador para Harbour
CLASS gConfigHarbour FROM gConfigXml
      DATA aLibs
      METHOD Create() CONSTRUCTOR
      METHOD New() CONSTRUCTOR
      METHOD GetLibs() INLINE ::aLibs
ENDCLASS

METHOD Create() CLASS gConfigHarbour
   ::aLibs   := {}
   ::cNode := "harbour"
   ::cFind   := "^lib$"
   ::cFile   := "config.xml"
RETURN Self

METHOD New( ) CLASS gConfigHarbour
   Local oNode, oIter, oNodeLib, cLib, cCheck

   ::Super:New( )

   if ::lOk
      oNode := ::oDoc:FindFirst( ::cNode )
      if oNode != NIL
         oIter := TXmlIteratorRegex( oNode )
         oNodeLib := oIter:Find( ::cFind )   // Exactamente lib
         while oNodeLib != NIL
               cLib   :=  cValtoChar( oNodeLib:GetAttribute( "name" ) )
               cCheck :=  cValtoChar( oNodeLib:GetAttribute( "check" ) )
               ? cLib, cCheck // ALERT: Only Information for test
               AADD( ::aLibs, { iif( cCheck = "yes", .T., .F. ), cLib }  )
               oNodeLib := oIter:Next() // Siguiente libreria
         end while
      endif
    endif

RETURN Self

/* config.xml for testing
<config>
<harbour>
  <lib name="lvm" check="yes" />
  <lib name="lrt" check="yes" />
  <lib name="llan" check="yes"/>
  <lib name="lrdd" check="yes"/>
  <lib name="lmacro" check="yes"/>
  <lib name="lpp" check="yes" />
  <lib name="ldbfntx" check="yes"/>
  <lib name="ldbfcdx" check="yes"/>
  <lib name="ldbfftp" check="yes"/>
  <lib name="lhbsix" check="yes"/>
  <lib name="lpcrepos" check="yes"/>
  <lib name="lcommon" check="yes"/>
  <lib name="lm" check="yes" />
  <lib name="ltip" check="yes"/>
  <lib name="lgtwin" check="no"/>
  <lib name="lgtnul" check="no"/>
</harbour>
</config>
*/


Regards
Rafa Carmona
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to