LIBSBML_CPP_NAMESPACE_BEGIN


/**
 * Creates a new list of XML namespaces declarations from a "raw" Xerces-C++
 * Attributes set.
 */
XercesNamespaces::XercesNamespaces (const xercesc::Attributes& attrs)
{
  unsigned int size = attrs.getLength();
  mNamespaces.reserve(size);


  for (unsigned int n = 0; n < size; ++n)
  {
    const string            name  = XercesTranscode( attrs.getLocalName(n) );
    const string            qname = XercesTranscode( attrs.getQName    (n) );
    const string            value = XercesTranscode( attrs.getValue    (n) );
    const string::size_type pos   = qname.find(":", 0);

    const string prefix = (pos != string::npos) ? qname.substr(0, pos) : "";

         if (prefix == "xmlns") add( value, name );
    else if (name   == "xmlns") add( value );
  }
}
示例#2
0
XMLNodeAttributeMap::XMLNodeAttributeMap( const xercesc::Attributes &attributes )
{
    for ( size_t i = 0; i < attributes.getLength(); i++ )
    {
        std::string key   = transcodeString( attributes.getLocalName( i ) );
        std::string value = transcodeString( attributes.getValue( i ) );

        m_attributes.insert( std::make_pair( key, value ) );
    }
}