[Support Request] XmlPullParserException: Error Parsing Document

Hey all,

As the title says, I’m getting that error when trying to load a menu with nifty. I’ve been googling this for the last hour, and that specific exception doesn’t really seem to exist, which is nice. I’m going to post relevant code:

Method that creates nifty:
[java]
Nifty nifty;
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager, audioRenderer, guiViewPort);
nifty = niftyDisplay.getNifty();

	MenuController control = new MenuController();
	nifty.registerScreenController(control);

	nifty.fromXml("Interface/Nifty/menus.xml", "start");

	// attach the nifty display to the gui view port as a processor
	guiViewPort.addProcessor(niftyDisplay);
	nifty.gotoScreen("start");[/java]

menus.xml:
[java]
<?xml version=“1.0” encoding=“UTF-8”?>
<nifty
xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<screen id=“start” controller = “projectlaggo.com.wordpress.cptspike.MenuController”>
<layer id=“background” childLayout=“center”>
<image filename=“Interface/Nifty/splash.png”></image>
</layer>
<layer id=“foreground” backgroundColor="#0000" childLayout=“vertical”>
<panel id=“panel_mid” height=“50%” width=“75%” align=“center” childLayout=“center”
backgroundColor="#0f08">
<control name=“startButton” label=“Start” id=“StartButton” align=“center” valign=“center”>
</control>
<control name=“startButton” label=“Quit” id=“QuitButton” align=“center” valign=“center”>
</control>
</panel>
</layer>
</screen>
<screen id=“hud”>
<layer id=“hudLayer”>
</layer>
</screen>
</nifty>
[/java]

And finally, the entire error message:
[java]
java.lang.RuntimeException: org.xmlpull.v1.XmlPullParserException: Error parsing document. (position: START_TAG seen …net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">… @5:124) caused by: java.lang.NullPointerException
[/java]

An overwhelming amount of responses. I hate nifty. Anyways, if by some miracle some Googler comes this way, I’m pretty sure the error I was getting was caused by bad encoding. The menus.xml you see up there was a blank file created by Eclipse, and I think it lacked the proper encoding. After I created the file in a proper XML creator, it worked flawlessly.

@shaunsupra said: An overwhelming amount of responses. I hate nifty. Anyways, if by some miracle some Googler comes this way, I'm pretty sure the error I was getting was caused by bad encoding. The menus.xml you see up there was a blank file created by Eclipse, and I think it lacked the proper encoding. After I created the file in a proper XML creator, it worked flawlessly.

You do know you have other options besides Nifty, yes?

There is:

Lemur
A new effort for embedding JaxaFX
tonegodGUI

If you are not happy with Nifty, it might be worth your while exploring your options.

I didn’t ask for alternatives. I asked for help. So how does your GUI work?

Did the forum mangle your code or do you actually have an HTML “A” tag inside the schemalocation value?

[java]xsi:schemaLocation=”http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd“>
[/java]

Because if you do that isn’t syntactically correct XML so yeah, the parser will throw an error.