// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.StringReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;

public class HtmlPars {
    public static void main(String[] args) throws Exception {
        String xml = "<SPAN class='item c123'>bla bla</SPAN>";
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(new InputSource(new StringReader(xml )));
        Element elm = (Element)doc.getElementsByTagName("SPAN").item(0);
        System.out.println("content = " + elm.getFirstChild().getNodeValue());
        System.out.println("class = " + elm.getAttribute("class"));
    }
}
