fb:porticula NoPaste
libxml-Beispiel aus examples-Ordner
Uploader: | Mao |
Datum/Zeit: | 11.02.2009 15:46:23 |
#include once "libxml/xmlreader.bi"
#define NULL 0
'':::::
sub processNode( byval reader as xmlTextReaderPtr )
dim constname as zstring ptr, value as zstring ptr
constname = xmlTextReaderConstName( reader )
value = xmlTextReaderConstValue( reader )
print xmlTextReaderDepth( reader ); xmlTextReaderNodeType( reader ); _
" "; *constname; _
xmlTextReaderIsEmptyElement(reader); xmlTextReaderHasValue( reader );
print *value
end sub
'':::::
sub streamFile( byval filename as string )
dim reader as xmlTextReaderPtr
dim ret as integer
reader = xmlReaderForFile( filename, NULL, 0 )
if (reader <> NULL) then
ret = xmlTextReaderRead( reader )
do while( ret = 1 )
processNode( reader )
ret = xmlTextReaderRead( reader )
loop
xmlFreeTextReader( reader )
if( ret <> 0 ) then
print "failed to parse: "; filename
end if
else
print "Unable to open "; filename
end if
end sub