-void gdcmElementSet::Print(std::ostream & os) {
- for (TagDocEntryHT::iterator i = tagHT.begin(); i != tagHT.end(); ++i)
- {
- //(i)->second->SetPrintLevel(printLevel);
- (i->second)->Print(os);
+void ElementSet::WriteContent(std::ofstream *fp, FileType filetype)
+{
+ for (TagDocEntryHT::const_iterator i = TagHT.begin();
+ i != TagHT.end();
+ ++i)
+ {
+ // FIXME : find a trick to know if current object is a
+ // gdcm::File or a gdcm::Document
+ //if ( dynamic_cast< File* > ( this ) ) { // ignore illegal groups }
+
+ // Skip 'Group Length' element, since it may be wrong.
+ // except for Group 0002
+ if ( (i->second)->GetElement() == 0x0000
+ && (i->second)->GetElement() != 0x0002 )
+ continue;
+
+ i->second->WriteContent(fp, filetype);