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")); }
TagName NodeName
Definition: TinyDom.h:14
std::vector< NodeName > parent_
Definition: SaxToDom.h:31

◆ ~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_; }
TinyDom dom_
Definition: SaxToDom.h:32

◆ 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 }
std::vector< NodeName > parent_
Definition: SaxToDom.h:31

◆ error()

void SaxToDom::error ( const SAXParseException e)
override

Definition at line 48 of file SaxToDom.cc.

References DMR_cfg::cerr, MillePedeFileConverter_cfg::e, and fetchall_from_DQM_v2::release.

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag().

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 }

◆ 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.

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

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 }
void addEdge(const N &from, const N &to, const E &edge)
Definition: Graph.h:231
TagName NodeName
Definition: TinyDom.h:14
Definition: TagName.h:9
std::map< AttName, AttValue > AttList
Definition: TinyDom.h:17
Definition: value.py:1
TinyDom dom_
Definition: SaxToDom.h:32
std::vector< NodeName > parent_
Definition: SaxToDom.h:31

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.