This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hello, i need a little guidance please. I have an XML file, which i am reading with the Stax API, all is working fine using the EventReader. My problem is that within the parent element there exists child elements and within those child elements exist elements that sometimes have the same names.... See this sample for an idea of what i mean.....
What happens is when i get the element <name> it will always cycle through both <name> elements an print me out the last one. I want it so that i can get the <name> element that is relative. I.e. the <name> element for <advisory> and then the <name> element for <threat>.
Since you're using Stax parsers I have to assume you already know about boolean variables.
So use one. Set it to "true" when you read the <threat> start tag and set it to "false" when you read the matching end tag. Then you can inspect that variable to see if you're inside a <threat> element or not.