[xsd-users] Namespace name constant
Klaim - Joël Lamotte
mjklaim at gmail.com
Thu Aug 18 09:17:10 EDT 2011
Hi,
I can see in my xsd genereted code (
http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/include/aoslcpp/aosl/aosl.hpp
and
related files )
that the namespace name is always written directly as "
artofsequence.org/aosl/1.0" and not a constant.
I was looking for such a constant to use it in my tool code, in particular
in this case where I need validation (from
http://code.google.com/p/art-of-sequence/source/browse/tools/aosdesigner/core/Sequence.cpp
) :
Sequence::Sequence( Project& project, const boost::filesystem::path
sequence_file_path )
: m_project( project )
, m_location( sequence_file_path )
{
xml_schema::Properties properties;
properties.schema_location( "artofsequence.org/aosl/1.0",
path::AOSL_XSD_FILE.string() ); // HERE
boost::filesystem::ifstream filestream( full_location() );
try
{
auto sequence = aosl::parse_sequence( filestream, 0,
properties );
m_sequence.reset( sequence.release() );
}
catch( const ::xsd::cxx::tree::parsing< char >& e )
{
...
}
...
}
bool Sequence::save()
{
....
xml_schema::NamespaceInfomap namespace_infos;
namespace_infos["aos"].name = "artofsequence.org/aosl/1.0";
boost::filesystem::ofstream filestream( sequence_file_path
);
aosl::serialize_sequence( filestream, *m_sequence,
namespace_infos );
return true;
}
My questions :
1. Did I miss the existence of such a constant?
2. Is there a way to make the generator provide it?
I want the tool to be dependant on the version of the library which code
have been generated from the xsd, so I need them to use the same namespace.
So the name of the namespace should be available in the generated code.
I want to avoid having to change a constant in the tool code each time I
change the namespace in the xsd and generate code from it.
I'll certainly miss that change as several years might separate each
change...
Joël Lamotte
More information about the xsd-users
mailing list