David,


"David A. Lee" wrote:
> 
> Thanks for the comments. I've already written my own (it wasnt difficult -
> took
> about an hour to integrate with our own IOStreaming classes)

Yes DOMPrint is easy....trying to do a cross platform port of Assaf's
serializers is not as easy as it sounds without giving up cross
application portability. In Java, the serializers can be used with any
SAX or DOM tree. In C++ they'd have to be tied directly to Xerces.

> I was just very supprised to see it missing in what is otherwise a very
> feature-complete
> library!
> 

I think it was an example in the Java version for a long time also.

> The other thing I saw was that DOMPrint was not handling encoding
> control-chars,
> (ch < ' ') it only encoded <> and &
> 
> This further let me to conclude that being part of the library instead of
> the samples
> is a worthwhile goal as the samples themselves are not complete.
>

I agree....


--Keith


 
> >
> > David,
> >
> >   I've started porting the serializes to C++ for use with TransforMiiX,
> > unfortunatly they can't readily be used in Xerces since TransforMiiX and
> > Xerces use different DOM implementations and SAX interfaces. The W3C
> > stayed clear of giving C++ bindings, probably due to all the
> > inconsistencies across platforms with C/C++. At one point Dave Megginson
> > proposed a C++ SAX interface, but he never made it official and it's not
> > available from his website. Again it's not an easy task...should I throw
> > exceptions or not? Should I rely on the STL or not? Most C++ compilers
> > don't support the STL well.
> >
> >   In anycase I can look into getting something working for Xerces when I
> > get back from ApacheCon. Hopefully if I do, Assaf will maintain both the
> > Java and C++ code bases...but I'll have to bribe him I think.
> >
> >  Of course feel free to jump right in and do a direct port for Xerces C
> > if you are interested in doing so.
> >
> >
> > --Keith
> >
> > The biggest problem
> >
> > "David A. Lee" wrote:
> > >
> > > Any idea if this object will be provided in the C++ XERCES-C ?
> > > I'm now using code coppied from DOMPrint ... but really am supprised
> > > its not a supplied class instead of just code in the sample.
> > >
> > > > The documentation is really sparse on this so maybe I'm just using it
> in
> > > > a way which is not intended but it appears to me that using the same
> > > > serializer for more than one document fails.
> > > >
> > > >      XMLSerializer serializer = new XMLSerializer(System.out, null);
> > > >      System.out.println("Doc1:");
> > > >      serializer.serialize(doc1);
> > > >      System.out.println("Doc2:");
> > > >      serializer.serialize(doc2);
> > > >
> > > > gives:
> > > >
> > > > Doc1:
> > > > <?xml version="1.0"?>
> > > > <el1><el1.2/></el1>
> > > > Doc2:
> > > > <el2><el1.1 a1="v1" a2="v2"><el1.1.1/></el1.1></el2>
> > > >
> > > > The XML declaration is missing in the second output.
> > > > To make this work I have to patch BaseMarkupSerializer.java like this:
> > > >
> > > > diff -c -r1.11 BaseMarkupSerializer.java
> > > > *** BaseMarkupSerializer.java   2000/02/23 21:41:18     1.11
> > > > --- BaseMarkupSerializer.java   2000/03/06 23:46:49
> > > > ***************
> > > > *** 416,421 ****
> > > > --- 416,422 ----
> > > >           if ( _writer == null )
> > > >               throw new IllegalStateException( "SER002 No writer
> > > > supplied for serializer" );
> > > >           try {
> > > > +           reset();
> > > >               startDocument();
> > > >           } catch ( SAXException except ) { }
> > > >           serializeNode( doc );
> > > >
> > > > Again, I'm not sure this is a valid use of it though, so I'm not sure
> > > > it's ok to commit my changes.
> > > > --
> > > > Arnaud  Le Hors - IBM Cupertino, XML Technology Group
> > > >
> > > >
> >
> >

Reply via email to