CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

SaxToDom Class Reference

#include <SaxToDom.h>

List of all members.

Public Types

typedef
XERCES_CPP_NAMESPACE::Attributes 
Attributes
typedef
XERCES_CPP_NAMESPACE::SAXParseException 
SAXParseException

Public Member Functions

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

Private Attributes

TinyDom dom_
std::vector< NodeNameparent_

Detailed Description

Definition at line 15 of file SaxToDom.h.


Member Typedef Documentation

typedef XERCES_CPP_NAMESPACE::Attributes SaxToDom::Attributes

Definition at line 18 of file SaxToDom.h.

typedef XERCES_CPP_NAMESPACE::SAXParseException SaxToDom::SAXParseException

Definition at line 19 of file SaxToDom.h.


Constructor & Destructor Documentation

SaxToDom::SaxToDom ( )

Definition at line 13 of file SaxToDom.cc.

{ parent_.push_back(NodeName("TinyDom")); }
SaxToDom::~SaxToDom ( )

Definition at line 16 of file SaxToDom.cc.

{ }

Member Function Documentation

const TinyDom & SaxToDom::dom ( ) const

Definition at line 20 of file SaxToDom.cc.

{
   return dom_;
}
void SaxToDom::endElement ( const XMLCh *const  uri,
const XMLCh *const  name,
const XMLCh *const  qname 
)

Definition at line 50 of file SaxToDom.cc.

{
  parent_.pop_back();
}
void SaxToDom::error ( const SAXParseException e)

Definition at line 58 of file SaxToDom.cc.

References benchmark_cfg::cerr.

{
    cerr << "\nError at file " << StrX(e.getSystemId())
                 << ", line " << e.getLineNumber()
                 << ", char " << e.getColumnNumber()
         << "\n  Message: " << StrX(e.getMessage()) << endl;
}
void SaxToDom::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes attrs 
)

Definition at line 26 of file SaxToDom.cc.

References i, StrX::localForm(), and relativeConstraints::value.

{
  StrX strx(name); // element-name
  NodeName nm(string(strx.localForm())); // as a temp.string
  //parent_.push_back(nm);
  AttList al; // map of attributes -> values
  for (unsigned int i = 0; i < atts.getLength(); ++i) {
    const XMLCh* aname = atts.getLocalName(i);
    const XMLCh* value = atts.getValue(i);
    // fill the tiny-dom-attribute-list (i.e. the map)
    al[NodeName((StrX(aname).localForm()))]=NodeName(StrX(value).localForm());
    //cout << "  att=" << StrX(aname) << " val=" << StrX(value) << endl;
  }  
  // add the new element to the dom-tree
  dom_.addEdge(parent_.back(), nm , al);
  //cout << "add from=" << parent_.back().str() << " to=" << nm.str() << endl;
  // set the parent_ to the actual node
  parent_.push_back(nm);
}

Member Data Documentation

Definition at line 34 of file SaxToDom.h.

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

Definition at line 33 of file SaxToDom.h.