Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » org.apache.xml.serialize.OutputFormat
org.apache.xml.serialize.OutputFormat [message #21132] Sun, 04 May 2003 22:44 Go to next message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

In the org.eclipse.xsd.util.XSDResourceImpl class, I see the
doSerialize() method that handles the output format for the
serializer.

Is there a way we can create the instance of
org.apache.xml.serialize.OutputFormat and pass it into the
serializer? If not, can we add a method that does for this
need? Something like:

public static void doSerialize(OutputStream outputStream, OutputFormat
outputFormat, Element element) throws IOException

In this way the user can have more flexibility as well as provide
an alternative way to access the xml declaration, <?xml ... ?>.

Thank you.

Regards,


Pae
Re: org.apache.xml.serialize.OutputFormat [message #21230 is a reply to message #21132] Mon, 05 May 2003 10:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------21B9A48EFD42661211AB8FDB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Pae,

The latest driver has this overloaded version to make the encoding easy to
specify:

public static void doSerialize(OutputStream outputStream,
Element element, String encoding) throws IOException
{
OutputFormat outputFormat = new
OutputFormat(element.getOwnerDocument());
outputFormat.setLineWidth(80);
outputFormat.setIndenting(true);
outputFormat.setIndent(4);
outputFormat.setPreserveSpace(false);
outputFormat.setEncoding(encoding);
XMLSerializer serializer = new XMLSerializer(outputStream,
outputFormat);
serializer.serialize(element);
}

It seems to me that if you already have an output format, you may as well
use an XMLSerializer directly...


Pae Choi wrote:

> In the org.eclipse.xsd.util.XSDResourceImpl class, I see the
> doSerialize() method that handles the output format for the
> serializer.
>
> Is there a way we can create the instance of
> org.apache.xml.serialize.OutputFormat and pass it into the
> serializer? If not, can we add a method that does for this
> need? Something like:
>
> public static void doSerialize(OutputStream outputStream, OutputFormat
> outputFormat, Element element) throws IOException
>
> In this way the user can have more flexibility as well as provide
> an alternative way to access the xml declaration, <?xml ... ?>.
>
> Thank you.
>
> Regards,
>
> Pae

--------------21B9A48EFD42661211AB8FDB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Pae,
<p>The latest driver has this overloaded version to make the encoding easy
to specify:
<blockquote>&nbsp; public static void doSerialize(OutputStream outputStream,
Element element, String encoding) throws IOException
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp; OutputFormat outputFormat = new OutputFormat(element.getOwnerDocument());
<br>&nbsp;&nbsp;&nbsp; outputFormat.setLineWidth(80);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setIndenting(true);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setIndent(4);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setPreserveSpace(false);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setEncoding(encoding);
<br>&nbsp;&nbsp;&nbsp; XMLSerializer serializer = new XMLSerializer(outputStream,
outputFormat);
<br>&nbsp;&nbsp;&nbsp; serializer.serialize(element);
<br>&nbsp; }</blockquote>
It seems to me that if you already have an output format, you may as well
use an XMLSerializer directly...
<br>&nbsp;
<p>Pae Choi wrote:
<blockquote TYPE=CITE>In the org.eclipse.xsd.util.XSDResourceImpl class,
I see the
<br>doSerialize() method that handles the output format for the
<br>serializer.
<p>Is there a way we can create the instance of
<br>org.apache.xml.serialize.OutputFormat and pass it into the
<br>serializer? If not, can we add a method that does for this
<br>need? Something like:
<p>public static void doSerialize(OutputStream outputStream, OutputFormat
<br>outputFormat, Element element) throws IOException
<p>In this way the user can have more flexibility as well as provide
<br>an alternative way to access the xml declaration, &lt;?xml ... ?>.
<p>Thank you.
<p>Regards,
<p>Pae</blockquote>
</html>

--------------21B9A48EFD42661211AB8FDB--
Re: org.apache.xml.serialize.OutputFormat [message #21268 is a reply to message #21230] Mon, 05 May 2003 11:49 Go to previous message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

This is a multi-part message in MIME format.

------=_NextPart_000_005F_01C312DA.E0030290
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Ed,

I know I am not going and am not expecting to get everything I ask. :-)

Regards,


Pae

"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3EB643DD.C173543A@ca.ibm.com...
Pae,=20
The latest driver has this overloaded version to make the encoding =
easy to specify:=20

public static void doSerialize(OutputStream outputStream, Element =
element, String encoding) throws IOException=20
{=20
OutputFormat outputFormat =3D new =
OutputFormat(element.getOwnerDocument());=20
outputFormat.setLineWidth(80);=20
outputFormat.setIndenting(true);=20
outputFormat.setIndent(4);=20
outputFormat.setPreserveSpace(false);=20
outputFormat.setEncoding(encoding);=20
XMLSerializer serializer =3D new XMLSerializer(outputStream, =
outputFormat);=20
serializer.serialize(element);=20
}
It seems to me that if you already have an output format, you may as =
well use an XMLSerializer directly...=20
=20
Pae Choi wrote:=20

In the org.eclipse.xsd.util.XSDResourceImpl class, I see the=20
doSerialize() method that handles the output format for the=20
serializer.=20
Is there a way we can create the instance of=20
org.apache.xml.serialize.OutputFormat and pass it into the=20
serializer? If not, can we add a method that does for this=20
need? Something like:=20

public static void doSerialize(OutputStream outputStream, =
OutputFormat=20
outputFormat, Element element) throws IOException=20

In this way the user can have more flexibility as well as provide=20
an alternative way to access the xml declaration, <?xml ... ?>.=20

Thank you.=20

Regards,=20

Pae


------=_NextPart_000_005F_01C312DA.E0030290
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Ed,</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I know I am not going and am not expecting to get =
everything I=20
ask. :-)</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Regards,</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Pae</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:3EB643DD.C173543A@ca.ibm.com">news:3EB643DD.C173543A@ca.ibm.=
com</A>...</DIV>Pae,=20

<P>The latest driver has this overloaded version to make the encoding =
easy to=20
specify:=20
<BLOCKQUOTE>&nbsp; public static void doSerialize(OutputStream =
outputStream,=20
Element element, String encoding) throws IOException <BR>&nbsp; {=20
<BR>&nbsp;&nbsp;&nbsp; OutputFormat outputFormat =3D new=20
OutputFormat(element.getOwnerDocument()); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setLineWidth(80); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setIndenting(true); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setIndent(4); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setPreserveSpace(false); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setEncoding(encoding); <BR>&nbsp;&nbsp;&nbsp; =
XMLSerializer=20
serializer =3D new XMLSerializer(outputStream, outputFormat);=20
<BR>&nbsp;&nbsp;&nbsp; serializer.serialize(element); <BR>&nbsp;=20
}</BLOCKQUOTE>It seems to me that if you already have an output =
format, you=20
may as well use an XMLSerializer directly... <BR>&nbsp;=20
<P>Pae Choi wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">In the org.eclipse.xsd.util.XSDResourceImpl =
class, I=20
see the <BR>doSerialize() method that handles the output format for =
the=20
<BR>serializer.=20
<P>Is there a way we can create the instance of=20
<BR>org.apache.xml.serialize.OutputFormat and pass it into the=20
<BR>serializer? If not, can we add a method that does for this =
<BR>need?=20
Something like:=20
<P>public static void doSerialize(OutputStream outputStream, =
OutputFormat=20
<BR>outputFormat, Element element) throws IOException=20
<P>In this way the user can have more flexibility as well as provide =
<BR>an=20
alternative way to access the xml declaration, &lt;?xml ... ?&gt;.=20
<P>Thank you.=20
<P>Regards,=20
<P>Pae</P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_005F_01C312DA.E0030290--
Re: org.apache.xml.serialize.OutputFormat [message #570154 is a reply to message #21132] Mon, 05 May 2003 10:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33236
Registered: July 2009
Senior Member
--------------21B9A48EFD42661211AB8FDB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Pae,

The latest driver has this overloaded version to make the encoding easy to
specify:

public static void doSerialize(OutputStream outputStream,
Element element, String encoding) throws IOException
{
OutputFormat outputFormat = new
OutputFormat(element.getOwnerDocument());
outputFormat.setLineWidth(80);
outputFormat.setIndenting(true);
outputFormat.setIndent(4);
outputFormat.setPreserveSpace(false);
outputFormat.setEncoding(encoding);
XMLSerializer serializer = new XMLSerializer(outputStream,
outputFormat);
serializer.serialize(element);
}

It seems to me that if you already have an output format, you may as well
use an XMLSerializer directly...


Pae Choi wrote:

> In the org.eclipse.xsd.util.XSDResourceImpl class, I see the
> doSerialize() method that handles the output format for the
> serializer.
>
> Is there a way we can create the instance of
> org.apache.xml.serialize.OutputFormat and pass it into the
> serializer? If not, can we add a method that does for this
> need? Something like:
>
> public static void doSerialize(OutputStream outputStream, OutputFormat
> outputFormat, Element element) throws IOException
>
> In this way the user can have more flexibility as well as provide
> an alternative way to access the xml declaration, <?xml ... ?>.
>
> Thank you.
>
> Regards,
>
> Pae

--------------21B9A48EFD42661211AB8FDB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Pae,
<p>The latest driver has this overloaded version to make the encoding easy
to specify:
<blockquote>&nbsp; public static void doSerialize(OutputStream outputStream,
Element element, String encoding) throws IOException
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp; OutputFormat outputFormat = new OutputFormat(element.getOwnerDocument());
<br>&nbsp;&nbsp;&nbsp; outputFormat.setLineWidth(80);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setIndenting(true);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setIndent(4);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setPreserveSpace(false);
<br>&nbsp;&nbsp;&nbsp; outputFormat.setEncoding(encoding);
<br>&nbsp;&nbsp;&nbsp; XMLSerializer serializer = new XMLSerializer(outputStream,
outputFormat);
<br>&nbsp;&nbsp;&nbsp; serializer.serialize(element);
<br>&nbsp; }</blockquote>
It seems to me that if you already have an output format, you may as well
use an XMLSerializer directly...
<br>&nbsp;
<p>Pae Choi wrote:
<blockquote TYPE=CITE>In the org.eclipse.xsd.util.XSDResourceImpl class,
I see the
<br>doSerialize() method that handles the output format for the
<br>serializer.
<p>Is there a way we can create the instance of
<br>org.apache.xml.serialize.OutputFormat and pass it into the
<br>serializer? If not, can we add a method that does for this
<br>need? Something like:
<p>public static void doSerialize(OutputStream outputStream, OutputFormat
<br>outputFormat, Element element) throws IOException
<p>In this way the user can have more flexibility as well as provide
<br>an alternative way to access the xml declaration, &lt;?xml ... ?>.
<p>Thank you.
<p>Regards,
<p>Pae</blockquote>
</html>

--------------21B9A48EFD42661211AB8FDB--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: org.apache.xml.serialize.OutputFormat [message #570351 is a reply to message #21230] Mon, 05 May 2003 11:49 Go to previous message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

This is a multi-part message in MIME format.

------=_NextPart_000_005F_01C312DA.E0030290
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Ed,

I know I am not going and am not expecting to get everything I ask. :-)

Regards,


Pae

"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3EB643DD.C173543A@ca.ibm.com...
Pae,=20
The latest driver has this overloaded version to make the encoding =
easy to specify:=20

public static void doSerialize(OutputStream outputStream, Element =
element, String encoding) throws IOException=20
{=20
OutputFormat outputFormat =3D new =
OutputFormat(element.getOwnerDocument());=20
outputFormat.setLineWidth(80);=20
outputFormat.setIndenting(true);=20
outputFormat.setIndent(4);=20
outputFormat.setPreserveSpace(false);=20
outputFormat.setEncoding(encoding);=20
XMLSerializer serializer =3D new XMLSerializer(outputStream, =
outputFormat);=20
serializer.serialize(element);=20
}
It seems to me that if you already have an output format, you may as =
well use an XMLSerializer directly...=20
=20
Pae Choi wrote:=20

In the org.eclipse.xsd.util.XSDResourceImpl class, I see the=20
doSerialize() method that handles the output format for the=20
serializer.=20
Is there a way we can create the instance of=20
org.apache.xml.serialize.OutputFormat and pass it into the=20
serializer? If not, can we add a method that does for this=20
need? Something like:=20

public static void doSerialize(OutputStream outputStream, =
OutputFormat=20
outputFormat, Element element) throws IOException=20

In this way the user can have more flexibility as well as provide=20
an alternative way to access the xml declaration, <?xml ... ?>.=20

Thank you.=20

Regards,=20

Pae


------=_NextPart_000_005F_01C312DA.E0030290
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Ed,</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I know I am not going and am not expecting to get =
everything I=20
ask. :-)</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Regards,</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Pae</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:3EB643DD.C173543A@ca.ibm.com">news:3EB643DD.C173543A@ca.ibm.=
com</A>...</DIV>Pae,=20

<P>The latest driver has this overloaded version to make the encoding =
easy to=20
specify:=20
<BLOCKQUOTE>&nbsp; public static void doSerialize(OutputStream =
outputStream,=20
Element element, String encoding) throws IOException <BR>&nbsp; {=20
<BR>&nbsp;&nbsp;&nbsp; OutputFormat outputFormat =3D new=20
OutputFormat(element.getOwnerDocument()); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setLineWidth(80); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setIndenting(true); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setIndent(4); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setPreserveSpace(false); <BR>&nbsp;&nbsp;&nbsp;=20
outputFormat.setEncoding(encoding); <BR>&nbsp;&nbsp;&nbsp; =
XMLSerializer=20
serializer =3D new XMLSerializer(outputStream, outputFormat);=20
<BR>&nbsp;&nbsp;&nbsp; serializer.serialize(element); <BR>&nbsp;=20
}</BLOCKQUOTE>It seems to me that if you already have an output =
format, you=20
may as well use an XMLSerializer directly... <BR>&nbsp;=20
<P>Pae Choi wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">In the org.eclipse.xsd.util.XSDResourceImpl =
class, I=20
see the <BR>doSerialize() method that handles the output format for =
the=20
<BR>serializer.=20
<P>Is there a way we can create the instance of=20
<BR>org.apache.xml.serialize.OutputFormat and pass it into the=20
<BR>serializer? If not, can we add a method that does for this =
<BR>need?=20
Something like:=20
<P>public static void doSerialize(OutputStream outputStream, =
OutputFormat=20
<BR>outputFormat, Element element) throws IOException=20
<P>In this way the user can have more flexibility as well as provide =
<BR>an=20
alternative way to access the xml declaration, &lt;?xml ... ?&gt;.=20
<P>Thank you.=20
<P>Regards,=20
<P>Pae</P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_005F_01C312DA.E0030290--
Previous Topic:A Test with http://www.w3.org/2001/XMLSchema.xsd
Next Topic:A Diagnostic Message for the Valid Schema
Goto Forum:
  


Current Time: Sat Oct 19 17:20:54 GMT 2024

Powered by FUDForum. Page generated in 0.04509 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top