SetContent is called by hzDocXml::Load() once the node content has been established by encountering the anti-tag. Technically, the content of a node is the opening tag, the anti-tag and absoultely everything in-between. That is not how HadronZoo chooses to see it. The content does not include eiher the tag or anti-tag and text content is stipped of leading and trailing whitespace. This unifies the approach between single and multi-line tags. Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hzXmlNode::SetContent | (hzChain&,) |
Declared in file: hzDocument.h
Defined in file : hzDocXml.cpp
Function Logic:
Function body:
void hzXmlNode::SetContent (hzChain& Z)
{
// SetContent is called by hzDocXml::Load() once the node content has been established by encountering the anti-tag. Technically, the content of a node is
// the opening tag, the anti-tag and absoultely everything in-between. That is not how HadronZoo chooses to see it. The content does not include eiher the
// tag or anti-tag and text content is stipped of leading and trailing whitespace. This unifies the approach between single and multi-line tags.
//
// Argument: Z The chain containing the content
//
// Returns: None
_hzfunc("hzXmlNode::SetContent") ;
hzChain X ; // Result chain
chIter zi ; // Input chain iterator
chIter xi ; // Input chain forward iterator
// Strip leading whitespace
// for (zi = Z ; !zi.eof() && *zi <= CHAR_SPACE ; zi++) ;
// Strip leading newlines and tabs from tag content - but not spaces
for (zi = Z ; !zi.eof() && *zi < CHAR_SPACE ; zi++) ;
for (; !zi.eof() ; zi++)
{
if (*zi == CHAR_NL)
{
// Run to end of whitespace
for (xi = zi, xi++ ; !xi.eof() && *xi <&eq; CHAR_SPACE ; xi++) ;
// Terminate if no more non-whitespace chars
if (xi.eof())
break ;
}
X.AddByte(*zi) ;
}
// if (X.Size() > HZSTRING_MAXLEN)
// { m_fixContent.Clear() ; m_tmpContent = X ; }
// else
// { m_tmpContent.Clear() ; m_fixContent = X ; }
m_fixContent = X ;
}