Export the combined value of this node to the supplied chain. Please note this is a recursive process so the chain is not cleared. Note also the caller must provide a reference to a 32-bit unsigned value for tracking the relative line number. This number should be set to the line number of the original node. This will incorporate the node name and attributes, the direct content of the node including subtags. This function was introduced for the purpose of establishing an MD5 value for the node. This is used in large XML config files in which many resources are configured, to determine which resources have changed and so need to be reloaded. Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hzXmlNode::Export_r | (hzDocXml*,hzChain&,uint32_t&,) |
Declared in file: hzDocument.h
Defined in file : hzDocXml.cpp
Function Logic:
Function body:
void hzXmlNode::Export_r (hzDocXml* pDoc)hzChain& Z, uint32_t& relLine,
{
// Export the combined value of this node to the supplied chain. Please note this is a recursive process so the chain is not cleared. Note also the caller
// must provide a reference to a 32-bit unsigned value for tracking the relative line number. This number should be set to the line number of the original
// node.
//
// This will incorporate the node name and attributes, the direct content of the node including subtags.
//
// This function was introduced for the purpose of establishing an MD5 value for the node. This is used in large XML config files in which many resources
// are configured, to determine which resources have changed and so need to be reloaded.
//
// Arguments: 1) val The chain populated with this node's combined value
// 2) relLine Relative line number
//
// Returns: None
_hzfunc("hzXmlNode::Export_r") ;
hzAttrset ai ; // Attribute iterator
hzXmlNode* pSub ; // Subnodes
const char* anam ; // Attribute name
const char* aval ; // Attribute value
uint32_t n ; // Level iterator
hzEcode rc = E_OK ; // Return code
if (!pDoc)
hzexit(E_CORRUPT, "No host document supplied") ;
// Write out the opening of the tag
if (m_nLine > relLine)
{
Z.AddByte(CHAR_NL) ;
for (n = m_nCol ; n >&eq; 4; n -= 4)
Z.AddByte(CHAR_TAB) ;
relLine = m_nLine ;
}
// name = pDoc->Xlate(m_snName) ;
// Z.Printf("<%s", name) ;
Z.Printf("<%s", *m_Name) ;
for (ai = this ; ai.Valid() ; ai.Advance())
{
anam = ai.Name() ; aval = ai.Value() ;
Z.Printf(" %s=\"%s\"", anam, aval) ;
}
// if (!m_Children && !m_tmpContent.Size() && !m_fixContent)
if (!m_Children && !m_fixContent)
{
Z << "/>" ;
return ;
}
Z << ">" ;
// Visit child nodes if any
if (m_Children)
{
for (pSub = GetFirstChild() ; rc == E_OK && pSub ; pSub = pSub->Sibling())
{
Z << pSub->txtPtxt() ;
pSub->Export_r(pDoc, Z, relLine) ;
}
}
// Then do content
// if (m_tmpContent.Size() || m_fixContent)
if (m_fixContent)
{
if (m_nAnti > m_nLine)
{
Z.AddByte(CHAR_NL) ;
for (n = m_nCol ; n > 4; n -= 4)
Z.AddByte(CHAR_TAB) ;
relLine = m_nAnti ;
}
// if (m_tmpContent.Size())
// Z << m_tmpContent ;
// else
Z << m_fixContent ;
}
// Write out the closing of the tag
if (m_nAnti > m_nLine)
{
Z.AddByte(CHAR_NL) ;
for (n = m_nCol ; n >&eq; 4; n -= 4)
Z.AddByte(CHAR_TAB) ;
relLine = m_nAnti ;
}
Z.Printf("</%s>", *m_Name) ;
}