I am attempting to use Apache Digester (V3) to process an XML file which consists of 'thread-dumps' : so file consists of many thread-dumps, one thread-dump consists of many threads, and something thread consists of a stacktrace, featuring its many lines
Such as this: (Simplified)
<threaddumps> <threaddump name="xxx"> <thread name="thread-1"> <stacktrace> <line> java.lang.wait </line> <line> ... </line> </stacktrace> </thread> <thread name="thread-2"> ... </threaddump> <threaddump name="yyy"> ... </threaddumps>
I'm utilizing a XML-based rule to process this input file fragment below:
<pattern value="thread"> <object-create-rule classname="mypackagemodel.Thread"/> <set-next-rule methodname="addThread" paramtype="mypackagemodel.Thread"/> <set-properties-rule> <alias attr-name="name" prop-name="name" /> </set-properties-rule> <pattern value="stacktrace/line"> <object-create-rule classname="mypackagemodel.StackLine"/> <set-next-rule methodname="addStackLine" paramtype="mypackagemodel.StackLine"/> <!-- need something here --> </pattern> </pattern>
How do you pull that text out of the among 'line' tags though ? I am already matching on 'stacktrace/line', there's no sub-element to make use of - what exactly pattern can one use ?
One other way of putting it - The 'StackLine' object has been produced and connected properly - its exactly that I'm not sure things to call my 'setName()' setter with ?
(In XSLT you might generally use '.' or 'current()' inside a similar scenario for example)
First got it : apparently a clear pattern string will match the present node's text:
This labored for me personally:
<bean-property-setter-rule pattern="" propertyname="line"/>