46 #define NCBI_USE_ERRCODE_X Serial_Modules
51 : m_SourceFileName(name)
57 module->SetModuleContainer(
this);
73 if ( !(*mi)->Check() )
83 if ( !(*mi)->CheckNames() )
95 (*mi)->PrintSampleDEF(
out);
105 (*mi)->PrintASN(
out);
113 out <<
"M," << mi->get()->GetSourceLine() <<
',';
116 (*mi)->PrintSpecDump(
out);
123 (*mi)->PrintJSONSchema(
out);
133 (*mi)->PrintXMLSchema(
out);
142 string s, h(
"::DATATOOL:: ");
145 s = h +
"by application DATATOOL version ";
156 out <<
"-- ============================================\n";
158 out <<
"-- " << *
i <<
"\n";
160 out <<
"-- ============================================\n\n";
167 out <<
"<!-- ============================================\n";
169 out <<
" " << *
i <<
"\n";
171 out <<
" ============================================ -->\n\n";
178 (*mi)->PrintDTD(
out);
187 (*mi)->GetDTDFileNameBase() + (*mi)->GetModuleFileSuffix());
189 string fileName = fileNameBase +
".mod.dtd";
192 (*mi)->PrintDTD(
out);
197 string fileName = fileNameBase +
".dtd";
200 (*mi)->PrintDTDModular(
out);
211 (*mi)->GetDTDFileNameBase() + (*mi)->GetModuleFileSuffix());
213 string fileName = fileNameBase +
".mod.xsd";
218 (*mi)->PrintXMLSchema(
out);
222 string fileName = fileNameBase +
".xsd";
227 (*mi)->PrintXMLSchemaModular(
out);
235 string nsName(
"http://www.ncbi.nlm.nih.gov");
236 string nsNcbi(nsName);
237 string elementForm(
"qualified");
238 string attributeForm(
"unqualified");
243 const string& ns = defs.front().second->GetNamespaceName();
248 elementForm =
"unqualified";
253 if (
const CArgValue& px_ns = args[
"xmlns"] ) {
254 nsName = px_ns.AsString();
256 out <<
"<?xml version=\"1.0\" ?>\n";
258 out <<
"<xs:schema\n"
259 <<
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n"
260 <<
" xmlns:ncbi=\"" << nsNcbi <<
"\"\n";
261 if (!nsName.empty()) {
262 out <<
" xmlns=\"" << nsName <<
"\"\n"
263 <<
" targetNamespace=\"" << nsName <<
"\"\n";
265 out <<
" elementFormDefault=\"" << elementForm <<
"\"\n"
266 <<
" attributeFormDefault=\"" << attributeForm <<
"\">\n\n";
271 out <<
"</xs:schema>\n";
303 const string& typeName,
304 bool allowInternal)
const
311 "module not found: "+moduleName+
" for type "+typeName);
313 return mi->second->ExternalResolve(typeName, allowInternal);
317 bool allowInternal)
const
322 types.Add((*i)->ExternalResolve(typeName, allowInternal));
330 return types.GetType();
336 (*i)->CollectAllTypeinfo(
types);
342 moduleSet->SetModuleContainer(
this);
349 (*i)->PrintSampleDEF(rootdir);
363 (*i)->PrintSpecDump(
out);
370 (*i)->PrintJSONSchema(
out);
379 (*i)->PrintXMLSchema(
out);
387 "<!-- ======================== -->\n"
388 "<!-- NCBI DTD -->\n"
389 "<!-- NCBI ASN.1 mapped to XML -->\n"
390 "<!-- ======================== -->\n"
392 "<!-- Entities used to give specificity to #PCDATA -->\n"
393 "<!ENTITY % INTEGER '#PCDATA'>\n"
394 "<!ENTITY % ENUM 'EMPTY'>\n"
395 "<!ENTITY % BOOLEAN 'EMPTY'>\n"
396 "<!ENTITY % NULL 'EMPTY'>\n"
397 "<!ENTITY % REAL '#PCDATA'>\n"
398 "<!ENTITY % OCTETS '#PCDATA'>\n"
399 "<!-- ============================================ -->\n"
410 (*i)->PrintDTDModular();
417 (*i)->PrintXMLSchemaModular();
422 bool allowInternal)
const
427 types.Add((*i)->ExternalResolve(module, name, allowInternal));
435 return types.GetType();
439 bool allowInternal)
const
444 types.Add((*i)->ResolveInAnyModule(name, allowInternal));
452 return types.GetType();
459 if ( !(*mi)->Check() )
469 if ( !(*mi)->CheckNames() )
478 (*i)->CollectAllTypeinfo(
types);
list< pair< string, AutoPtr< CDataType > > > TDefinitions
void PrintXMLSchemaModular(void) const
void PrintASN(CNcbiOstream &out) const
void PrintXMLSchema(CNcbiOstream &out) const
list< AutoPtr< CDataTypeModule > > TModules
void PrintJSONSchema(CNcbiOstream &out) const
void PrintDTDModular(void) const
bool CheckNames(void) const
CDataType * ExternalResolve(const string &moduleName, const string &typeName, bool allowInternal=false) const
virtual const string & GetSourceFileName(void) const override
void PrintSampleDEF(const string &rootdir) const
void PrintXMLRefInfo(CNcbiOstream &out) const
string m_PrefixFromSourceFileName
void EndXMLSchema(CNcbiOstream &out) const
void PrintASNRefInfo(CNcbiOstream &out) const
void CollectAllTypeinfo(set< TTypeInfo > &types) const
void AddModule(const AutoPtr< CDataTypeModule > &module)
CFileModules(const string &fileName)
TModulesByName m_ModulesByName
virtual string GetFileNamePrefix(void) const override
void PrintSpecDump(CNcbiOstream &out) const
void PrintDTD(CNcbiOstream &out) const
void BeginXMLSchema(CNcbiOstream &out) const
void GetRefInfo(list< string > &info) const
CDataType * ResolveInAnyModule(const string &fullName, bool allowInternal=false) const
void PrintDTD(CNcbiOstream &out) const
void CollectAllTypeinfo(set< TTypeInfo > &types) const
void PrintSpecDump(CNcbiOstream &out) const
void PrintJSONSchema(CNcbiOstream &out) const
void AddFile(const AutoPtr< CFileModules > &moduleSet)
void PrintXMLSchema(CNcbiOstream &out) const
list< AutoPtr< CFileModules > > TModuleSets
void PrintDTDModular(void) const
CDataType * ResolveInAnyModule(const string &fullName, bool allowInternal=false) const
void PrintXMLSchemaModular(void) const
void PrintSampleDEF(const string &rootdir) const
bool CheckNames(void) const
void PrintASN(CNcbiOstream &out) const
CDataType * ExternalResolve(const string &moduleName, const string &typeName, bool allowInternal=false) const
virtual string GetFileNamePrefix(void) const
const CModuleContainer & GetModuleContainer(void) const
bool UseAllFileNamePrefixes(void) const
bool MakeFileNamePrefixFromSourceFileName(void) const
static CNcbiApplication * Instance(void)
Singleton method.
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
std::ofstream out("events_result.xml")
main entry point for tests
string DirName(const string &path)
string Path(const string &dir, const string &file)
string MakeAbsolutePath(const string &path)
bool IsLocalPath(const string &path)
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
CVersionInfo GetVersion(void) const
Get the program version information.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * get(void) const
Get pointer.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Fatal(CExceptionArgs_Base &args)
string GetName(void) const
Get the base entry name with extension (if any).
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
@ eCurrent
Use current time. See also CCurrentTime.
virtual string Print(void) const
Print version information.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static const struct type types[]