Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck for empty XML file and resolve an error message
    primarykey
    data
    text
    <p>I've just started learning how to load XML files and use them to create objects a bit yesterday and so I've run into a few little things that I haven't, through about 15 minutes or so of looking around, been able to figure out so I decided to try asking them here. </p> <p>DBLoader: <a href="https://github.com/Valkryst/Project_02/blob/master/src/main/java/valkryst/item/DBLoader.java#L93" rel="nofollow">https://github.com/Valkryst/Project_02/blob/master/src/main/java/valkryst/item/DBLoader.java#L93</a></p> <p>XMLParse:<br> <a href="https://github.com/Valkryst/Project_02/tree/master/src/main/java/valkryst/core/xml" rel="nofollow">https://github.com/Valkryst/Project_02/tree/master/src/main/java/valkryst/core/xml</a></p> <p>The DBLoader class is where I load all of the variables from the XML file and create either an Armor or a Weapon object depending on a few things. The XMLParse class is just to hold a few methods that I've found myself in need of quite often while working with XML files.</p> <p>Now onto my two questions...</p> <ul> <li><p>How can I, with how my code is currently set up in the DBLoader class, do a check to see if there are no elements other than the opening and closing elements which are "body" and "/body"? (Replace the quotation marks with > and &lt;.)</p> <ul> <li>How can I resolve the error "[Fatal Error] :1:1 Premature end of file" when loading an empty file? I've already included a try-catch block to skip the current iteration of the for loop after it's caught. (This will probably be fixed if my first question is solved.)</li> </ul></li> </ul> <p>I did have more questions and that but it's around 4:00am here so I'm a bit out-of-it and I'll leave it at the two most important questions I had. </p> <p>Thanks for any replies.</p> <p>Edit: Another error just cropped up that I can't seem to figure out in my tired state of mind so I'll just add it to this post just in case anyone sees the problem while helping with my main questions.</p> <p>When DBLoader is run it always seems to skip "/XML/Items/Armor/Boot.xml" for some reason. I've added a print statement to tell me when a file is successfully loaded but only "/XML/Items/Armor/Sword.xml" ever successfully finishes. They are my two test XML files so only they should successfully load. Sorry if this sounds weird, I'm falling asleep.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload