L
Louis-Philippe Huberdeau
The solution to this problem is probably very simple but I can't seem to
find any information about it. I'm trying to parse an XML document with
the Xerces-J (xml.apache.org) DOM implentation. I don't know how common
is the usage of that library but it seemed to be the most documented one
I could find.
The problem is that many functions return child elements as NodeList.
NodeList being a list of Node, I tryed to cast them as Element, to be
able to use getAttribute() on them. When I do so, I get a
ClassCastException. Is there a way to to convert a Node to an Element?
I also have a theorical question, which will probably solve the problem
above... What is the difference between a Node and an Element in XML? In
what cases is a Node not an Element? I'm just trying to figure out why
they seperated both. I'm sure there is a good reason, but I couldn't
find it explicitly and as a student, I don't have enough time to read
the entire specification to find this single information.
find any information about it. I'm trying to parse an XML document with
the Xerces-J (xml.apache.org) DOM implentation. I don't know how common
is the usage of that library but it seemed to be the most documented one
I could find.
The problem is that many functions return child elements as NodeList.
NodeList being a list of Node, I tryed to cast them as Element, to be
able to use getAttribute() on them. When I do so, I get a
ClassCastException. Is there a way to to convert a Node to an Element?
I also have a theorical question, which will probably solve the problem
above... What is the difference between a Node and an Element in XML? In
what cases is a Node not an Element? I'm just trying to figure out why
they seperated both. I'm sure there is a good reason, but I couldn't
find it explicitly and as a student, I don't have enough time to read
the entire specification to find this single information.