<List>
            <User userId="1"/>
</List>

NodeList list = XPathAPI.selectNodeList( doc, "/List/User" );
Node userId = XPathAPI.selectSingleNode(user, "./User/@userId");

Wrong, you're already on the User element. Try this

NodeList list = XPathAPI.selectNodeList( doc, "/List/User" );
Node userId = XPathAPI.selectSingleNode(user, "./@userId");

Or this

NodeList list = XPathAPI.selectNodeList( doc, "/List/User/@userId" );



Reply via email to