You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Boris Garbuzov <bo...@xmlglobal.com> on 2001/10/11 20:32:26 UTC

root wrapper

I fail to parse the suggested linked file with the following code over
crimson-jaxp, while ie5 shows it nicely. Can anybody suggest? If I manually
directly wrap entries with a root, it parses well. May be I need a newer
parser? How others parse xml formatted logs?
------------------------code----------------------
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document document = db.parse (XML_WRAPPER_FILE); // fails
------------------output-------------
org.xml.sax.SAXParseException: org.apache.crimson.parser/P-076 Unconvertible
UTF-8 character beginning with 0xa0
        at
org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1038)
        at
org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1010)
        at org.apache.crimson.parser.InputEntity.peek(InputEntity.java:841)
        at org.apache.crimson.parser.Parser2.peek(Parser2.java:2922)
        at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:994)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:485)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
        at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
        at
org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:1
73)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:134)
        at
com.xmlglobal.goxmldb.test.logging.ParseLog.actualExecute(ParseLog.java:68)
-------------------------------------------example.log----------------------
----
<log-entry>
  <time>1002256390714</time>
  <priority>INFO</priority>
  <category>my</category>
  <message><![CDATA[ <<<< mess, but still parsable ]]></message>
</log-entry>
<log-entry>
  <time>1002256391225</time>
  <priority>INFO</priority>
  <category>my</category>
  <message><![CDATA[my message for log entry 1]]></message>
</log-entry>
-------------------------example.log.wrapper.xml-------------
<?xml version="1.0" ?>
<!DOCTYPE logentrys [<!ENTITY logdata SYSTEM "example.log">]>
<logentries>
  &logdata;
</logentries>
-----------------------------
Well it is expected that you include example.log in another file with a top
level element. The reason for this is to make it more difficult to end up
with a invalid XML tree if the logging shuts down uncleanly.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: root wrapper

Posted by Ceki Gülcü <cg...@qos.ch>.

It seems good to me. I suggest that you write an error handler 
for your parser so that you can identify the exact place where the error occurs.  
If you don't know how to do this see the latest code in your log4j CVS repository under
../src/java/org/apache/log4j/xml/

Regards, Ceki


At 11:32 11.10.2001 -0700, you wrote:
>I fail to parse the suggested linked file with the following code over
>crimson-jaxp, while ie5 shows it nicely. Can anybody suggest? If I manually
>directly wrap entries with a root, it parses well. May be I need a newer
>parser? How others parse xml formatted logs?
>------------------------code----------------------
>      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>      DocumentBuilder db = dbf.newDocumentBuilder();
>      Document document = db.parse (XML_WRAPPER_FILE); // fails
>------------------output-------------
>org.xml.sax.SAXParseException: org.apache.crimson.parser/P-076 Unconvertible
>UTF-8 character beginning with 0xa0
>        at
>org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1038)
>        at
>org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1010)
>        at org.apache.crimson.parser.InputEntity.peek(InputEntity.java:841)
>        at org.apache.crimson.parser.Parser2.peek(Parser2.java:2922)
>        at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:994)
>        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:485)
>        at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
>        at
>org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
>        at
>org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:1
>73)
>        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:134)
>        at
>com.xmlglobal.goxmldb.test.logging.ParseLog.actualExecute(ParseLog.java:68)
>-------------------------------------------example.log----------------------
>----
><log-entry>
>  <time>1002256390714</time>
>  <priority>INFO</priority>
>  <category>my</category>
>  <message><![CDATA[ <<<< mess, but still parsable ]]></message>
></log-entry>
><log-entry>
>  <time>1002256391225</time>
>  <priority>INFO</priority>
>  <category>my</category>
>  <message><![CDATA[my message for log entry 1]]></message>
></log-entry>
>-------------------------example.log.wrapper.xml-------------
><?xml version="1.0" ?>
><!DOCTYPE logentrys [<!ENTITY logdata SYSTEM "example.log">]>
><logentries>
>  &logdata;
></logentries>
>-----------------------------
>Well it is expected that you include example.log in another file with a top
>level element. The reason for this is to make it more difficult to end up
>with a invalid XML tree if the logging shuts down uncleanly.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

--
Ceki Gülcü - http://qos.ch
Link of the day: http://www.skeptictank.org/isaac.htm


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org