apple's property list (plist) implementation in c++ - c++

I'm tasked with reading Apple's property list files within a c++ application. Focusing primarily on the xml-type plist files specified in OS X, which mimic a xml-type implementation.. Apple's implementation of their property list is described here:
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/plist.5.html
I'm wondering if there are classes or libraries available that already can read this type of implementation within standard c++ (not Objective-C); hoping to find something rather than rolling our own. Are there any open-source implementations of this available?

PList files are not only mimicing XML, they are XML, including valid XML headers.
Any XML reader should be able to parse these files as a result. If you're looking for a logical class that abstracts the files, I'm not aware of any existing ones. Given Apple's documentation, you should be able to write one yourself with an XML reader, although it would take some work for full compatibility.

For topic starter it is too late, I know, but maybe it helps somebody
https://github.com/animetrics/PlistCpp
This is a C++ Property List (plist) serialization library (MIT license).
It supports both XML and binary versions of the plist format and is designed to
be cross platform with minimal dependencies.

Is that target-specific?
For Windows, there is a crude solution which consists of using the functions of iTunes dynamic libraries to parse plist files (either binary or plain text format work).
That's a code originally written to interface an iPod, but you can easily extract the few functions you are interested in.
The repository is on this project page: http://code.google.com/p/t-pot/
Look for the file iPoTApi.h and iPoTApi.cpp, the function TranslatePLIST of the class CiPoTApi.
I wish there were a better solution, at the time I tried to compile it from Apple's sources targeted at Windows but it is a real nightmare, and files are missing. So using their libraries was a considerable shortcut.

Related

MFC XML Serialization

Can I serialize C++ class object to XML file using MFC Serialization. I found libraries like Boost, XML Foundation to perform this but I don't want to use any third party lib.
Is it possible in MFC C++ serialization or using any other core/native lib. Please help on this.
MFC does not have any native Xml serialization. You're either going to have to roll your own, or use a 3rd-party library. Why you have set yourself this false limitation is entirely unknown.
If it is size, or a dependency issue you are concerned about, I recommend TinyXml which you can include directly in to your C++ project and therefore have no dependencies and excellent Xml reading and writing. Note that this won't serialize an object by default, you'll have to use the class to write the Xml out yourself.
Alternatively you can look at this link in CodeProject on Xml serialization. Once again, this will require effort on your behalf.

Generating classes from XML in C++ (but NOT using CodeSynthesisXSD)

We require the ability to generate C++ classes from XML (akin to JAXB in Java) but for commercial reasons do not wish to use CodeSynthesisXSD. Are there any other libraries out there that will allow this? The platform we are targeting is Windows.
We have been looking at xmlbeansxx but this has not been maintained for 5 years and requires an older version of Boost than we have currently in our system (and do not want to have multiple Boost versions).
CodeSynthesis XSD author here.
First of all, a small nitpick: CodeSynthesis XSD doesn't generate C++ classes from XML. It generates them from XML Schema. From your question it appears that XSD would have worked for you. So I assume you are actually looking to generate C++ from XML Schema.
Now to your question. I don't believe there is a usable and more liberally-licensed C++ tool out there that can do this. Also, if your XML vocabulary is fairly small (e.g., a configuration format), then you may consider using XSD under the free proprietary license. It allows you to use XSD in a commercial application without having to release your source code as long as the amount of the generated code is less than 10,000 lines. And, as the name suggests, it is free (as in no charge).

Is there an equivalent of XSD2Code in native c++?

In C#, I use XSD2Code in order to:
generate automatically entities from XSD
generate methods which serialize/deserialize XML stream in these entities
Does it exist in the native C++ world?
I am looking for libs which work on Windows.
No, C++ has no such feature.
However, there are a plurality of libraries for C++ which provide everything you could possibly need. I am sure that at least several will exist to suit your XML needs (yuck!).
In particular, "CodeSynthesis XSD - XML Data Binding for C++" looks promising.
I get 1,120,000 Google results for xsd xml c++.

Auto generating objective-c classes from *.xsd schema file

I have XSD schema files that are huge in size.
I need to create classes from these files but doing so manually is not the right way as there are some tools that create classes automatically, for e.g. Microsoft tool "XSD.exe" that converts the files into c++ classes. I wanted to use them in Xcode but I am finding it difficult to port it.
What is a good tool that can generate objcetive-c classes which can be used on iOS?
Thanks in advance,
Amit
If your generated C++ is standards compliant (no platform specific extensions), you can just use the C++.

C++ code/XML generation tools

I'm not sure what exactly the right term is, kind of like ORM using XML as the data store. Are there any decent tools which will autogenerate C++ classes (including data and serialization/deserialization) based on an XML schema? Or will create XML-sync code and schema based on a C++ class definition?
TinyXML is great but it's so old-school to spend all that time writing code to load/save XML data to classes. I've seen similar tools focused on SOAP/WSDL, but they generated all kinds of other code on top of the basics.
Any good open-source libraries out there?
The only thing I've seen that attempts to do this is CodeSynthesisXSD.
If you are looking for an open source and commercial licensed tool to auto-generate C++ classes, including data and serialization/deserialization, based on an XML schema, then I strongly recommend GSOAP. It is easy to use, compliant to industry standards, and actively maintained.
See also http://www.rpbourret.com/xml/XMLDataBinding.htm
I was disappointed with many other C++ XML tools that promise full data bindings but will fail to process more extensive sets of WSDLs and schemas such as ONVIF. Having to retool an entire project was a pain. I know that GSOAP will do the job. A winner IMHO.
Not open source, but won't XML Thunder work for you?