```
    try {
        String data = "<a><b c='d' e='f'>0.15</b></a>";
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
                .newInstance();
        DocumentBuilder documentBuilder = documentBuilderFactory
                .newDocumentBuilder();
        InputSource is = new InputSource();
        is.setCharacterStream(new StringReader(data));
        Document document = documentBuilder.parse(is);

        NodeList nl = document.getElementsByTagName("b");
        Node n = (Node) nl.item(0);
        System.out.println(n.getNodeValue());
    } catch (Exception e) {
        System.out.println("Exception " + e);

    }

```

I am expecting it to print 0.15, but it prints null. Any Ideas?

Edit: This did the trick

```
        if (n.hasChildNodes())
            System.out.println(n.getFirstChild().getNodeValue());
        else 
            System.out.println(n.getNodeValue());

```