I want to parse XML in Java. The XML looks like:
<Attributes><ProductAttribute ID="359"><ProductAttributeValue><Value>1150</Value></ProductAttributeValue></ProductAttribute><ProductAttribute ID="361"><ProductAttributeValue><Value>1155</Value></ProductAttributeValue></ProductAttribute></Attributes>
My try was:
 public static void parseXml(String sb) throws Exception{
    sb = "<Attributes><ProductAttribute ID="359"><ProductAttributeValue><Value>1150</Value></ProductAttributeValue></ProductAttribute><ProductAttribute ID="361"><ProductAttributeValue><Value>1155</Value></ProductAttributeValue></ProductAttribute></Attributes>";
     Document dom;
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    dom = db.parse(new InputSource(new ByteArrayInputStream(sb.getBytes("utf-8"))));
    dom.toString();
}
I wanted first see, if the parsing is going. But it doesn't.
I get the error:
 Premature end of file
Have anybody an idea, how can I parse these?
The question is not duplicate. I have read the answers of another question like my question, but the difference is the XML.
Thanks