Hi
I need to create a xml File and someone as changed the xml.prg to work with xh.
In my code I have this sample:
Function TesteXML()
Local oXml
XML oXml FILE "TESTE.XML" FORMATED
only with this line it returns:
Descrição do erro: Error BASE/1004 Class: 'ARRAY' has no exported method: NEW
Args:
[ 1] = C TESTE.XML
[ 2] = U TESTE.XML
[ 3] = U TESTE.XML
[ 4] = U TESTE.XML
[ 5] = L TESTE.XML
Stack Calls
===========
Called from NEW(0)
Called from TESTEXML(5296)
Can anybody help me about this error.
best regards
Pedro
XML
- Pedro Faro
- Posts: 31
- Joined: Sun Jan 29, 2006 6:34 pm
- Location: Lisboa-Portugal
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Pedro Faro
- Posts: 31
- Joined: Sun Jan 29, 2006 6:34 pm
- Location: Lisboa-Portugal
- Contact:
Hi Antonio
I use:
xHarbour build 0.99.41
FWHX 2.6 May 2005
use also class xml.prg with a xml.ch (example below..)
*******************************************************************************
* Pruebas para la creacion de fichero xml desde fivewin *
* 01 - 05 - 2002 *
* Enviarme vuestras dudas y sugerencias a fredy@airtel.net *
*******************************************************************************
#include "hbclass.ch"
#include "fileio.ch"
#include "common.ch "
CLASS TXMLWRITE
DATA hFile, lFormated, CRLF, aMark
METHOD New( cOut, cVer, cEncode, cSheet, lFormated ) CONSTRUCTOR
METHOD Open( cMark, cType, aAttrib, cTag, lClose, cExt )
METHOD End() INLINE FClose( ::hFile )
METHOD Procesar( cText )
METHOD Close()
END
This class works great in FW (without the modifications of default ..)
best regards
Pedro
I use:
xHarbour build 0.99.41
FWHX 2.6 May 2005
use also class xml.prg with a xml.ch (example below..)
*******************************************************************************
* Pruebas para la creacion de fichero xml desde fivewin *
* 01 - 05 - 2002 *
* Enviarme vuestras dudas y sugerencias a fredy@airtel.net *
*******************************************************************************
#include "hbclass.ch"
#include "fileio.ch"
#include "common.ch "
CLASS TXMLWRITE
DATA hFile, lFormated, CRLF, aMark
METHOD New( cOut, cVer, cEncode, cSheet, lFormated ) CONSTRUCTOR
METHOD Open( cMark, cType, aAttrib, cTag, lClose, cExt )
METHOD End() INLINE FClose( ::hFile )
METHOD Procesar( cText )
METHOD Close()
END
This class works great in FW (without the modifications of default ..)
best regards
Pedro
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Pedro Faro
- Posts: 31
- Joined: Sun Jan 29, 2006 6:34 pm
- Location: Lisboa-Portugal
- Contact:
Antonio
below the xml.prg and the xml.ch.
As i said, someone adapted the FW to Xh/FWH class that i got in this newsgroup.
regards
Pedro
xml.prg:
#include "hbclass.ch"
#include "fileio.ch"
#include "common.ch "
CLASS TXMLWRITE
DATA hFile, lFormated, CRLF, aMark
METHOD New( cOut, cVer, cEncode, cSheet, lFormated ) CONSTRUCTOR
METHOD Open( cMark, cType, aAttrib, cTag, lClose, cExt )
METHOD End() INLINE FClose( ::hFile )
METHOD Procesar( cText )
METHOD Close()
END
//----------------------------------------------------------------------------//
METHOD New( cOut, cVer, cEncode, cSheet, lFormated ) CLASS TXMLWRITE
DEFAULT cVer TO "1.0"
DEFAULT cEncode TO "ISO-8859-1"
//BYNAME lFormated
::CRLF := If( lFormated, Chr(13)+Chr(10), "" )
::aMark := {}
::hFile := FCreate( AllTrim( cOut ), 0 )
::Procesar( '<?xml version="' + cVer + '" encoding="' + cEncode + '"?>' )
IF !Empty( cSheet )
::Procesar( '<?xml-stylesheet href="'+ AllTrim( cSheet ) + '" Type="text/xsl"?>' )
END IF
RETURN Self
METHOD Open ( cMark, cType, aAttrib, cTag, lClose, cExt ) CLASS TXMLWRITE
Local n, cBuffer
DEFAULT cTag TO ""
DEFAULT cType TO ""
DEFAULT cExt TO ""
aAdd( ::aMark, cMark )
cBuffer := '<' + cMark
IF Len( ::aMark ) == 1
cBuffer += ' xmlns:dt="urn:schemas-microsoft-com:datatypes"'
END IF
IF !Empty( cType )
cBuffer += ' dt:dt= "' + cType + '"'
END IF
IF Len( aAttrib ) > 0
FOR n := 1 TO Len( aAttrib )
cBuffer += ' '+ aAttrib[n,1] + ' = "' + aAttrib[n,2] + '" '
NEXT
END IF
cBuffer += '>' + cTag + If( lClose, '</' + cMark + '>' , "" )
::Procesar( cBuffer )
IF lClose
aSize( ::aMark, Len( ::aMark ) -1 )
END IF
RETURN NIL
METHOD Close CLASS TXMLWRITE
::Procesar( "</" + ::aMark[ Len( ::aMark ) ] + ">" )
aSize( ::aMark, Len( ::aMark ) -1 )
RETURN NIL
METHOD Procesar( cBuffer ) CLASS TXMLWRITE
Local nSpaces := If( ::lFormated, Len( ::aMark ), 0 )
cBuffer := Space( nSpaces )+ cBuffer + ::CRLF
FWrite( ::hFile, cBuffer, Len( cBuffer ) )
RETURN NIL
xml.ch:
#xcommand XML <oXml> FILE <cOut> ;
[ VERSION <cVer> ] ;
[ ENCODING <cEncode> ] ;
[ STYLESHEET <cSheet> ] ;
[ <lFormated:FORMATED> ];
=> ;
<oXml> := TXmlWrite():New( <cOut>, <cVer>, <cEncode>, <cSheet>, <.lFormated.> )
#xcommand XML OPEN MARK <cMark> [ TYPE <cType> ] ;
[ ATTRIB <cAttrib1> VALUE <uVal1> ;
[ ATTRIB <cAttrib2> VALUE <uValN> ]] ;
[ EXTENDED <uExt> ] ;
[ TAG <cTag> ] ;
[ <lAutoClose:AUTOCLOSE> ];
<of: OF> <oXml> ;
=> ;
<oXml>:Open( <cMark>, <cType>,;
{ [ { <cAttrib1> ,<uVal1> } ] [, { <(cAttrib2)> ,<(uValN)>} ] },;
<cTag>, <.lAutoClose.>, <uExt>)
#xcommand XML CLOSE MARK <of: OF> <oXml> ;
=> ;
<oXml>:Close( )
#xcommand XML END <oXml> ;
=> ;
<oXml>:End()
below the xml.prg and the xml.ch.
As i said, someone adapted the FW to Xh/FWH class that i got in this newsgroup.
regards
Pedro
xml.prg:
#include "hbclass.ch"
#include "fileio.ch"
#include "common.ch "
CLASS TXMLWRITE
DATA hFile, lFormated, CRLF, aMark
METHOD New( cOut, cVer, cEncode, cSheet, lFormated ) CONSTRUCTOR
METHOD Open( cMark, cType, aAttrib, cTag, lClose, cExt )
METHOD End() INLINE FClose( ::hFile )
METHOD Procesar( cText )
METHOD Close()
END
//----------------------------------------------------------------------------//
METHOD New( cOut, cVer, cEncode, cSheet, lFormated ) CLASS TXMLWRITE
DEFAULT cVer TO "1.0"
DEFAULT cEncode TO "ISO-8859-1"
//BYNAME lFormated
::CRLF := If( lFormated, Chr(13)+Chr(10), "" )
::aMark := {}
::hFile := FCreate( AllTrim( cOut ), 0 )
::Procesar( '<?xml version="' + cVer + '" encoding="' + cEncode + '"?>' )
IF !Empty( cSheet )
::Procesar( '<?xml-stylesheet href="'+ AllTrim( cSheet ) + '" Type="text/xsl"?>' )
END IF
RETURN Self
METHOD Open ( cMark, cType, aAttrib, cTag, lClose, cExt ) CLASS TXMLWRITE
Local n, cBuffer
DEFAULT cTag TO ""
DEFAULT cType TO ""
DEFAULT cExt TO ""
aAdd( ::aMark, cMark )
cBuffer := '<' + cMark
IF Len( ::aMark ) == 1
cBuffer += ' xmlns:dt="urn:schemas-microsoft-com:datatypes"'
END IF
IF !Empty( cType )
cBuffer += ' dt:dt= "' + cType + '"'
END IF
IF Len( aAttrib ) > 0
FOR n := 1 TO Len( aAttrib )
cBuffer += ' '+ aAttrib[n,1] + ' = "' + aAttrib[n,2] + '" '
NEXT
END IF
cBuffer += '>' + cTag + If( lClose, '</' + cMark + '>' , "" )
::Procesar( cBuffer )
IF lClose
aSize( ::aMark, Len( ::aMark ) -1 )
END IF
RETURN NIL
METHOD Close CLASS TXMLWRITE
::Procesar( "</" + ::aMark[ Len( ::aMark ) ] + ">" )
aSize( ::aMark, Len( ::aMark ) -1 )
RETURN NIL
METHOD Procesar( cBuffer ) CLASS TXMLWRITE
Local nSpaces := If( ::lFormated, Len( ::aMark ), 0 )
cBuffer := Space( nSpaces )+ cBuffer + ::CRLF
FWrite( ::hFile, cBuffer, Len( cBuffer ) )
RETURN NIL
xml.ch:
#xcommand XML <oXml> FILE <cOut> ;
[ VERSION <cVer> ] ;
[ ENCODING <cEncode> ] ;
[ STYLESHEET <cSheet> ] ;
[ <lFormated:FORMATED> ];
=> ;
<oXml> := TXmlWrite():New( <cOut>, <cVer>, <cEncode>, <cSheet>, <.lFormated.> )
#xcommand XML OPEN MARK <cMark> [ TYPE <cType> ] ;
[ ATTRIB <cAttrib1> VALUE <uVal1> ;
[ ATTRIB <cAttrib2> VALUE <uValN> ]] ;
[ EXTENDED <uExt> ] ;
[ TAG <cTag> ] ;
[ <lAutoClose:AUTOCLOSE> ];
<of: OF> <oXml> ;
=> ;
<oXml>:Open( <cMark>, <cType>,;
{ [ { <cAttrib1> ,<uVal1> } ] [, { <(cAttrib2)> ,<(uValN)>} ] },;
<cTag>, <.lAutoClose.>, <uExt>)
#xcommand XML CLOSE MARK <of: OF> <oXml> ;
=> ;
<oXml>:Close( )
#xcommand XML END <oXml> ;
=> ;
<oXml>:End()
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Pedro Faro
- Posts: 31
- Joined: Sun Jan 29, 2006 6:34 pm
- Location: Lisboa-Portugal
- Contact: