Invalid Content 'useStyles'

Ive been following along the tutorials and got to the section on how to add controls. One of the two lines that are said to be copied directly into the file throws an error.

Invalid content was found starting with element ‘useStyles’.

then it lists a bunch of expected terms.

the line i copied is: useStyles filename=“nifty-default-styles.xml”

If it says “com.jme3.asset.AssetNotFoundException: …”, you are missing the library in your project. Posting the Stack Trace would offer more info on your issue.

1 Like

This is most probably caused by a wrong order of the xml elements. You should check with an existing working example where you have to put “useStyles”. You can’t put it anywhere you like.

Here is Niftys-XSD https://github.com/void256/nifty-gui/blob/1.3/nifty-core/src/main/resources/nifty-1.3.xsd where the NiftyType determines the order of elements.

The useStyles tag has to be the first child element of the nifty Tag.

1 Like
@void256 said: The useStyles tag has to be the first child element of the nifty Tag.

you were right this cleared things up perfectly, thanks