Learning the basics of XML for the first time from W3C tutorials. How are most XML files generated? Does the server side application usually print a complete XML file to be parsed each time there is new data?
I have a CGI application in C and it includes the SQLite API. Is the best way to do some sort of printf
to a XML file (using my data from the database) so it can be parsed?
Thanks.
-
Most XML documents are created via APIs.
Often this are created in memory and then processed further (e.g. via XSLT) into other forms, or sent over network links.
You can use string concatenation to build XML, but you have to be careful with character encoding and structure. Generally an XML API will be easier except for the simplest of documents. (Albeit some APIs are easier than others).
Tommy : Anyone recommend a good XML APIs. Will it be in C which I can add to my project? -
XML can be generated in any way one would like, that is one of its advantages.
It is generally possible to spew out XML, although it is not very human readable. If you directly write XML, use some utility class or library (there are quite a few around) that can help you create nicely formatted XML (e.g., it will track the current depth, what the current open element is, etc.)
Many APIs (also for OOP languages) also allow you to directly manipulate a DOM tree that represents your XML document, and then to force its output as XML.
-
It's up to you how you will do this. Lets say you have this structure
<logfile> <logentry>...</logentry> ... </logfile>
You can append log entries to the beging or end by looking for tags they are contained in.
0 comments:
Post a Comment