XMLNode.toString() needs to change node names like '#cdata-section' to remove the '#' characters, which are not value node names for use in XPath query steps.
The conversion produces the following element names, which while they may collide with some XML documents, they are easy to use: cdata-section comment document document-fragment text git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6526 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -24,7 +24,6 @@ import net.sourceforge.pmd.lang.ast.RootNode;
|
||||
import net.sourceforge.pmd.lang.ast.xpath.Attribute;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.Text;
|
||||
@ -146,9 +145,9 @@ public class XmlParser {
|
||||
// Delegate method
|
||||
else {
|
||||
if ("toString".equals(method.getName())) {
|
||||
if (node instanceof Element) {
|
||||
return ((Element) node).getNodeName();
|
||||
}
|
||||
String s = ((Node) node).getNodeName();
|
||||
s = s.replace('#', '');
|
||||
return s;
|
||||
}
|
||||
Object result = method.invoke(node, args);
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user