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

using SaxToDom::Attributes = XERCES_CPP_NAMESPACE::Attributes

Definition at line 20 of file SaxToDom.h.

using SaxToDom::SAXParseException = XERCES_CPP_NAMESPACE::SAXParseException

Definition at line 21 of file SaxToDom.h.

Constructor & Destructor Documentation

XERCES_CPP_NAMESPACE_USE SaxToDom::SaxToDom ( )

Definition at line 12 of file SaxToDom.cc.

13 { parent_.emplace_back(NodeName("TinyDom")); }
TagName NodeName
Definition: TinyDom.h:14
std::vector< NodeName > parent_
Definition: SaxToDom.h:34
SaxToDom::~SaxToDom ( )
override

Definition at line 15 of file SaxToDom.cc.

16 { }

Member Function Documentation

const TinyDom & SaxToDom::dom ( ) const

Definition at line 18 of file SaxToDom.cc.

19 {
20  return dom_;
21 }
TinyDom dom_
Definition: SaxToDom.h:35
void SaxToDom::endElement ( const XMLCh *  uri,
const XMLCh *  name,
const XMLCh *  qname 
)
override

Definition at line 49 of file SaxToDom.cc.

52 {
53  parent_.pop_back();
54 }
std::vector< NodeName > parent_
Definition: SaxToDom.h:34
void SaxToDom::error ( const SAXParseException e)
override

Definition at line 57 of file SaxToDom.cc.

References MessageLogger_cfi::cerr, and fetchall_from_DQM_v2::release.

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag().

58 {
59  char* id = XMLString::transcode(e.getSystemId());
60  char* message = XMLString::transcode(e.getMessage());
61  cerr << "\nError at file " << id
62  << ", line " << e.getLineNumber()
63  << ", char " << e.getColumnNumber()
64  << "\n Message: " << message << endl;
65  XMLString::release(&id);
66  XMLString::release(&message);
67 }
void SaxToDom::startElement ( const XMLCh *  uri,
const XMLCh *  localname,
const XMLCh *  qname,
const Attributes attrs 
)
override

Definition at line 23 of file SaxToDom.cc.

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

27 {
28  char * strx = XMLString::transcode(name); // element-name
29  NodeName nm(strx); // as a temp.string
30 
31  AttList al; // map of attributes -> values
32  for (unsigned int i = 0; i < atts.getLength(); ++i) {
33  char* aname = XMLString::transcode(atts.getLocalName(i));
34  char* value = XMLString::transcode(atts.getValue(i));
35  // fill the tiny-dom-attribute-list (i.e. the map)
36  al[NodeName(aname)]=NodeName(value);
37 
38  XMLString::release(&aname);
39  XMLString::release(&value);
40  }
41  // add the new element to the dom-tree
42  dom_.addEdge(parent_.back(), nm , al);
43 
44  // set the parent_ to the actual node
45  parent_.emplace_back(nm);
46  XMLString::release(&strx);
47 }
std::map< AttName, AttValue > AttList
Definition: TinyDom.h:17
void addEdge(const N &from, const N &to, const E &edge)
Definition: Graph.h:261
TagName NodeName
Definition: TinyDom.h:14
Definition: TagName.h:9
Definition: value.py:1
TinyDom dom_
Definition: SaxToDom.h:35
std::vector< NodeName > parent_
Definition: SaxToDom.h:34

Member Data Documentation

TinyDom SaxToDom::dom_
private

Definition at line 35 of file SaxToDom.h.

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

Definition at line 34 of file SaxToDom.h.