Computer Science Canada Why is this not working? (XML File) |
Author: | Snario [ Sun May 27, 2012 8:00 pm ] | ||||
Post subject: | Why is this not working? (XML File) | ||||
Here I have a file that successfully runs. It creates an XML File in .../XMLModify/XMLCreate called XMLCreate.xml
.. and then I have this second piece of code that should modify the XML file with a few changes.
However I get this output and the XMLCreate.xml file doesn't change at all. init: deps-jar: Compiling 1 source file to C:\Users\Liam Horne\Documents\Organized\ICS4UI\Assignments\Unit 3\A5\XMLModify\build\classes compile: run: [Fatal Error] XMLCreate.xml:17:24: The entity name must immediately follow the '&' in the entity reference. org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180) at xmlmodify.Main.main(Main.java:18) BUILD SUCCESSFUL (total time: 1 second) I don't know what is wrong .. Any help? |
Author: | Zren [ Sun May 27, 2012 8:23 pm ] |
Post subject: | RE:Why is this not working? (XML File) |
Quote: The entity name must immediately follow the '&' in the entity reference.
If you look for & in your file. You notice you only use it once as text content. However, your parser seems to be treating this character specially. Thus we should look at the XML specification. http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Oh hey, look, it is treated specially. So it means we should probably be escaping it. |
Author: | Snario [ Sun May 27, 2012 8:43 pm ] |
Post subject: | RE:Why is this not working? (XML File) |
Thank you, quick response and I located the problem. |