Hi,
take a look at the XMLFormatter class. I have not used it directly
myself but it does seem to provide escaping functionality.
Gareth
On Mon, 7 Oct 2002 [EMAIL PROTECTED] wrote:
>
> Hello Gareth,
>
> Thank you for e-mailing.
>
> The problem I have is that the database query could bring back 20,000 rows
> each with a few large text fields. Constructing a DOM tree only to
> serialize would take up a lot of memory (I agree it is cheap these days but
> if not enough program can crash). What I would like to do is something
> like:
>
> //--- start
>
> XMLString strXML;
> long counter = 0;
>
> Open DB query // SELECT ... FROM ...
> fopen("xml.txt", w);
>
> fprintf(f, "<?XML... UTF-8...>");
> fprintf(f, "<rootNote>");
>
> while(!eof())
> {
> strXML.ConvertToUTF8(readDB("fieldName"));
> fprintf(f, "<dbdata counter=\"%d\">%s</dbdata>",
> counter++, strXML.getEncodedString() );
> nextDB();
> }
>
> fprintf(f, "</rootNote>");
> close everything.
>
> //---end
>
> The problem is dbText field can contain all sorts of things including <&>"#
> characters.
>
> I am now thinking of writing my own UTF function that will try to #xxx
> evething that is not A-Z, a-z, 0-9. I just need to make sure that MS
> Windows ANSI characters, i.e. MFC CString, are the same as UTF-8 that I
> think are.
>
> If were in my place would you do this? Is it a good idea? Any other ideas
> will a greatly appreciated.
>
> Please help,
> regards,
> Tushar
>
>
>
>
>
>
> Gareth Reakes
>
> <gareth@decisions To: [EMAIL PROTECTED]
>
> oft.com> cc: [EMAIL PROTECTED]
>
> Subject: Re: Submitting questions to
>Xerces
> 04-10-2002 09:38
>
>
>
>
>
>
>
>
>
> Hi,
> can you expand on what you want to do? There are classes such
> as
> DOMWriter that will write out a DOM tree for you, but for that you will
> have to have a DOM tree. If you have a database you will have to define
> what the mapping is to XML whether you use a DOM tree or not. You could
> write a wrapper arround your database that created SAX events. This then
> could be used to create a DOM tree or just serialize the document (there
> must be code arround somewhere that serializes from sax events).
>
> Gareth
>
>
>
> On Thu, 3 Oct 2002, Gareth Reakes wrote:
>
> >
> > The email address is [EMAIL PROTECTED]
> >
> >
> > Ive cced this mail to the list.
> >
> >
> > Gareth
> >
> >
> > On Thu, 3 Oct 2002 [EMAIL PROTECTED] wrote:
> >
> > >
> > > Hi,
> > >
> > > I found your e-mail addresses @
> > > http://marc.theaimsgroup.com/?t=103360990400002&r=1&w=2
> > >
> > > Can you please tell me how you managed to submit a question because I
> have
> > > one of my own. I have already tried the following addresses that did
> not
> > > work for me:
> > >
> > > [EMAIL PROTECTED]
> > > [EMAIL PROTECTED]
> > > [EMAIL PROTECTED]
> > > [EMAIL PROTECTED]
> > >
> > > My question is: How do I write a long XML document without having to
> worry
> > > about character-sets and encoding, or having to build a large DOM tree
> in
> > > memory (which is where I think DOM trees live, please correct me if I
> am
> > > wrong.)
> > >
> > > I know I can write ...
> > >
> > > Open DB table and output file
> > > while not eof() {
> > > readDB()
> > > fprintf(...)
> > > }
> > > close everything
> > >
> > > but then I will have to encode strings and have to worry about
> character
> > > sets and "<&>", etc. characters. This is why I was thinking of using
> Xerces
> > > but the API documentation does not say how.
> > >
> > > Please help.
> > >
> > > regards,
> > > Tushar
> > >
> > >
> > >
> > >
> >
> >
>
> --
> Gareth Reakes, Head of Product Development
> DecisionSoft Ltd. http://www.decisionsoft.com
> Office: +44 (0) 1865 203192
>
>
>
>
>
>
>
>
--
Gareth Reakes, Head of Product Development
DecisionSoft Ltd. http://www.decisionsoft.com
Office: +44 (0) 1865 203192
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]