Nope, I tried it with your parsing set up and I get the same thing... I'm using the latest Xerces.
thanx anyways,
eric.
On Thu, May 17, 2001 at 12:42:52PM +1000, Anthony Ikeda wrote:
> Mine is the same, the code output has return codes throughout it (we have
> some other pre-XML classes that do half of the job).
>
> The code below actually reformats the whole file. What version of Xerces are
> you using? I've tried it with the latest version (1.3.1) and Xalan 2.0.1.
>
> It's possible your parsing is not set up properly, give this a go:
>
> public static Document parseDoc(String uri){
> DOMParser parser = new DOMParser();
> try{
>
> parser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whit
> espace",false);
> parser.setFeature("http://xml.org/sax/features/namespaces",false);
>
> parser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-node
> s",false);
>
> parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error
> ",true);
>
> parser.setFeature("http://xml.org/sax/features/validation",true);
> parser.parse(uri);
> } catch (IOException ioe){
> System.out.println(ioe);
> } catch(SAXException se){
> System.out.println(se);
> }
> return parser.getDocument();
> }
>
>
>
> ----- Original Message -----
> From: "Eric" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 17, 2001 10:36 AM
> Subject: Re: problems formatting output - Mine works why doesn't yours?
>
>
> > ya, i do almost exactly the same thing. the problem is that the DOM
> > i'm writing out has been parsed by xerces from an XML document that
> > had no newlines, only tabs between tags...and i was really praying
> > that xerces would figure out that i like every tag on its own line,
> > indented nicely. ;)
> >
> > eric.
> >
> > On Thu, May 17, 2001 at 09:48:22AM +1000, Anthony Ikeda wrote:
> > > My code outputs fine:
> > >
> > > public static String serializeDoc(Element doc){
> > > String xmlString = new String();
> > > StringWriter stringOut = new StringWriter();
> > > OutputFormat opfrmt = new OutputFormat(doc.getOwnerDocument(),
> > "UTF-8",
> > > true);
> > > opfrmt.setIndenting(true);
> > > opfrmt.setPreserveSpace(false);
> > >
> > > XMLSerializer serial = new XMLSerializer(stringOut, opfrmt);
> > >
> > > try{
> > > serial.asDOMSerializer();
> > > serial.serialize( doc );
> > > xmlString = stringOut.toString();
> > > } catch(java.io.IOException ioe){
> > > xmlString=null;
> > > }
> > > return xmlString;
> > > }
> > >
> > > Let me know if you still have problems
> > > ----- Original Message -----
> > > From: "Eric" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, May 16, 2001 2:30 PM
> > > Subject: problems formatting output
> > >
> > >
> > > > I've been having some troubling problems using OutputFormat to write
> > > > out a DOM. I'm basically parsing some ugly XML (spaces before '>'s,
> > > > no newlines, etc.) into a DOM and then writing it back
> > > > out. I've traversed the DOM and it looks like it gets parsed just
> > > > fine, but when I use OutputFormat to write it out, the output still
> > > > has ugliness (although different from the input). Tags are
> > > > word-wrapped so that they split over lines, etc. It looks like
> > this:
> > > >
> > > > <time>15:04:27</time> <anten
> > > > type="broadcast"> <Station num="17650">
> > > >
> > > > What am I doing wrong???
> > > >
> > > > Thanks,
> > > > Eric.
> > > >
> > > > --
> > > > _____ _
> > > > | ____|(_) http://ir.iit.edu/~ej
> > > > | _| | | Page me via ICQ at
> > > > | |___ | | http://wwp.mirabilis.com/19022931
> > > > |______/ | or by mailing [EMAIL PROTECTED]
> > > > |__/
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > --
> > _____ _
> > | ____|(_) http://ir.iit.edu/~ej
> > | _| | | Page me via ICQ at
> > | |___ | | http://wwp.mirabilis.com/19022931
> > |______/ | or by mailing [EMAIL PROTECTED]
> > |__/
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
_____ _
| ____|(_) http://ir.iit.edu/~ej
| _| | | Page me via ICQ at
| |___ | | http://wwp.mirabilis.com/19022931
|______/ | or by mailing [EMAIL PROTECTED]
|__/
pgpwr1f352zzV.pgp
Description: PGP signature
