|
Hi, I was wondering if
someone might be able to explain why I get two different values for the text of
a text Element. The getNodeValue
seems to add a space at the end. The
two methods I tried are (snippets): (1) Using getNodeValue: // Element
aTextElement is passed in String elementText = aTextElement.getFirstChild().getNodeValue(); System.out.println(“---“ + elementText +"---
“ + elementText.length()); (2) Using TextNode.getText(): // Element aTextElement is passed
in GVTBuilder builder = new GVTBuilder(); BridgeContext ctx = new BridgeContext(new UserAgentAdapter()); GraphicsNode aTextElementNode = builder.build(ctx, aTextElement); TextNode tnode = (TextNode)
aTextElementNode; String ttext = tnode.getText(); System.out.println(“---“
+ elementText +"--- “ + elementText.length()); Given a String like “ABCDEF” (1) would output “---ABCDEF --- 7“ (2) would output “---ABCDEF--- 6“ …so, (1) has a space
after the F. Is there some obvious
reason for this? -Randy |
