[xsd-users] MatMLschema supported?
Boris Kolpackov
boris at codesynthesis.com
Sat Dec 2 15:37:58 EST 2006
Hi Paul,
Paul McGrath <Paul.McGrath at BellshireTechnologies.com> writes:
> Has anyone had success with MatML schema the xml for material property data?
> http://www.matml.org/
I just tried the compile MatML schema and everything works fine. I created
a small test application (below) which read in the data, dumps it to the
terminal and saves the object model back to XML. I tried it on the examples
I got from the website and everything works fine (note that I had to change
http://www.w3.org/2000/10/XMLSchema-instance
to
http://www.w3.org/2001/XMLSchema-instance
since that's the correct URI and also the third example contains invalid
characters for UTF-8).
I tried it on both GNU/Linux with GCC 4.1.1 and Windows with VC++ 7.1. For
the test below I used the following command line to compile the schema:
xsd cxx-tree --generate-ostream --generate-serialization matml31.xsd
You can also use the --morph-anonymous option if you would like to name
a few anonymous types found in the schema.
hth,
-boris
#include <memory>
#include <fstream>
#include <iostream>
#include "matml31.hxx"
using namespace std;
int
main (int argc, char* argv[])
{
if (argc != 2)
{
cerr << "usage: " << argv[0] << " <xml-file>" << endl;
return 1;
}
try
{
auto_ptr<MatML_Doc::type> doc (MatML_Doc (argv[1]));
cout << *doc << endl;
ofstream ofs ("out.xml");
xml_schema::namespace_infomap map;
map[""].schema = "matml31.xsd";
MatML_Doc (ofs, *doc, map);
}
catch (const xml_schema::exception& e)
{
cerr << e << endl;
return 1;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061202/cf3f2b20/attachment.pgp
More information about the xsd-users
mailing list