This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAXParseException: The processing instruction must begin with the name of the target

 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all..
Could any one help me iam facing this error in the console..
SAXParseException: The processing instruction must begin with the name of the target

The log is as follows

XMLPageManager.loadPages(D:\Vantage\xgenerationV2\root\template): 8 files found
XMLPageManager.loadPages(...): key=appointmentsearch.html, uri=D:\Vantage\xgenerationV2\root\template\appointmentsearch.html
[Fatal Error] appointmentsearch.html:1:3: The processing instruction must begin with the name of the target.
Error in XMLPageManager.loadPage() for file: D:\Vantage\xgenerationV2\root\template\appointmentsearch.html
org.xml.sax.SAXParseException: The processing instruction must begin with the name of the target.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at com.albionintl.html.XMLPageManager.parseDocument(XMLPageManager.java:396)
at com.albionintl.html.XMLPageManager.loadPage(XMLPageManager.java:237)
at com.albionintl.html.XMLPageManager._loadPages(XMLPageManager.java:226)
at com.albionintl.html.XMLPageManager._loadPages(XMLPageManager.java:194)
at com.albionintl.html.XMLPageManager.forceRefresh(XMLPageManager.java:465)
at com.albionintl.html.XMLPageManager$RefreshRunner.refresher(XMLPageManager.java:563)
at com.albionintl.html.XMLPageManager$RefreshRunner.run(XMLPageManager.java:522)
at java.lang.Thread.run(Unknown Source)
XMLPageManager.loadPages(...): key=clientsearch.html, uri=D:\Vantage\xgenerationV2\root\template\clientsearch.html
[Fatal Error] clientsearch.html:1:3: The processing instruction must begin with the name of the target.
Error in XMLPageManager.loadPage() for file: D:\Vantage\xgenerationV2\root\template\clientsearch.html
org.xml.sax.SAXParseException: The processing instruction must begin with the name of the target.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at com.albionintl.html.XMLPageManager.parseDocument(XMLPageManager.java:396)
at com.albionintl.html.XMLPageManager.loadPage(XMLPageManager.java:237)
at com.albionintl.html.XMLPageManager._loadPages(XMLPageManager.java:226)
at com.albionintl.html.XMLPageManager._loadPages(XMLPageManager.java:194)
at com.albionintl.html.XMLPageManager.forceRefresh(XMLPageManager.java:465)
at com.albionintl.html.XMLPageManager$RefreshRunner.refresher(XMLPageManager.java:563)
at com.albionintl.html.XMLPageManager$RefreshRunner.run(XMLPageManager.java:522)
at java.lang.Thread.run(Unknown Source)
XMLPageManager.loadPages(...): key=clientsearchpopup.html, uri=D:\Vantage\xgenerationV2\root\template\clientsearchpopup.html
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And so? The log tells you the name of the XML file with the error. And it tells you what the error is. So therefore you should look at that XML file and find the error. And fix it.

Or do you have some other question? The error is in the XML file, which we can't see from here.
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The log is pointing to 3 html files..
And the starting tag is as below..
<html lang="en">
Iam not getting whether the above starting tag is correct or not because it works fine for me in various pages..
Thank you..
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the error message refers to a processing instruction. Don't just look at the first element -- especially since it isn't a processing instruction. Look through the document until you come to something which looks like a badly-formatted processing instruction.

Perhaps there's a secondary problem in that you don't actually know what a processing instruction is in the context of an XML document. If that's the case, you should look that up in your XML book.
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply but..iam struggling wiht the same issue..
Iam parsing one html file using sax parser

The starting 3 lines of my file are
<? xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">

Can i know whether i have done any mistake in this tarting tags...because if i remove the first two lines i dont get this exception... please help me out of this .. How can i parse the <!doctype tag this also i do have a doubt any special way to handle it??...Thanks a ton..
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you really don't know what a processing instruction is. You couldn't have spent a little time to find that out for yourself? Okay. It's something which looks like an element tag, but it starts with <? and ends with ?>.

Do you see anything like that in the sample you posted?

No, it's not the <html> element.

No, it's not the <!DOCTYPE> declaration.

Found it yet? Okay. A well-formed XML document starts with a prolog which looks like <?xml ... ?>. Yours has an extra blank space in it which doesn't belong there.


 
Tony Bateman
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
6 years ago; did you really need to be so acerbic? Have you grown as a person in that time?
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to agree with your assessment; hopefully I no longer behave like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic