void sosicon::ConverterSosiStat:: printElementData( ISosiElement* e, sosi::SosiElementSearch src, int padding ) { while( e->getChild( src ) ) { ISosiElement* child = src.element(); if( !child->getData().empty() ) { std::string label = child->getName(); label.resize( padding, '.' ); std::cout << " " << label << ": " << child->getData() << "\n"; } } }
void sosicon::ConverterSosi2psql:: extractData( ISosiElement* parent, FieldsList& hdr, std::map<std::string,std::string>*& row ) { sosi::SosiElementSearch srcData; while( parent->getChild( srcData ) ) { ISosiElement* dataElement = srcData.element(); extractData( dataElement, hdr, row ); std::string fieldName = utils::toFieldname( dataElement->getName() ); std::string data = dataElement->getData(); if( data.empty() ) { continue; } if( hdr.find( fieldName ) == hdr.end() ) { hdr[ fieldName ] = Field( data ); } else { hdr[ fieldName ].expand( data ); } if( row ) { ( *row )[ fieldName ] = data; } } }
void sosicon::shape::Shapefile:: extractDbfFields( ISosiElement* sosi, DbfRecord& rec ) { std::string field; std::string data; ISosiElement* child = 0; sosi::SosiElementSearch src; while( sosi->getChild( src ) ) { child = src.element(); if( child->getType() != sosi::sosi_element_ne ) { data = utils::trim( child->getData() ); saveToDbf( rec, child->getName(), data ); extractDbfFields( child, rec ); } } }