-
Creating an XML file
I've written a data converter in C++. The output today is fixed length records in ASCII TEXT format. I want to add support for XML output.
I've created XML documents in the past, but I've always taken a hacker's approach. By this I mean I simply remember the nesting level of the current set of tags I'm working with, and create subroutines where I'll pass a tag or data value and it will get wrapped in the appropriate delimiters ( "<>" & "</>"), be indented for ease of human reading, and be output. So, essentially, I've separated the data from the formatting, and only apply the formatting at output time.
However, I suspect there might be libraries of functions that exist for outputting in XML format where I can define, perhaps, the namespace and then pass (essentially) raw data to it and it will do all the output formatting for me. Do such libraries exist?
Thanks, Todd
-
XercesC is a pretty popular xml library, but it won't build the tree for you. It will validate your tree against a schema though.
-
"schema" - that was the term I was looking for, not namespace. Thanks.
Perhaps I should write one!!
Thanks.
-
I would use Xerces as has been suggested. Tinyxml is also available but not nearly as robust.
Be aware that Xerces is not all that friendly at first but once you get used to it, it's a snap. Xerces is also NOT thread safe.
-
I suggest libxml. It works well, and is faster than any other implementation I've used.