+ tests/stripeol.hb
+ added script to strip spaces at EOL
* contrib/gtalleg/tests/test.prg
* contrib/gtwvg/tests/demoxbp.prg
* contrib/gtwvg/tests/wvgactivex.prg
* contrib/gtwvg/tests/wvgxbp.prg
* contrib/gtwvg/wvgclass.prg
* contrib/hbamf/tests/tstendin.prg
* contrib/hbbz2/tests/test.prg
* contrib/hbcairo/tests/fancytxt.prg
* contrib/hbcairo/tests/table.prg
* contrib/hbct/ctrand.prg
* contrib/hbct/doc/en/addascii.txt
* contrib/hbct/doc/en/atadjust.txt
* contrib/hbct/doc/en/count.txt
* contrib/hbct/doc/en/ct.txt
* contrib/hbct/doc/en/ctc.txt
* contrib/hbct/doc/en/ctmath.txt
* contrib/hbct/doc/en/ctmath2.txt
* contrib/hbct/doc/en/ctpad.txt
* contrib/hbct/doc/en/ctstr.txt
* contrib/hbct/doc/en/datetime.txt
* contrib/hbct/doc/en/dattime2.txt
* contrib/hbct/doc/en/exponent.txt
* contrib/hbct/doc/en/finan.txt
* contrib/hbct/doc/en/ftoc.txt
* contrib/hbct/doc/en/justify.txt
* contrib/hbct/doc/en/keyset.txt
* contrib/hbct/doc/en/misc1.txt
* contrib/hbct/doc/en/num1.txt
* contrib/hbct/doc/en/numat.txt
* contrib/hbct/doc/en/numconv.txt
* contrib/hbct/doc/en/pos1.txt
* contrib/hbct/doc/en/pos2.txt
* contrib/hbct/doc/en/posdiff.txt
* contrib/hbct/doc/en/print.txt
* contrib/hbct/doc/en/range.txt
* contrib/hbct/doc/en/relation.txt
* contrib/hbct/doc/en/remove.txt
* contrib/hbct/doc/en/replace.txt
* contrib/hbct/doc/en/screen1.txt
* contrib/hbct/doc/en/strdiff.txt
* contrib/hbct/doc/en/strswap.txt
* contrib/hbct/doc/en/token1.txt
* contrib/hbct/doc/en/token2.txt
* contrib/hbct/doc/en/trig.txt
* contrib/hbct/doc/en/video.txt
* contrib/hbct/doc/en/wordtoch.txt
* contrib/hbct/getinfo.prg
* contrib/hbfimage/tests/fitest.prg
* contrib/hbgd/gdimage.prg
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbide/idetags.prg
* contrib/hblzf/tests/test2.prg
* contrib/hbmisc/doc/en/ht_conv.txt
* contrib/hbmisc/fcomma.prg
* contrib/hbmisc/fileread.prg
* contrib/hbmisc/hbedit.prg
* contrib/hbnf/anomatch.prg
* contrib/hbnf/calendar.prg
* contrib/hbnf/clrsel.prg
* contrib/hbnf/dispmsg.prg
* contrib/hbnf/doc/en/aading.txt
* contrib/hbnf/doc/en/aavg.txt
* contrib/hbnf/doc/en/acctadj.txt
* contrib/hbnf/doc/en/acctmnth.txt
* contrib/hbnf/doc/en/acctqtr.txt
* contrib/hbnf/doc/en/acctweek.txt
* contrib/hbnf/doc/en/acctyear.txt
* contrib/hbnf/doc/en/adessort.txt
* contrib/hbnf/doc/en/aemaxlen.txt
* contrib/hbnf/doc/en/aeminlen.txt
* contrib/hbnf/doc/en/amedian.txt
* contrib/hbnf/doc/en/anomatch.txt
* contrib/hbnf/doc/en/any2any.txt
* contrib/hbnf/doc/en/aredit.txt
* contrib/hbnf/doc/en/asum.txt
* contrib/hbnf/doc/en/at2.txt
* contrib/hbnf/doc/en/bitclr.txt
* contrib/hbnf/doc/en/bitset.txt
* contrib/hbnf/doc/en/blink.txt
* contrib/hbnf/doc/en/byt2bit.txt
* contrib/hbnf/doc/en/byt2hex.txt
* contrib/hbnf/doc/en/byteand.txt
* contrib/hbnf/doc/en/byteneg.txt
* contrib/hbnf/doc/en/bytenot.txt
* contrib/hbnf/doc/en/bytexor.txt
* contrib/hbnf/doc/en/calendar.txt
* contrib/hbnf/doc/en/chdir.txt
* contrib/hbnf/doc/en/cntryset.txt
* contrib/hbnf/doc/en/color2n.txt
* contrib/hbnf/doc/en/d2e.txt
* contrib/hbnf/doc/en/datecnfg.txt
* contrib/hbnf/doc/en/dayofyr.txt
* contrib/hbnf/doc/en/daytobow.txt
* contrib/hbnf/doc/en/dfile.txt
* contrib/hbnf/doc/en/diskfunc.txt
* contrib/hbnf/doc/en/dispc.txt
* contrib/hbnf/doc/en/dispmsg.txt
* contrib/hbnf/doc/en/dosver.txt
* contrib/hbnf/doc/en/e2d.txt
* contrib/hbnf/doc/en/easter.txt
* contrib/hbnf/doc/en/elapsed.txt
* contrib/hbnf/doc/en/findith.txt
* contrib/hbnf/doc/en/floptst.txt
* contrib/hbnf/doc/en/ftattr.txt
* contrib/hbnf/doc/en/ftidle.txt
* contrib/hbnf/doc/en/ftisprn.txt
* contrib/hbnf/doc/en/ftround.txt
* contrib/hbnf/doc/en/fttext.txt
* contrib/hbnf/doc/en/gcd.txt
* contrib/hbnf/doc/en/getenvrn.txt
* contrib/hbnf/doc/en/hex2dec.txt
* contrib/hbnf/doc/en/iamidle.txt
* contrib/hbnf/doc/en/isbit.txt
* contrib/hbnf/doc/en/isbiton.txt
* contrib/hbnf/doc/en/isshare.txt
* contrib/hbnf/doc/en/kspeed.txt
* contrib/hbnf/doc/en/linked.txt
* contrib/hbnf/doc/en/madd.txt
* contrib/hbnf/doc/en/menutonf.txt
* contrib/hbnf/doc/en/metaph.txt
* contrib/hbnf/doc/en/miltime.txt
* contrib/hbnf/doc/en/month.txt
* contrib/hbnf/doc/en/netpv.txt
* contrib/hbnf/doc/en/nooccur.txt
* contrib/hbnf/doc/en/ntow.txt
* contrib/hbnf/doc/en/nwlstat.txt
* contrib/hbnf/doc/en/nwsem.txt
* contrib/hbnf/doc/en/nwuid.txt
* contrib/hbnf/doc/en/ontick.txt
* contrib/hbnf/doc/en/origin.txt
* contrib/hbnf/doc/en/page.txt
* contrib/hbnf/doc/en/pchr.txt
* contrib/hbnf/doc/en/peek.txt
* contrib/hbnf/doc/en/pending.txt
* contrib/hbnf/doc/en/poke.txt
* contrib/hbnf/doc/en/popadder.txt
* contrib/hbnf/doc/en/proper.txt
* contrib/hbnf/doc/en/prtesc.txt
* contrib/hbnf/doc/en/putkey.txt
* contrib/hbnf/doc/en/qtr.txt
* contrib/hbnf/doc/en/rand1.txt
* contrib/hbnf/doc/en/savearr.txt
* contrib/hbnf/doc/en/scregion.txt
* contrib/hbnf/doc/en/setdate.txt
* contrib/hbnf/doc/en/setkeys.txt
* contrib/hbnf/doc/en/setlastk.txt
* contrib/hbnf/doc/en/settime.txt
* contrib/hbnf/doc/en/sinkey.txt
* contrib/hbnf/doc/en/sleep.txt
* contrib/hbnf/doc/en/sqzn.txt
* contrib/hbnf/doc/en/sysmem.txt
* contrib/hbnf/doc/en/tbwhile.txt
* contrib/hbnf/doc/en/tempfile.txt
* contrib/hbnf/doc/en/vertmenu.txt
* contrib/hbnf/doc/en/vidcur.txt
* contrib/hbnf/doc/en/vidmode.txt
* contrib/hbnf/doc/en/wda.txt
* contrib/hbnf/doc/en/week.txt
* contrib/hbnf/doc/en/workdays.txt
* contrib/hbnf/doc/en/woy.txt
* contrib/hbnf/doc/en/xbox.txt
* contrib/hbnf/doc/en/year.txt
* contrib/hbnf/ftround.prg
* contrib/hbnf/metaph.prg
* contrib/hbnf/nwsem.prg
* contrib/hbnf/nwuid.prg
* contrib/hbnf/pending.prg
* contrib/hbnf/popadder.prg
* contrib/hbnf/scregion.prg
* contrib/hbnf/tbwhile.prg
* contrib/hbnf/workdays.prg
* contrib/hbodbc/browodbc.prg
* contrib/hbqt/tests/browqt.prg
* contrib/hbqt/tests/dbfbrowserclass.prg
* contrib/hbqt/tests/testbrow.prg
* contrib/hbsqlit3/tests/blob.prg
* contrib/hbsqlit3/tests/sl3_test.prg
* contrib/hbxbp/tests/demoxbp.prg
* contrib/hbxbp/tests/dialogqt.prg
* contrib/hbxbp/xbpdataref.prg
* contrib/hbxbp/xbpmenubar.prg
* contrib/hbxbp/xbpprintdialog.prg
* contrib/hbxbp/xbpprinter.prg
* contrib/hbxbp/xbprtf.prg
* contrib/hbxbp/xbpscrollbar.prg
* contrib/xhb/cstruct.prg
* contrib/xhb/hblog.prg
* contrib/xhb/hterrsys.prg
* contrib/xhb/htjlist.prg
* contrib/xhb/sprintf.prg
* contrib/xhb/stream.prg
* contrib/xhb/tcgi.prg
* contrib/xhb/tedit.prg
* contrib/xhb/tfile.prg
* contrib/xhb/thtm.prg
* contrib/xhb/trpc.prg
* contrib/xhb/trpccli.prg
* contrib/xhb/ttable.prg
* contrib/xhb/txml.prg
* contrib/xhb/xcstr.prg
* contrib/xhb/xhberr.prg
* contrib/xhb/xhbmt.prg
* doc/cmpopt.txt
* doc/en/dbstrux.txt
* examples/hbapollo/array.prg
* examples/hbvpdf/hbvpdf.prg
* examples/hbvpdf/hbvpdft.prg
* examples/hbxlsxml/xlsxml_s.prg
* examples/hbxlsxml/xlsxml_y.prg
* examples/httpsrv/cgifunc.prg
* examples/httpsrv/cookie.prg
* examples/httpsrv/modules/cookie.prg
* examples/httpsrv/modules/info.prg
* examples/httpsrv/modules/showcounter.prg
* examples/httpsrv/modules/tableservletdb.prg
* examples/httpsrv/modules/testajax.prg
* examples/httpsrv/session.prg
* examples/httpsrv/uhttpd.prg
* include/hbclass.ch
* include/hbtrace.ch
* src/debug/dbgtinp.prg
* src/debug/debugger.prg
* src/debug/tbrwtext.prg
* src/rdd/usrrdd/rdds/hscdx.prg
* src/rtl/hbi18n2.prg
* src/rtl/valtoexp.prg
* formatting, fixed indentation, cleanups, deleting system specific information,
optimizing out platform dependent code, using hb_ntos()
396 lines
10 KiB
Plaintext
396 lines
10 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* xHarbour Project source code:
|
|
* HBXML - XML DOM oriented routines - Classes encapsulating the document
|
|
*
|
|
* Copyright 2003 Giancarlo Niccolai <gian@niccolai.ws>
|
|
* See also MXML library related copyright in hbxml.c
|
|
*
|
|
* www - http://harbour-project.org
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this software; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
|
*
|
|
* As a special exception, the Harbour Project gives permission for
|
|
* additional uses of the text contained in its release of Harbour.
|
|
*
|
|
* The exception is that, if you link the Harbour libraries with other
|
|
* files to produce an executable, this does not by itself cause the
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
* Your use of that executable is in no way restricted on account of
|
|
* linking the Harbour library code into it.
|
|
*
|
|
* This exception does not however invalidate any other reasons why
|
|
* the executable file might be covered by the GNU General Public License.
|
|
*
|
|
* This exception applies only to the code released by the Harbour
|
|
* Project under the name Harbour. If you copy code from other
|
|
* Harbour Project or Free Software Foundation releases into a copy of
|
|
* Harbour, as the General Public License permits, the exception does
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
* anyone as to the status of such modified files, you must delete
|
|
* this exception notice from them.
|
|
*
|
|
* If you write modifications of your own for Harbour, it is your choice
|
|
* whether to permit this exception to apply to your modifications.
|
|
* If you do not wish that, delete this exception notice.
|
|
*
|
|
*/
|
|
|
|
#include "common.ch"
|
|
#include "hbxml.ch"
|
|
#include "hbclass.ch"
|
|
|
|
CLASS TXMLNode
|
|
DATA nType
|
|
DATA cName
|
|
DATA aAttributes
|
|
DATA nBeginLine
|
|
DATA cData
|
|
|
|
DATA oNext
|
|
DATA oPrev
|
|
DATA oParent
|
|
DATA oChild
|
|
|
|
METHOD New( nType, cName, aAttributes, cData ) CONSTRUCTOR
|
|
METHOD Clone() INLINE HBXml_node_clone( Self )
|
|
METHOD CloneTree() INLINE HBXml_node_clone_tree( Self )
|
|
|
|
METHOD Unlink() INLINE HBXml_node_unlink( Self )
|
|
METHOD NextInTree()
|
|
|
|
METHOD InsertBefore( oNode ) INLINE HBXml_node_insert_before( Self, oNode )
|
|
METHOD InsertAfter( oNode ) INLINE HBXml_node_insert_after( Self, oNode )
|
|
METHOD InsertBelow( oNode ) INLINE HBXml_node_insert_below( Self, oNode )
|
|
METHOD AddBelow( oNode ) INLINE HBXml_node_add_below( Self, oNode )
|
|
|
|
METHOD GetAttribute( cAttrib ) INLINE iif( cAttrib $ ::aAttributes, ::aAttributes[ cAttrib ], NIL )
|
|
METHOD SetAttribute( cAttrib, xValue ) INLINE ::aAttributes[ cAttrib ] := xValue
|
|
|
|
METHOD Depth()
|
|
METHOD Path()
|
|
|
|
METHOD ToString( nStyle ) INLINE HBXml_node_to_string( Self, nStyle )
|
|
METHOD Write( fHandle, nStyle ) INLINE HBXml_node_write( Self, fHandle, nStyle )
|
|
|
|
//Useful for debugging purposes
|
|
METHOD ToArray() INLINE;
|
|
{ ::nType, ::cName, ::aAttributes, ::cData }
|
|
ENDCLASS
|
|
|
|
METHOD New( nType, cName, aAttributes, cData ) class TXmlNode
|
|
IF nType == NIL
|
|
::nType := HBXML_TYPE_TAG
|
|
ELSE
|
|
::nType := nType
|
|
ENDIF
|
|
|
|
IF aAttributes == NIL
|
|
::aAttributes := {=>}
|
|
ELSE
|
|
::aAttributes := aAttributes
|
|
ENDIF
|
|
|
|
::cName := cName
|
|
::cData := cData
|
|
RETURN Self
|
|
|
|
|
|
METHOD NextInTree() CLASS TXmlNode
|
|
LOCAL oNext := NIL, oTemp
|
|
|
|
IF ::oChild != NIL
|
|
oNext := ::oChild
|
|
ELSEIF ::oNext != NIL
|
|
oNext := ::oNext
|
|
ELSE
|
|
oTemp := ::oParent
|
|
DO WHILE oTemp != NIL
|
|
IF oTemp:oNext != NIL
|
|
oNext := oTemp:oNext
|
|
EXIT
|
|
ENDIF
|
|
oTemp := oTemp:oParent
|
|
ENDDO
|
|
ENDIF
|
|
|
|
RETURN oNext
|
|
|
|
|
|
METHOD Depth() CLASS TXmlNode
|
|
IF ::oParent != NIL
|
|
RETURN ::oParent:Depth() + 1
|
|
ENDIF
|
|
RETURN 0
|
|
|
|
|
|
METHOD Path() CLASS TXmlNode
|
|
IF ::nType == HBXML_TYPE_DOCUMENT
|
|
RETURN ""
|
|
ENDIF
|
|
|
|
IF ::cName != NIL
|
|
IF ::oParent != NIL
|
|
IF ::oParent:Path() != NIL
|
|
RETURN ::oParent:Path() + "/" + ::cName
|
|
ENDIF
|
|
ELSE
|
|
RETURN "/" + ::cName
|
|
ENDIF
|
|
ENDIF
|
|
RETURN NIL
|
|
|
|
/********************************************
|
|
Iterator class
|
|
*********************************************/
|
|
CLASS TXmlIterator
|
|
METHOD New( oNodeTop ) CONSTRUCTOR
|
|
METHOD Next()
|
|
METHOD Rewind() INLINE ::oNode := ::oTop
|
|
METHOD Find( cName, cAttribute, cValue, cData )
|
|
|
|
METHOD GetNode() INLINE ::oNode
|
|
METHOD SetContext()
|
|
METHOD Clone()
|
|
|
|
PROTECTED:
|
|
METHOD MatchCriteria( oNode )
|
|
|
|
DATA cName
|
|
DATA cAttribute
|
|
DATA cValue
|
|
DATA cData
|
|
|
|
HIDDEN:
|
|
DATA nTopLevel
|
|
|
|
DATA oNode
|
|
DATA oTop
|
|
|
|
ENDCLASS
|
|
|
|
|
|
METHOD New( oNodeTop ) CLASS TXmlIterator
|
|
::oTop := oNodeTop
|
|
::oNode := oNodeTop
|
|
::nTopLevel := oNodeTop:Depth()
|
|
RETURN Self
|
|
|
|
|
|
METHOD Clone() CLASS TXmlIterator
|
|
LOCAL oRet
|
|
|
|
oRet := TXmlIterator():New( ::oNodeTop )
|
|
oRet:cName := ::cName
|
|
oRet:cAttribute := ::cAttribute
|
|
oRet:cValue := ::cValue
|
|
oRet:cData := ::cData
|
|
RETURN oRet
|
|
|
|
METHOD SetContext() CLASS TXmlIterator
|
|
::oTop := ::oNode
|
|
RETURN Self
|
|
|
|
METHOD Find( cName, cAttribute, cValue, cData ) CLASS TXmlIterator
|
|
::cName := cName
|
|
::cAttribute := cAttribute
|
|
::cValue := cValue
|
|
::cData := cData
|
|
|
|
IF ::oNode:nType == HBXML_TYPE_DOCUMENT
|
|
IF ::oNode:oChild == NIL
|
|
RETURN NIL
|
|
ENDIF
|
|
::oNode := ::oNode:oChild
|
|
ENDIF
|
|
|
|
IF ::MatchCriteria( ::oNode )
|
|
RETURN ::oNode
|
|
ENDIF
|
|
|
|
RETURN ::Next()
|
|
|
|
|
|
METHOD Next() CLASS TXmlIterator
|
|
LOCAL oFound := ::oNode:NextInTree()
|
|
|
|
DO WHILE oFound != NIL
|
|
IF oFound:Depth() <= ::nTopLevel
|
|
RETURN NIL
|
|
ENDIF
|
|
|
|
IF ::MatchCriteria( oFound )
|
|
::oNode := oFound
|
|
RETURN oFound
|
|
ENDIF
|
|
|
|
oFound := oFound:NextInTree()
|
|
ENDDO
|
|
|
|
RETURN NIL
|
|
|
|
METHOD MatchCriteria( oNode ) CLASS TXmlIterator
|
|
HB_SYMBOL_UNUSED( oNode )
|
|
RETURN .T.
|
|
|
|
|
|
/********************************************
|
|
Iterator scan class
|
|
*********************************************/
|
|
|
|
CLASS TXmlIteratorScan FROM TXmlIterator
|
|
METHOD New( oNodeTop ) CONSTRUCTOR
|
|
PROTECTED:
|
|
METHOD MatchCriteria( oFound )
|
|
ENDCLASS
|
|
|
|
METHOD New( oNodeTop ) CLASS TXmlIteratorScan
|
|
::Super:New( oNodeTop )
|
|
RETURN Self
|
|
|
|
METHOD MatchCriteria( oFound ) CLASS TXmlIteratorScan
|
|
|
|
IF ::cName != NIL .and. ( oFound:cName == NIL .or. ::cName != oFound:cName )
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
IF ::cAttribute != NIL .and. ! ::cAttribute $ oFound:aAttributes
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
IF ::cValue != NIL .and. ;
|
|
hb_HScan( oFound:aAttributes, {| xKey, cValue| HB_SYMBOL_UNUSED( xKey ), ::cValue == cValue}) == 0
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
IF ::cData != NIL .and. ( oFound:cData == NIL .or. ::cData != oFound:cData )
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
RETURN .T.
|
|
|
|
/********************************************
|
|
Iterator regex class
|
|
*********************************************/
|
|
|
|
CLASS TXmlIteratorRegex FROM TXmlIterator
|
|
METHOD New( oNodeTop ) CONSTRUCTOR
|
|
PROTECTED:
|
|
METHOD MatchCriteria( oFound )
|
|
ENDCLASS
|
|
|
|
|
|
METHOD New( oNodeTop ) CLASS TXmlIteratorRegex
|
|
::Super:New( oNodeTop )
|
|
RETURN Self
|
|
|
|
METHOD MatchCriteria( oFound ) CLASS TXmlIteratorRegex
|
|
|
|
IF ::cName != NIL .and. ;
|
|
( oFound:cName == NIL .or. ! HB_REGEXLIKE( ::cName, oFound:cName, .t. ) )
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
IF ::cAttribute != NIL .and. ;
|
|
hb_hScan( oFound:aAttributes, {|cKey| HB_REGEXLIKE( ::cAttribute, cKey, .t. ) } ) == 0
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
IF ::cValue != NIL .and. ;
|
|
hb_hScan( oFound:aAttributes, {|xKey, cValue| HB_SYMBOL_UNUSED( xKey ), HB_REGEXLIKE( ::cValue, cValue, .t. ) } ) == 0
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
IF ::cData != NIL .and. ;
|
|
( oFound:cData == NIL .or. ! HB_REGEXHAS( ::cData, oFound:cData, .F. ) )
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
RETURN .T.
|
|
|
|
|
|
/********************************************
|
|
Document Class
|
|
*********************************************/
|
|
|
|
CLASS TXmlDocument
|
|
DATA oRoot
|
|
DATA nStatus
|
|
DATA nError
|
|
DATA nLine
|
|
DATA oErrorNode
|
|
DATA nNodeCount
|
|
|
|
METHOD New( xElem, nStyle ) CONSTRUCTOR
|
|
METHOD Read( xData, nStyle ) INLINE HBXML_DATAREAD( Self, xData, nStyle )
|
|
METHOD ToString( nStyle ) INLINE ::oRoot:ToString( nStyle )
|
|
METHOD Write( fHandle, nStyle ) INLINE ::oRoot:Write( fHandle, nStyle )
|
|
|
|
METHOD FindFirst( cName, cAttrib, cValue, cData )
|
|
METHOD FindFirstRegex( cName, cAttrib, cValue, cData )
|
|
METHOD FindNext() INLINE ::oIterator:Next()
|
|
|
|
METHOD GetContext()
|
|
HIDDEN:
|
|
DATA oIterator
|
|
|
|
ENDCLASS
|
|
|
|
METHOD New( xElem, nStyle ) CLASS TXmlDocument
|
|
::nStatus := HBXML_STATUS_OK
|
|
::nError := HBXML_ERROR_NONE
|
|
::nLine := 1
|
|
::nNodeCount := 0
|
|
|
|
IF xElem == NIL
|
|
::oRoot := TXmlNode():New( HBXML_TYPE_DOCUMENT )
|
|
ELSE
|
|
SWITCH ValType( xElem )
|
|
CASE "O"
|
|
::oRoot := xElem
|
|
EXIT
|
|
|
|
CASE "N"
|
|
CASE "C"
|
|
::oRoot := TXmlNode():New( HBXML_TYPE_DOCUMENT )
|
|
::Read( xElem, nStyle )
|
|
EXIT
|
|
|
|
ENDSWITCH
|
|
ENDIF
|
|
|
|
RETURN Self
|
|
|
|
METHOD FindFirst( cName, cAttrib, cValue, cData ) CLASS TXmlDocument
|
|
::oIterator := TXmlIteratorScan():New( ::oRoot )
|
|
RETURN ::oIterator:Find( cName, cAttrib, cValue, cData )
|
|
|
|
METHOD FindFirstRegex( cName, cAttrib, cValue, cData ) CLASS TXmlDocument
|
|
::oIterator := TXmlIteratorRegex():New( ::oRoot )
|
|
RETURN ::oIterator:Find( cName, cAttrib, cValue, cData )
|
|
|
|
|
|
METHOD GetContext() CLASS TXmlDocument
|
|
LOCAL oDoc
|
|
|
|
oDoc := TXmlDocument():New()
|
|
oDoc:oRoot := ::oIterator:GetNode()
|
|
|
|
RETURN oDoc
|