XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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@gmail.com> wrote:
> Thanks Rob for sharing the information.
>
>  I'll try this ...
>
>
>  On Wed, Apr 9, 2008 at 8:51 PM, Robert Koberg <rob@koberg.com> 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS