C++ implementation of XML schema XSD 1.1? - c++

Is there any existing C++ implementation of the XML Schema XSD 1.1?
I found xerces-c++-3.1.1, but it only implements XSD 1.0.
The java counterpart of this project does implement XSD 1.1.
I am notably looking for a way to implement the 'assert' functionality.

The only released XSD 1.1 processors I am aware of are Xerces-J and Saxon-EE, which are both Java-based (though Saxon-EE is also released on .NET).
(EDIT, SIX YEARS LATER)
There is also an implementation from Altova.

Related

Alternative XSLT processor to Apache Xalan

I am currently using the Apache Xalan XSLT processor in my Java application, but I would like to use some alternative solution which supports use of extension functions. Xalan seems to be out of date and buggy. I know of Saxonixa Saxon, but it is closed sourced. Is there some open source and well working alternative?
The current open source version of Saxon, Saxon-HE 9.9, supports "integrated extension functions" (functions written to a particular Saxon-defined Java interface). It doesn't support "reflexive" extension functions (calls to arbitrary Java classes/methods found on the classpath).
Note that if you move to Saxon, with support for XSLT 2.0 and 3.0, you will find there is much less need for calling out to Java, because (a) the built-in function library is much larger, and (b) you can implement your own functions using the xsl:function declaration.

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++.

Single file non-validating xml parser/reader

I'm looking for a simple non-validating XML parser in either C or C++.
Several years back I found one that was just a single file solution but I can't find
it anymore.
I'm after some links and suggested ones that are very small and lightweight
ideally suited for an embedded platform.
Expat
You can work with or without validation and in "streaming mode". It is very lightweight.
What about something like pugixml. From their site...
pugixml is a light-weight C++ XML
processing library. It features:
DOM-like interface with rich traversal/modification capabilities
Extremely fast non-validating XML parser which constructs the DOM
tree from an XML file/buffer
XPath 1.0 implementation for complex data-driven tree queries
Full Unicode support with Unicode interface variants and
automatic encoding conversions
The library is extremely portable and
easy to integrate and use.
pugixml is developed and maintained
since 2006 and has many users. All
code is distributed under the MIT
license, making it completely free to
use in both open-source and
proprietary applications.
Also, this answer has more info.
There is also tinyxml and RapidXml.
There is definitely a pure C, tiny xml parser available. It was cited in an earlier answer on SO, but I can't find it right now. If I remember right, it's just a few hundred lines of code.
Update: Here's the question/answer that references it:
Is there a good tiny XML parser for an embedded C project?
And the actual code:
http://mercurial.intuxication.org/hg/cstuff/file/tip/tinyxml
RapidXML is a single-header (multiple headers if you want extra functionality) ultra-lightweight, ultra-fast implementation. It can operate in "destructive" mode, that means by setting pointers right into the XML and possibly overwriting some, avoiding all extra memory allocations and data copies.
tinyxml is not precisely single-header, but it is still fairly lightweight compared to other parsers. I've used it for half a decade without ever encountering an issue. The author has recently started with "tinyxml-2", which is supposedly better and even more lightweight, but I've not had occasion to actually try that one yet.
http://mercurial.intuxication.org/hg/cstuff/file/tip/tinyxml
can this parser work with nested XML like
<CServiceType>
<serno>61</serno>
<caption1 />
<caption2>Satelite</caption2>
<caption3 />
</CServiceType>

VC++ project: MSXML vs any other XML libraries

We are aware of MSXML, based on COM technologies. We want to use it for a VC++ project starting soon. Are there any other XML libraries do good compared to MSXML?
TinyXML - A C++ open source library
Will you be using the .Net Framework if so you may want to look at using linq to xml.
Take a look at RapidXML. Also, Boost.PropertyTree is an abstraction over property trees (XML, JSON, INI, INFO at the time of writing) and relies on RapidXML for its XML parser.
We ditched MSXML in favor of Xerces for our project, although Xerces is also a big, complicated beast. The TinyXML suggestion is probably a good one if it does everything you need it to. If you only need basic SAX model support (and not a DOM), then you might also consider expat which is one of the first widely used XML parsers.
LIBXML
"Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License."
I have used it for many years on Win32 projects without problem. It supports both SAX and DOM style reading.
You must take a look at Microsoft XmlLite which is a pull parser for pure C++. The primary goals of XmlLite are ease of use, performance, and standards compliance.