From 741bfb659caaa771c748d03df26792fab10e5778 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 26 Sep 2023 10:43:31 +0200 Subject: Add XSD and C++ compiler command lines to example READMEs --- xsd-examples/cxx/tree/custom/comments/README | 42 ++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'xsd-examples/cxx/tree/custom/comments') diff --git a/xsd-examples/cxx/tree/custom/comments/README b/xsd-examples/cxx/tree/custom/comments/README index 8fd69d0..32412db 100644 --- a/xsd-examples/cxx/tree/custom/comments/README +++ b/xsd-examples/cxx/tree/custom/comments/README @@ -16,9 +16,17 @@ people.xml Sample XML instance document. xml-schema.hxx - C++ types for XML Schema built-in types. This header file is generated - by XSD using the --generate-xml-schema option. The --custom-type option - is also used to customize the xsd:anyType type. + C++ types for XML Schema built-in types. + + This header file is generated by by the XSD compiler in the + --generate-xml-schema mode using the following command line: + + xsd cxx-tree --generate-xml-schema \ + --generate-serialization \ + --custom-type anyType=/type_base \ + --hxx-epilogue '#include "xml-schema-custom.hxx"' xml-schema.xsd + + The --custom-type option is used to customize the xsd:anyType type. people.hxx people.ixx @@ -26,9 +34,15 @@ people.cxx C++ types that represent the person record vocabulary, a set of parsing functions that convert XML instance documents to a tree-like in-memory object model, and a set of serialization functions that - convert the object model back to XML. These are generated by XSD - from people.xsd with the --extern-xml-schema option in order to - include xml-schema.hxx. + convert the object model back to XML. + + These files are generated by the XSD compiler from people.xsd using the + following command line: + + xsd cxx-tree --generate-serialization --extern-xml-schema xml-schema.xsd \ + people.xsd + + The --extern-xml-schema option in used to include xml-schema.hxx. xml-schema-custom.hxx Header file which defines our own xml_schema::type class. It is @@ -52,6 +66,18 @@ driver.cxx on this object model. Finally, it serializes the modified object model back to XML, including XML comments. -To run the example on the sample XML instance document simply execute: +To compile and link the example manually from the command line we can use +the following commands (replace 'c++' with your C++ compiler name): + +c++ -DXSD_CXX11 -c people.cxx +c++ -DXSD_CXX11 -c xml-schema-custom.cxx +c++ -DXSD_CXX11 -c dom-parse.cxx +c++ -DXSD_CXX11 -c driver.cxx +c++ -o driver driver.o people.o xml-schema-custom.o dom-parse.o -lxerces-c + +Note that we need to define the XSD_CXX11 preprocessor macro since the +source code includes libxsd headers directly. + +To run the example on the sample XML instance document execute: -$ ./driver people.xml +./driver people.xml -- cgit v1.1