Reputation: 21
I want to read an XML file into memory as a tree of nodes, on which I could perform further operations. Something like C#'s XDocument
. What is the Java equivalent of C#'s XDocument.Load
?
Upvotes: 2
Views: 2058
Reputation: 359826
You're looking for the Java XML DOM classes, which are part of JAXP. It's much uglier than in C#.
DocumentBuilderFactory
creates...DocumentBuilder
which creates...Document
which is what you're really after.An excellent reference for all this: the JAXP Tutorial, Chapter 3: The Document Object Model.
Upvotes: 6