CMS 3D CMS Logo

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

#include <SaxToDom2.h>

Inheritance diagram for SaxToDom2:

Public Types

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

Public Member Functions

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

Private Attributes

TinyDom2 dom_
 
std::vector< Node2parent_
 

Detailed Description

Definition at line 19 of file SaxToDom2.h.

Member Typedef Documentation

◆ Attributes

using SaxToDom2::Attributes = XERCES_CPP_NAMESPACE::Attributes

Definition at line 21 of file SaxToDom2.h.

◆ SAXParseException

using SaxToDom2::SAXParseException = XERCES_CPP_NAMESPACE::SAXParseException

Definition at line 22 of file SaxToDom2.h.

Constructor & Destructor Documentation

◆ SaxToDom2()

XERCES_CPP_NAMESPACE_USE SaxToDom2::SaxToDom2 ( )

Definition at line 13 of file SaxToDom2.cc.

13  {
14  AttList2 al;
15  al[TagName("name")] = TagName("myTinyDomTest");
16  Node2 nm(TagName("TinyDom2"), al);
17  parent_.emplace_back(nm);
18 }
Definition: TagName.h:9
std::map< TagName, TagName > AttList2
Definition: TinyDom2.h:15
std::pair< TagName, AttList2 > Node2
Definition: TinyDom2.h:16
std::vector< Node2 > parent_
Definition: SaxToDom2.h:33

◆ ~SaxToDom2()

SaxToDom2::~SaxToDom2 ( )
override

Definition at line 20 of file SaxToDom2.cc.

20 {}

Member Function Documentation

◆ dom()

const TinyDom2 & SaxToDom2::dom ( ) const

Definition at line 22 of file SaxToDom2.cc.

22 { return dom_; }
TinyDom2 dom_
Definition: SaxToDom2.h:34

◆ endElement()

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

Definition at line 48 of file SaxToDom2.cc.

48  {
49  parent_.pop_back();
50 }
std::vector< Node2 > parent_
Definition: SaxToDom2.h:33

◆ error()

void SaxToDom2::error ( const SAXParseException e)
override

Definition at line 53 of file SaxToDom2.cc.

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

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag().

53  {
54  char* id = XMLString::transcode(e.getSystemId());
55  char* message = XMLString::transcode(e.getMessage());
56  cerr << "\nError at file " << id << ", line " << e.getLineNumber() << ", char " << e.getColumnNumber()
57  << "\n Message: " << message << endl;
58  XMLString::release(&id);
59  XMLString::release(&message);
60 }

◆ startElement()

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

Definition at line 24 of file SaxToDom2.cc.

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

27  {
28  char* strx = XMLString::transcode(name); // element-name
29  AttList2 al;
30 
31  for (unsigned int i = 0; i < atts.getLength(); ++i) {
32  char* aname = XMLString::transcode(atts.getLocalName(i));
33  char* value = XMLString::transcode(atts.getValue(i));
34  al[TagName(aname)] = TagName(value);
35  XMLString::release(&aname);
37  }
38 
39  // add the new element to the dom-tree
40  Node2 nm(TagName(strx), al);
41  Node2 par = parent_.back();
42  dom_.addEdge(par, nm, AnotherDummy2());
43 
44  parent_.emplace_back(nm);
45  XMLString::release(&strx);
46 }
void addEdge(const N &from, const N &to, const E &edge)
Definition: Graph.h:231
Definition: TagName.h:9
std::map< TagName, TagName > AttList2
Definition: TinyDom2.h:15
Definition: value.py:1
std::pair< TagName, AttList2 > Node2
Definition: TinyDom2.h:16
TinyDom2 dom_
Definition: SaxToDom2.h:34
std::vector< Node2 > parent_
Definition: SaxToDom2.h:33

Member Data Documentation

◆ dom_

TinyDom2 SaxToDom2::dom_
private

Definition at line 34 of file SaxToDom2.h.

◆ parent_

std::vector<Node2> SaxToDom2::parent_
private

Definition at line 33 of file SaxToDom2.h.