comp.text.xml
[Top] [All Lists]

Re: SAX Parser for creating (not parsing) XML document

Subject: Re: SAX Parser for creating (not parsing) XML document
From: Philippe Poulard
Date: Thu, 24 Jul 2008 10:52:15 +0200
Newsgroups: comp.text.xml


Stefan Ram a écrit :
Naresh Agarwal <naresh.agarwal@xxxxxxxxx> writes:
Is there any thing available for this with Java 1.5, any open
source app?

  Writing XML is simpler than reading XML.

  So, sometimes, one can get by with no library at all:

outStream.print( "<" );
outStream.print( type );
outStream.print( ">" );


hi,

IMHO, this is one of the worst practice

outStream.print( "<" );
outStream.print( type );
outStream.print( ">" );
outStream.print( "if (a<b ) {}" );

you'll have too many occasions to break your XML result ; rely on tools made for that purpose that will produce well-formed XML

you can also use templates for creating SAX documents with RefleX :
http://reflex.gforge.inria.fr/tips.html#createFromScratch
of course, you can loop on whatever you want to create content (merge thousand XML files for example: reflex.gforge.inria.fr/tips.html#parsingFragments">http://reflex.gforge.inria.fr/tips.html#parsingFragments )

then pipe the created doc to an XSLT serializer :
                                reflex.gforge.inria.fr/tips.html#xsltSerialization">http://reflex.gforge.inria.fr/tips.html#xsltSerialization

you can use it from the command line, embed it in a program, or deploy it within a web server

tutorials are available here :
                                reflex.gforge.inria.fr/tutorial.html">http://reflex.gforge.inria.fr/tutorial.html

I will talk about all that stuff at Balisage 2008 in Montreal, with a focus on schema languages
                                www.balisage.net/Program.html#h245p">http://www.balisage.net/Program.html#h245p

--
Cordialement,

              ///
             (. .)
 --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
 -----------------------------
                                 reflex.gforge.inria.fr/">http://reflex.gforge.inria.fr/
       Have the RefleX !

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy