--- "Yuri A. Vovchenko"
<[EMAIL PROTECTED]> wrote:
> Dear Xerces developers
> I'm going to use your freeware XML-DOM library to
> write the XML data of ours
> application. But i don't see the way how your
> library allows to serialize
> created in memory DOM tree to a file. Please, could
> you give me your
> feedback on this issue.
> 
> Sincerely yours, Yuri Vovchenko, Software Developer
> for Materialise.
DISCLAIMER: This is a LONG post about this subject and
I may or may not know what I'm talking about.  If you
feel like this may be a waste of your time, do
yourself a favor and read no further.

Dear Yuri,

I am not in any way affiliated with the programming
team that developed Xerces, nor am I an experienced
programmer, although I do hope to be one, someday.  I
have, however, been working with Xerces on my own
application for some time now, and come up to the same
problem you have.  What I've come up with is this...

Apparently, the difficulty in using XML comes from
feeding it into the computer and making sense with it
in order to work with it in applications.  In order to
do this, you need a parser to make sense of the XML
data and bring order to it, so the computer can use it
in whatever language the parser is for ( C++, Java,
etc...).  As far as I can tell, that is the main
thrust of Xerces - parsing XML files so that they may
be used by the specific programming language it is
written in.

After you have parsed an XML file - either from an XML
file that you already had and read in with a parser,
or one that you built, yourself, in main memory (using
Xerces representations) - it is a simple matter of
serializing that information in a file called simply
"whatever".xml (where "whatever" is whatever you want
your xml file to be named), using the programming
language that you're working with's built-in
text-processing methods.

For example, as an exercise, I am writing a database
for my wife to keep track of our receipts and bills. 
Because I'd like to know how to implement such a
solution in real life, I am storing the information in
XML.  I have been trying for some time, reading
through the documentation provided with the Xerces
functions, as well as the provided examples, tracing
code from one module to another, and I still can't
find any included means of simply saving to an XML
file, once one's done with parsing it.

Upon reflection, this did not actually surpise me,
because - as I stated - the problem in dealing with
XML is not in the saving of it to a file (it is just
plaintext, afterall - albeit unicode formatted), it is
in the reading of it into a computer's logic systems. 
In other words, and in brief, it seems to me that the
best solution (unless I missed something, of course)
would be just to write your own function to output the
XML to a file, using the Xerces functions to read the
values into it.  I am currently working on such a
function, myself.

How I'm going to implement it is to just pass a
DOM_Document instance to it, then transcode the
DOMString to either std::string, std::cstring, wchar_t
*, or char *, and pass them to a filestream using an
ofstream or fstream instance.  Perhaps there's a
better way to do this, but I don't know it.

Developers - I don't know everything about this, so I
could easily be overstepping my bounds.  If so, you
have my apologies.  I just know how it is to be
overworked and having to respond to questions all the
time.  Also, I seem to remember seeing this question
at least 10 times when I looked through the archives
of the mailing list, so I thought it might be
worthwhile imparting what little I do know about this.
 If anyone reading this has any idea of a function
that will do this that is located in the standard
distribution of Xerces, please please please let me
know, as well. :)

Sincerely,
Rhys Black

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to