CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
SaxToDom Class Reference

#include <SaxToDom.h>

Inheritance diagram for SaxToDom:

Public Types

using Attributes = XERCES_CPP_NAMESPACE::Attributes
 
using SAXParseException = XERCES_CPP_NAMESPACE::SAXParseException
 

Public Member Functions

const TinyDomdom () const
 
void endElement (const XMLCh *uri, const XMLCh *name, const XMLCh *qname) override
 
void error (const SAXParseException &e) override
 
 SaxToDom ()
 
void startElement (const XMLCh *uri, const XMLCh *localname, const XMLCh *qname, const Attributes &attrs) override
 
 ~SaxToDom () override
 

Private Attributes

TinyDom dom_
 
std::vector< NodeNameparent_
 

Detailed Description

Definition at line 17 of file SaxToDom.h.

Member Typedef Documentation

◆ Attributes

using SaxToDom::Attributes = XERCES_CPP_NAMESPACE::Attributes

Definition at line 19 of file SaxToDom.h.

◆ SAXParseException

using SaxToDom::SAXParseException = XERCES_CPP_NAMESPACE::SAXParseException

Definition at line 20 of file SaxToDom.h.

Constructor & Destructor Documentation

◆ SaxToDom()

XERCES_CPP_NAMESPACE_USE SaxToDom::SaxToDom ( )

Definition at line 12 of file SaxToDom.cc.

12 { parent_.emplace_back(NodeName("TinyDom")); }

◆ ~SaxToDom()

SaxToDom::~SaxToDom ( )
override

Definition at line 14 of file SaxToDom.cc.

14 {}

Member Function Documentation

◆ dom()

const TinyDom & SaxToDom::dom ( ) const

Definition at line 16 of file SaxToDom.cc.

16 { return dom_; }

◆ endElement()

void SaxToDom::endElement ( const XMLCh *  uri,
const XMLCh *  name,
const XMLCh *  qname 
)
override

Definition at line 43 of file SaxToDom.cc.

43  {
44  parent_.pop_back();
45 }

◆ error()

void SaxToDom::error ( const SAXParseException e)
override

Definition at line 48 of file SaxToDom.cc.

48  {
49  char* id = XMLString::transcode(e.getSystemId());
50  char* message = XMLString::transcode(e.getMessage());
51  cerr << "\nError at file " << id << ", line " << e.getLineNumber() << ", char " << e.getColumnNumber()
52  << "\n Message: " << message << endl;
53  XMLString::release(&id);
54  XMLString::release(&message);
55 }

References beam_dqm_sourceclient-live_cfg::cerr, MillePedeFileConverter_cfg::e, and fetchall_from_DQM_v2::release.

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag().

◆ startElement()

void SaxToDom::startElement ( const XMLCh *  uri,
const XMLCh *  localname,
const XMLCh *  qname,
const Attributes attrs 
)
override

Definition at line 18 of file SaxToDom.cc.

21  {
22  char* strx = XMLString::transcode(name); // element-name
23  NodeName nm(strx); // as a temp.string
24 
25  AttList al; // map of attributes -> values
26  for (unsigned int i = 0; i < atts.getLength(); ++i) {
27  char* aname = XMLString::transcode(atts.getLocalName(i));
28  char* value = XMLString::transcode(atts.getValue(i));
29  // fill the tiny-dom-attribute-list (i.e. the map)
30  al[NodeName(aname)] = NodeName(value);
31 
32  XMLString::release(&aname);
34  }
35  // add the new element to the dom-tree
36  dom_.addEdge(parent_.back(), nm, al);
37 
38  // set the parent_ to the actual node
39  parent_.emplace_back(nm);
40  XMLString::release(&strx);
41 }

References mps_fire::i, Skims_PA_cff::name, and fetchall_from_DQM_v2::release.

Member Data Documentation

◆ dom_

TinyDom SaxToDom::dom_
private

Definition at line 32 of file SaxToDom.h.

◆ parent_

std::vector<NodeName> SaxToDom::parent_
private

Definition at line 31 of file SaxToDom.h.

TagName
Definition: TagName.h:9
SaxToDom::dom_
TinyDom dom_
Definition: SaxToDom.h:32
mps_fire.i
i
Definition: mps_fire.py:355
AttList
std::map< AttName, AttValue > AttList
Definition: TinyDom.h:17
SaxToDom::parent_
std::vector< NodeName > parent_
Definition: SaxToDom.h:31
math::Graph::addEdge
void addEdge(const N &from, const N &to, const E &edge)
Definition: Graph.h:231
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
value
Definition: value.py:1
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
NodeName
TagName NodeName
Definition: TinyDom.h:14