Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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...
 
std::string human_readable_summary (std::string const &component_name="", std::string const &component_type="") 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

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

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

Member Function Documentation

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

Returns the full XML schema definition, in XML format.

References elements_in_order_, test.T008_Serialization::oss, and top_level_elements_.

Referenced by human_readable_summary().

bool utility::tag::XMLSchemaDefinition::has_top_level_element ( std::string const &  element_name) const
std::string utility::tag::XMLSchemaDefinition::human_readable_summary ( std::string const &  component_name = "",
std::string const &  component_type = "" 
) 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().

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

Member Data Documentation

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

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