1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
; very simple test: prints content of an obxml file
;
; Init method.
; Called when the ob_xml_to_struct object is created.
FUNCTION ob_xml_to_struct::Init
RETURN, self->IDLffXMLSAX::Init()
END
;---------------------------------------------------------------------------
; Cleanup method.
; Called when the ob_xml_to_struct object is destroyed.
PRO ob_xml_to_struct::Cleanup
; Call superclass cleanup method
self->IDLffXMLSAX::Cleanup
END
; commented out: no need to overload the method.
; ;---------------------------------------------------------------------------
; ; StartDocument method
; ; Called when parsing of the document data begins.
;
; PRO ob_xml_to_struct::StartDocument
; END
;---------------------------------------------------------------------------
; Characters method
; Called when parsing character data within an element.
; Adds data to the element field.
PRO ob_xml_to_struct::characters, data
self.element = self.element + data
END
;---------------------------------------------------------------------------
; StartElement
; Called when the parser encounters the start of an element.
; just reset element
PRO ob_xml_to_struct::startElement, URI, local, strName, attr, value
self.element = ''
END
;---------------------------------------------------------------------------
; EndElement method
; Called when the parser encounters the end of an element.
; just print element
PRO ob_xml_to_struct::EndElement, URI, Local, strName
case strName of
"DIAMETER": self.print=1
else: self.print=0
endcase
if (self.print) then begin
string=strtrim(self.element,2)
self.element = ''
print, "Diameter: "+string
ENDIF
END
;---------------------------------------------------------------------------
; Object class definition method.
PRO ob_xml_to_struct__define
void = {ob_xml_to_struct, $
INHERITS IDLffXMLSAX, $
element: '', print: 0}
END
|