J
jackwootton
Hello ,
I posted a similar question a while ago here (http://groups.google.com/
group/comp.lang.javascript/browse_thread/thread/
eaa3a71a8c469195/90002ee2f13ef8c1).
However I feel this question is sufficiently different to warrant a
new discussion.
I create a listener for nodeInserted and nodeRemoved mutation events.
In that listener I use the event object to reference the node that was
inserted. Typically it looks like this (although it can differ by
being fewer lines):
<span chatdir="1">
<div class="msg">
<div>
<b style="margin-left: 3px;">XchatTest: </b>
<span chatindex="a3">Hello World!</span>
</div>
</div>
</span>
I need to parse this information and store it in an appropriate data
structure. I have created the data structure, but am not sure on the
best method of accessing the information I require, such as: chatindex
attribute of a span tag, chatdir attribute of the span tag, content of
the b tag, etc etc.
Ideally I would like to use XPath since it seems a clean elegant
method of accessing XML style information. Alternatively, should I
just use the DOM methods of childNode, getAttribute, etc?
Many thanks,
Jack
I posted a similar question a while ago here (http://groups.google.com/
group/comp.lang.javascript/browse_thread/thread/
eaa3a71a8c469195/90002ee2f13ef8c1).
However I feel this question is sufficiently different to warrant a
new discussion.
I create a listener for nodeInserted and nodeRemoved mutation events.
In that listener I use the event object to reference the node that was
inserted. Typically it looks like this (although it can differ by
being fewer lines):
<span chatdir="1">
<div class="msg">
<div>
<b style="margin-left: 3px;">XchatTest: </b>
<span chatindex="a3">Hello World!</span>
</div>
</div>
</span>
I need to parse this information and store it in an appropriate data
structure. I have created the data structure, but am not sure on the
best method of accessing the information I require, such as: chatindex
attribute of a span tag, chatdir attribute of the span tag, content of
the b tag, etc etc.
Ideally I would like to use XPath since it seems a clean elegant
method of accessing XML style information. Alternatively, should I
just use the DOM methods of childNode, getAttribute, etc?
Many thanks,
Jack