Java XML vs .NET Framework
The Java framework feels like a low level .NET framework.
.NET has a lot of convenience functions that make doing common things easy, and the more I work with Java, the more I yearn for that.
Today's example: I want to load some XML and extract some text from a node.
.NET code:
XmlDocument doc = new XmlDocument();
doc.Load("myFile.xml");
XmlNode node = doc.SelectNode("/item/description");
string description = node.InnerText;
The equivalent Java code:
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse("myFile.xml);
XPath xpath = XPathFactory.newInstance().newXPath();
Node node = (Node)xpath.evaluate("/item/description", doc, XPathConstants.NODE);
String description = node.getTextContent();
Which of these two APIs would you rather work with?