Posted on 2005-02-27 11:09 
bigseal 阅读(21040) 
评论(7)  编辑  收藏  
			 
			
		 
		       看到一篇关于在eclipse中使用ant构建java项目的文章,就按照文章中的说明新建了一个项目,并新建了classes,dist,doc,lib几个文件夹和build.xml文件。其中build.xml文件的内容也是直接复制的,由于是从网页上直接复制的,里面“<”“>”都是中文格式的,我就把这些给替换了一下。
         但当选中项目,然后选择“Project”,“Properties”,“Builders”,“New…”,选择“Ant Build”:载入“Bulidfile”时提示“Content is not allowed in prolog”错误。    
         我就去Google上转了一圈,还有点收获,看了一篇小文章,觉得可能是build.xml文件格式的错误。
In SGML and XML, a document is composed of two sequential parts,
 the prolog and the instance. You can see this in an HTML example:
the prolog and the instance. You can see this in an HTML example:

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN "
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN "
 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
 3 <html xmlns= "http://www.w3.org/1999/xhtml " >
3 <html xmlns= "http://www.w3.org/1999/xhtml " >
 4 <head >
4 <head >
 5 <title >The Symbol Grounding Problem </title >
5 <title >The Symbol Grounding Problem </title >
 6 </head >
6 </head >
 7 <body >
7 <body >
 8 </body >
8 </body >
 9 </html >
9 </html >

 In this example, the prolog is lines 1-2, the instance begins on
In this example, the prolog is lines 1-2, the instance begins on
 line 3. The prolog includes the DOCTYPE declaration, the external
line 3. The prolog includes the DOCTYPE declaration, the external
 subset (called the DTD), and the internal subset (which you seldom
subset (called the DTD), and the internal subset (which you seldom
 see but it 's legal). The document instance includes the document
see but it 's legal). The document instance includes the document
 element (in this case <html > and all of its descendent content).
element (in this case <html > and all of its descendent content).

 You generally don 't want to see the prolog, and you generally don 't
You generally don 't want to see the prolog, and you generally don 't
 want to store it. The DOCTYPE declaration provides references to
want to store it. The DOCTYPE declaration provides references to
 DTD, which is instantiated as part of the process of validating the
DTD, which is instantiated as part of the process of validating the
 document. You may want to store the reference(s), but you wouldn 't
document. You may want to store the reference(s), but you wouldn 't
 want to store the DTD each time you store the document, as that
want to store the DTD each time you store the document, as that
 would be a real waste (the DTD is often bigger than the document).
would be a real waste (the DTD is often bigger than the document).

 It sounds like your well-formed and valid document isn 't being
It sounds like your well-formed and valid document isn 't being
 considered as such by the XML processor. The error message indicates
considered as such by the XML processor. The error message indicates
 that there is content (i.e., either elements or character data) in
that there is content (i.e., either elements or character data) in
 the part of the document considered as the prolog. You may be missing
the part of the document considered as the prolog. You may be missing
 the last " > " on line 2 above, as that would normally be the beginning
the last " > " on line 2 above, as that would normally be the beginning
 of the internal subset. If it found " <html " (or something similar),
of the internal subset. If it found " <html " (or something similar),
 you might get that error.
you might get that error.

   
果然,有两个“!”是中文状态,改过来就ok 了。