Rosetta
Public Member Functions | Private Member Functions | Private Attributes | List of all members
utility::tag::XMLSchemaDefinition Class Reference

The XMLSchemaDefinition class's purpose is to collect all of the elements that go into an XML Schema, to filter out the elements that are repeated (e.g. a restriction such as the "int_cslist" given in the description for XMLSchemaRestriction above may be reported twice to the XMLSchemaDefinition by several attributes that rely upon it), to detect non-identical duplicates that have the same name, and to write out the elements that it has been handed into a single string. The XMLSchemaDefinition is intended to be passed between static functions / non-class-member functions as a container for the XML Schema representations that these functions define. Such functions will always take an XMLSchemaDefinition reference as one of their input parameters. It is perfectly legitimate / recommended for one XML-schema-defining function that relies on a complexType or restriction that it does not itself define to pass its input XMLSchemaDefinition to the function that does define that complexType or restriction. More...

#include <XMLSchemaGeneration.hh>

Inheritance diagram for utility::tag::XMLSchemaDefinition:
Inheritance graph
[legend]

Public Member Functions

 XMLSchemaDefinition ()
 
 ~XMLSchemaDefinition () override
 
void add_top_level_element (XMLSchemaTopLevelElement const &element)
 
bool has_top_level_element (std::string const &element_name) const
 
std::string full_definition () const
 Returns the full XML schema definition, in XML format. More...
 
bool include_citation_info () const
 Adding citation info requires instantiating classes. If we don't need it (e.g. during Validation) just skip it. More...
 
void include_citation_info (bool setting)
 
std::string human_readable_summary (std::string const &component_name="", std::string const &component_type="", std::string const &citation_text="") const
 Returns a human-readable summary of the XML schema definition. More...
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Private Member Functions

void validate_new_top_level_element (std::string const &element_name, std::string const &definition)
 

Private Attributes

bool include_citation_info_ = true
 
std::list< std::string > elements_in_order_
 
std::map< std::string, std::string > top_level_elements_
 

Detailed Description

The XMLSchemaDefinition class's purpose is to collect all of the elements that go into an XML Schema, to filter out the elements that are repeated (e.g. a restriction such as the "int_cslist" given in the description for XMLSchemaRestriction above may be reported twice to the XMLSchemaDefinition by several attributes that rely upon it), to detect non-identical duplicates that have the same name, and to write out the elements that it has been handed into a single string. The XMLSchemaDefinition is intended to be passed between static functions / non-class-member functions as a container for the XML Schema representations that these functions define. Such functions will always take an XMLSchemaDefinition reference as one of their input parameters. It is perfectly legitimate / recommended for one XML-schema-defining function that relies on a complexType or restriction that it does not itself define to pass its input XMLSchemaDefinition to the function that does define that complexType or restriction.

Constructor & Destructor Documentation

◆ XMLSchemaDefinition()

utility::tag::XMLSchemaDefinition::XMLSchemaDefinition ( )
default

◆ ~XMLSchemaDefinition()

utility::tag::XMLSchemaDefinition::~XMLSchemaDefinition ( )
overridedefault

Member Function Documentation

◆ add_top_level_element()

void utility::tag::XMLSchemaDefinition::add_top_level_element ( XMLSchemaTopLevelElement const &  element)

◆ full_definition()

std::string utility::tag::XMLSchemaDefinition::full_definition ( ) const

◆ has_top_level_element()

bool utility::tag::XMLSchemaDefinition::has_top_level_element ( std::string const &  element_name) const

◆ human_readable_summary()

std::string utility::tag::XMLSchemaDefinition::human_readable_summary ( std::string const &  component_name = "",
std::string const &  component_type = "",
std::string const &  citation_text = "" 
) const

Returns a human-readable summary of the XML schema definition.

SLOW! Must generate the summary for every invocation.

Note
If component_name and component_type are provided, then summary information is only returned for that particular object type. For example, component_name="DeclareBond" and component_type="mover" would return information on the DeclareBond mover. Also note, this function uses raw pointers, unfortunately – the libxml2 functions that I'm calling require it. As such, no premature return statements should be added prior to the xmlFreeDoc and xmlCleanupParser statements at the end of the function.
Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu)

References full_definition(), and utility::xsd_util::generate_human_readable_summary().

◆ include_citation_info() [1/2]

bool utility::tag::XMLSchemaDefinition::include_citation_info ( ) const

Adding citation info requires instantiating classes. If we don't need it (e.g. during Validation) just skip it.

References include_citation_info_.

◆ include_citation_info() [2/2]

void utility::tag::XMLSchemaDefinition::include_citation_info ( bool  setting)

◆ validate_new_top_level_element()

void utility::tag::XMLSchemaDefinition::validate_new_top_level_element ( std::string const &  element_name,
std::string const &  definition 
)
private

Member Data Documentation

◆ elements_in_order_

std::list< std::string > utility::tag::XMLSchemaDefinition::elements_in_order_
private

◆ include_citation_info_

bool utility::tag::XMLSchemaDefinition::include_citation_info_ = true
private

Referenced by include_citation_info().

◆ top_level_elements_

std::map< std::string, std::string > utility::tag::XMLSchemaDefinition::top_level_elements_
private

The documentation for this class was generated from the following files: