• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JDom Exception

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Y'all,

The processing instruction target matching "[xX][mM][lL]" is not allowed.

I was told that JDom was the alternative when dealing with XML and JAVA.
I am pretty new on JAVA as well as XML. (Please don't give me the answer
: RTFM. I have been there!)
Any way what I try to do is really simple (that's what I thought). In a JSP page I post a short XML message.

at first I write the XML to a File (this works! woopie). This file I then pass to:
validate(discoveryFile);

in the "validate" method I do the following:
Document doc = null;
SAXBuilder builder = new SAXBuilder();
doc = builder.build(new FileInputStream(file));
That's all!

when I post anything thru the TEXTAREA field in my JSP I Will get the following message:
org.xml.sax.SAXParseException:
The processing instruction target matching "[xX][mM][lL]" is not allowed.

This stuff is driving me crazy. Can anybody lend a hand?

greetz Aschwin
 
Sheriff
Posts: 28370
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In an XML document, you have the declaration which looks like <?xml ... ?> where you declare the XML version and optionally some other things. This has to come at the beginning of the document. If it appears elsewhere in the document, then it looks like a processing instruction, and processing instructions aren't allowed to have the name "xml".

So: check that there's nothing before the XML declaration.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic