my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes SAXParseException: The processing instruction must begin with the name of the target Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAXParseException: The processing instruction must begin with the name of the target" Watch "SAXParseException: The processing instruction must begin with the name of the target" New topic
Author

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

Prathyusha Reddy
Ranch Hand

Joined: Jan 20, 2010
Posts: 31
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jan 20, 2010
Posts: 31
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jan 20, 2010
Posts: 31
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SAXParseException: The processing instruction must begin with the name of the target
 
Similar Threads
i have written code for dom but output given from the exception caught in the code
DataSource Access
Unable to parse xml file with # in the filename
Axis2 1.4 Problem in generating code
ERROR [MainDeployer] Could not initialise deployment: file:/C:/jboss-4.2.2.GA/server/default/deploy/