[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Best way to create an XML document

  • From: Robert Koberg <rob@k...>
  • To: xml-dev <xml-dev@l...>
  • Date: Wed, 09 Apr 2008 13:25:33 -0400

Re:  Best way to create an XML document
(lost the thread, so this will be off for the archives...)

I use the library, but I guess I am balancing the tags. If you really
need that kind of error checking, you could do as you suggest and use
DOM to create your 50MB XML instance in memory (ufff!), or you could use
something like xmlwriter and tagsoup (to balance any problems tags). 

But seriously, if you are constructing this in java, why would you have
problems balancing the tags as you use xmlwriter?

best,
-Rob


>From Mukul:
-----------------------------

I think there is bug in the xml-writer library posted on the site.

When I run this code (a slightly modified version of the sample
supplied on the site):

DataWriter w = new DataWriter();

w.setIndentStep(2);
w.startDocument();
w.startElement("foo");
w.dataElement("bar", "1");
w.dataElement("bar", "2");
w.startElement("hack");
w.dataElement("fubar", "zing");
w.endElement("hack");
w.dataElement("bar", "3");
w.endElement("fo"); //please note, I have violated the XML well-formedness rules
w.endDocument();

I get the output:

<?xml version="1.0" standalone="yes"?>
         ---------> This extra whitespace also annoys me ...
<foo>
  <bar>1</bar>
  <bar>2</bar>
  <hack>
    <fubar>zing</fubar>
  </hack>
  <bar>3</bar>
</fo>    -------> This is wrong.

Has anyone tried this library before? And what are the experiences.

On Wed, Apr 9, 2008 at 9:27 PM, Mukul Gandhi <gandhi.mukul@g...> wrote:
> Thanks Rob for sharing the information.
>
>  I'll try this ...
>
>
>  On Wed, Apr 9, 2008 at 8:51 PM, Robert Koberg <rob@k...> wrote:
>  > Try:
>  >
>  >  http://www.megginson.com/downloads/
>  >
>  >  xml-writer-0.2.zip
>  >
>  >  Easy and fast
>  >
>  >  best,
>  >  -Rob



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.