Why is that not what you hoped for? Because of the <xml-fragment>? You have to 
use the Document class to get the enclosing element output correctly (or use 
XmlOptions.saveOuter()).

One thing to keep in mind is that XmlBeans requires well-formed XML documents 
in order to be able to process them (that's because we use an off-the-shelf 
parser to do the ... well, parsing). So if there is a possibility that the end 
tag will not be output, you have to have an extra step to "fix" the document by 
closing all opened tags, outside of XmlBeans, before you can use the document. 
(As an aside, this is the reason that <xml-fragment> exists in the first place, 
to allow one to save xml fragments which are not well-formed XML documents and 
still be able to load them using an XML parser).

Hope this helps,
Radu

-----Original Message-----
From: Flame [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 1:27 PM
To: [email protected]
Subject: Can it be done?


Hi again,

I'm still trying to figure out a few things in this system, but I could 
use a little guidance as to if it's possible to accomplish my goal at all.

I'd like to use XMLBeans in a Formatter, replacing the existing 
XMLFormatter in the java.util.logging package.  I have written an 
adaptation of the existing XML DTD as a schema document, but now I face 
a problem.  The logging framework has no guarantee of closure.  If the 
java runtime crashes or is killed unexpectedly, the framework may not be 
able to append a closing tag at the end.

There is a secondary application being developed which is expected to be 
able to parse and filter these log files.

I'd like to be able to use XMLBeans on both the write side and the read.

Now, I hope I've explained this well enough, I'm at a loss as to how to 
make this work, or even if it can work.  Attached is the current schema 
definition file, and the current form of XMLFormatter replacement which 
attempts to use it.    Unfortunately it outputs entries similar to:

<xml-fragment millis="1119901463411" 
date="2005-06-27T15:44:23.411-04:00" sequence="0" 
level="1000"><log:logger 
xmlns:log="logformat.util.physics.mcla.org"/><log:thread 
xmlns:log="logformat.util.physics.mcla.org">10</log:thread><log:class 
xmlns:log="logformat.util.physics.mcla.org">java.util.logging.LogManager$RootLogger</log:class><log:method
 
xmlns:log="logformat.util.physics.mcla.org">log</log:method><log:message 
xmlns:log="logformat.util.physics.mcla.org">Testing severe 
warning</log:message></xml-fragment>

And this isn't quite what I hoped for obviously.

I'm open to any and all suggestions,

Thanks

  ~ Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to