OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Functions
ossimXmlNode.cpp File Reference
#include <iostream>
#include <ossim/base/ossimXmlNode.h>
#include <ossim/base/ossimXmlAttribute.h>
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/base/ossimNotifyContext.h>
#include <ossim/base/ossimTrace.h>

Go to the source code of this file.

Functions

 RTTI_DEF2 (ossimXmlNode, "ossimXmlNode", ossimObject, ossimErrorStatusInterface)
 
ostream & operator<< (ostream &os, const ossimXmlNode &xml_node)
 
ostream & operator<< (ostream &os, const ossimXmlNode *xml_node)
 

Function Documentation

◆ operator<<() [1/2]

ostream& operator<< ( ostream &  os,
const ossimXmlNode xml_node 
)

Definition at line 672 of file ossimXmlNode.cpp.

673 {
674  return operator <<(os, &xml_node);
675 }
ostream & operator<<(ostream &os, const ossimXmlNode &xml_node)

◆ operator<<() [2/2]

ostream& operator<< ( ostream &  os,
const ossimXmlNode xml_node 
)

Definition at line 680 of file ossimXmlNode.cpp.

References ossimXmlNode::cdataFlag(), ossimXmlNode::theAttributes, ossimXmlNode::theChildNodes, ossimXmlNode::theParentNode, ossimXmlNode::theTag, and ossimXmlNode::theText.

681 {
682  //
683  // Determine the indentation level:
684  //
685  ossimString indent ("");
686  const ossimXmlNode* parent = xml_node->theParentNode;
687  while (parent)
688  {
689  indent += " ";
690  parent = parent->theParentNode;
691  }
692 
693  //
694  // Dump the tag opening:
695  //
696  os << "\n" << indent << "<" << xml_node->theTag;
697 
698  //
699  // Dump any attributes:
700  //
701  if (xml_node->theAttributes.size())
702  {
703  ossimXmlNode::AttributeListType::const_iterator attr =
704  xml_node->theAttributes.begin();
705  while (attr != xml_node->theAttributes.end())
706  {
707  os << attr->get();
708  attr++;
709  }
710  }
711 
712  if((xml_node->theChildNodes.size() == 0)&&
713  (xml_node->theText == ""))
714  {
715  os << "/>";
716  }
717  else
718  {
719  os << ">";
720 
721  if(xml_node->cdataFlag())
722  {
723  os << "<![CDATA[" <<xml_node->theText << "]]>";
724  }
725  else
726  {
727  //
728  // Dump any text:
729  //
730  os << xml_node->theText;
731  }
732  //
733  // Dump any child nodes:
734  //
735  if (xml_node->theChildNodes.size())
736  {
737  ossimXmlNode::ChildListType::const_iterator nodes = xml_node->theChildNodes.begin();
738  while (nodes != xml_node->theChildNodes.end())
739  {
740  os << (*nodes).get();
741  nodes++;
742  }
743  os << "\n" << indent;
744  }
745 
746  //
747  // Dump the tag closing:
748  //
749  os << "</" << xml_node->theTag << ">";
750  }
751 
752  return os;
753 }
ossimXmlNode * theParentNode
Definition: ossimXmlNode.h:119
ossimString theText
Definition: ossimXmlNode.h:122
ossimString theTag
Definition: ossimXmlNode.h:118
vector< ossimRefPtr< ossimXmlAttribute > > theAttributes
Definition: ossimXmlNode.h:121
bool cdataFlag() const
vector< ossimRefPtr< ossimXmlNode > > theChildNodes
Definition: ossimXmlNode.h:120

◆ RTTI_DEF2()

RTTI_DEF2 ( ossimXmlNode  ,
"ossimXmlNode"  ,
ossimObject  ,
ossimErrorStatusInterface   
)