[xsd-users] Validation of XML files using a cached schema with xsd parser

David White dawhite32 at gmail.com
Thu Oct 30 20:40:06 EDT 2025


Thanks Boris and Stefan for your respective replies.

To clarify, I would like to be able to parse XML files using xsd C++/Parser
(via xerces-c++) without having to ship and parse an external XML schema
file.  Thus, I am hoping to hard code (or cache) the XML schema within the
source code, either as plain text or in binary form, so that XML files can
be parsed without resorting to an external XML schema file.

The reference I provided showed it is possible for C++/Tree - see the
following messages in the thread:
https://codesynthesis.com/pipermail/xsd-users/2006-September/000536.html
https://codesynthesis.com/pipermail/xsd-users/2006-September/000540.html

Is it possible for C++/Parser and if so, how?

Kind regards, David.


On Wed, Oct 15, 2025 at 2:18 AM Stefan de Konink <stefan at konink.de> wrote:

> Op 14-10-2025 om 4:37 p.m. schreef Boris Kolpackov:
> > David White <dawhite32 at gmail.com> writes:
> >
> >> Does the C++/Parser support validation of xml files using a cached (or
> >> hard-coded) schema (rather than pointing to an external schema via
> >> xsi:noNamespaceSchemaLocation="schema.xsd"), as suggested by you for
> >> C++/Tree [1]?  If so, could you please provide a basic example?
> >
> > Assuming you are using Xerces-C++ as the underlying parser, then yes.
> > I don't have an example handy, but the following section from the
> > documentation should give you some hints (in particular, look at
> > no_namespace_schema_location() in properties):
> >
> >
> https://codesynthesis.com/projects/xsd/documentation/cxx/parser/guide/#7.1
>
> My understanding of the question was: can a C++ code tree be generated,
> that would be a custom validator for this specific schema, without the
> need to ship the original XML Schema or to parse it.
>
> --
> Stefan
>


More information about the xsd-users mailing list