This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi there. I do realize this is a java forum and not an XML forum but I thought I might just see if anybody can help me nonetheless. I am trying to parse thru XML files to extract certain detail from said files. The following is a snippet of the file type that I am parsing:
<useractions> <mapaction> <action_id>z03</action_id> <feature_id>D21</feature_id> <action_time>1088421430234</action_time> </mapaction> <layer> <frame_number>1</frame_number> <feature_id>D21</feature_id> </layer> <mapaction> <action_id>z02</action_id> <feature_id>D21</feature_id> ...... </useractions>. and so on. I have the header and dtd set up as the file seems to be parsed correctly up till a certain point at least. It parses the first <mapaction></mapaction> and <layer></layer> perfectly. However I get the following error as soon as my code encounters the second <mapaction> tag. The error is as follows:
org.xml.sax.SAXParseException: Element "useractions" does not allow "mapaction" here. I realize that it is most likely the way I have defined my dtd. The dtd I am using is set up as follows:
<?xml version='1.0' encoding='utf-8'?> <!-- DTD for a simple "XML recording". -->
I cannot see anything wrong here as useractions is defined to contain a series of mapaction elements and layer elements. However the program returns an error as soon as the second mapaction is reached. Can anyone offer any suggestions please. Thanks Joe
I appear to require 4 or 5 embedded for loops and if statements. I cannot see any alternative to extracting the innermost detail. I presume this is ok as the files become no more complicated then the snippet above and the progrma executes quickly enough.Thanks Joe