I'm not sure if it should be a Node, particularly as its not really visible
to XPath, though certainly the encoding scheme should be a property of a
Document (since there is only one document).

James

From: "Christian Holmqvist, IT, Posten" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 8:32 AM
Subject: SV: [dom4j-user] How set Document Encoding w/o OutputFormatter
class???


Another way to solv this is to treat the <!xml element as a node with
default behaivor (needs to be there) and restrictions (there can only be
one...)

I know that it might be best suited in the output class but there is a big
implementation advantage to move it into the normal behaivor pattern. (i.e.
treat it as a node).

/Cheers Christian

> -----Ursprungligt meddelande-----
> Från: James Strachan [mailto:[EMAIL PROTECTED]]
> Skickat: den 20 juni 2002 09:12
> Till: Jim Otte; [EMAIL PROTECTED]
> Ämne: Re: [dom4j-user] How set Document Encoding w/o OutputFormatter
> class???
>
>
>
> From: "Jim Otte" <[EMAIL PROTECTED]>
> > A beginner question- is there a way of setting the Document encoding
> without
> > using OutputFormatter?- eg- I now use;
> >
> >      OutputFormat outFormat = new OutputFormat();
> >      outFormat.setEncoding("US-ASCII");
> >      StringWriter writer = new StringWriter();
> >      XMLWriter out = new XMLWriter(writer, outFormat);
> >      out.write(myDocument);
> >      String s = writer.toString();
> >      System.out.println("MyDocument with ASCII encoding: " + s);
> >
> > I would like a way to just say:
> >
> > Document document = DocumentHelper.createDocument();
> > ...
> > String serializedDocument = document.asXML();
> >
> > This previous way always gives document with encoding of
> UTF-8- is there a
> > way of setting the encoding without going through
> OutputFormat class (for
> > performance reasons) and getting the String xml through
> method asXML()?
>
> Right now there isn't a way to do that. Maybe Document could have an
> optional encoding property that could be used by the asXML()
> to set the
> encoding?
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
> -------------------------------------------------------
>                    Bringing you mounds of caffeinated joy
>                    >>>     http://thinkgeek.com/sf    <<<
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>


-------------------------------------------------------
                   Bringing you mounds of caffeinated joy
                   >>>     http://thinkgeek.com/sf    <<<

_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to