×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

补充说明:P-019 的 EXCEPTION 发生在rg.apache.crimson.parser.Parser2.maybePI.

private boolean maybePI (boolean skipStart)
throws IOException, SAXException
{
// [16] PI ::= '<?' PITarget
// (S (Char* - (Char* '?>' Char*)))?
// '?>'
// [17] PITarget ::= Name - (('X'|'x')('M'|'m')('L'|'l')
boolean savedLexicalPE = doLexicalPE;

if (!in.peek (skipStart ? "?" : "<?", null))
return false;
doLexicalPE = false;

String target = maybeGetName ();

if (target == null)
fatal ("P-018");
if ("xml".equals (target))
fatal ("P-019");
....
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 求助: JAVA XML 问题, 有没有 谁知道P-019 的 EXCEPTION 是什么意思?
    本文发表在 rolia.net 枫下论坛输入的XML 的文挡看起来是完整的(在IE 里可以正常显示), 把该XML 文档的URI 传给DOCUMENTBUILDER 类对象PARASE 方法的时候,得到如下的EXCEPTION.
    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3339)

    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3327)

    at org.apache.crimson.parser.Parser2.maybePI(Parser2.java:1107)

    at org.apache.crimson.parser.Parser2.maybeMisc(Parser2.java:1233)

    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:621)

    at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)

    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

    at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)

    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)

    at iqquest.MainFrame.<init>(MainFrame.java:49)

    at iqquest.Main.main(Main.java:10)


    部分代码如下:
    DocumentBuilderFactory df =DocumentBuilderFactory.newInstance();
    DocumentBuilder db=df.newDocumentBuilder();
    Document doc=null;

    uri=new String(Global.HostURL +Global.GetMethodPath+"?sSql="+sSql);

    try{
    doc = db.parse(uri);
    // doc = db.parse((InputStream)inputStream);
    }
    catch(SAXParseException es)
    {
    // System.out.println(es);
    es.printStackTrace();
    }更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • 补充说明:P-019 的 EXCEPTION 发生在rg.apache.crimson.parser.Parser2.maybePI.
      private boolean maybePI (boolean skipStart)
      throws IOException, SAXException
      {
      // [16] PI ::= '<?' PITarget
      // (S (Char* - (Char* '?>' Char*)))?
      // '?>'
      // [17] PITarget ::= Name - (('X'|'x')('M'|'m')('L'|'l')
      boolean savedLexicalPE = doLexicalPE;

      if (!in.peek (skipStart ? "?" : "<?", null))
      return false;
      doLexicalPE = false;

      String target = maybeGetName ();

      if (target == null)
      fatal ("P-018");
      if ("xml".equals (target))
      fatal ("P-019");
      ....
      • check ur XML file more carefully
        R u using BEA WebLogic Platform 8.1?
        • not using.XML 文档内容见内
          <?xml version="1.0" encoding="Windows-1252"?>
          <records affected="0"/>
          • xml content looks fine to me
            Possible issues in 3 areas
            1) uri
            2) the xml content
            3) parser

            so verify them one by one.

            For example, u can
            1) try to parse an XML file using crimson parser.
            or
            2) try different XML parser for the same xml resource
            • 谢谢.查出来了,是XML 的内容错误,在XML 内容开始前多了一个空行,JAVA 中的XML PARSE 类就分析不了.以前使用MSXML 中的类就没这个问题.
              • cool. Thanks for sharing