Project

Profile

Help

convert Item to dom.Node

Added by Anonymous about 20 years ago

Legacy ID: #2860081 Legacy Poster: pfc_caw (pfc_caw)

hi! My query produce a sequence of Item objects. I want to convert these objects to org.w3c.dom.Node. I tried to cast Item to NodeInfo but i dont get anything. I use DOM Tree because I use Tidy to convert HTML to XTHML and get the DOM Document. Thank you


Replies (3)

Please register to reply

RE: convert Item to dom.Node - Added by Anonymous about 20 years ago

Legacy ID: #2860091 Legacy Poster: Michael Kay (mhkay)

You need to explain (a) how you are invoking the query, and (b) how you are processing the results. Does the cast to NodeInfo succeed? If so, what are you trying to do with the resulting NodeInfo? What exactly do you mean when you say that "you don't get anything"? Michael Kay

RE: convert Item to dom.Node - Added by Anonymous about 20 years ago

Legacy ID: #2861930 Legacy Poster: pfc_caw (pfc_caw)

The query //img final SequenceIterator iter = exp.iterator(dynamicContext); while (true) { Item item = iter.next(); if (item == null) { break; } org.w3c.dom.Node node=(org.w3c.dom.Node)item; System.out.println("item:"+item.getStringValue()); System.out.println("node:"+node.getNodeType()); } This is the code. I use println() to check. it Only prints: item: node: item: node: ...

RE: convert Item to dom.Node - Added by Anonymous about 20 years ago

Legacy ID: #2862021 Legacy Poster: Michael Kay (mhkay)

getStringValue() probably displays an empty string because the img element has no content. But I can't see any possible reason why getNodeType() should display as an empty string, because the method returns a short. If you haven't got a Java debugger to show more clearly what's going on, try displaying item.getClass() to see what the implementation class is, and displaying the name of the node.

    (1-3/3)

    Please register to reply