Exemple #1
0
// Inherits XMLSpy generation source function.
bool CNode::InternalNamesMatch(xmlNodePtr pNode, const tstring& sNamespaceURI, const tstring& sName)
{
	const xmlChar* sNodeURI = X("");
	const xmlChar* sNodeName = X("");
	if(pNode->ns && pNode->ns->href)
		sNodeURI = pNode->ns->href;
	if(pNode->name)
		sNodeName = pNode->name;
	return sNamespaceURI.compare(XC2TS(sNodeURI)) == 0 && sName.compare(XC2TS(sNodeName)) == 0;
}
Exemple #2
0
tstring CDoc::SaveToString(CNode& rNode, bool bQualified, bool bPrettyPrint)
{
	if (rNode.m_pDOMNode->getParentNode() == NULL || rNode.m_pDOMNode->getParentNode()->getNodeType() == xercesc::DOMNode::DOCUMENT_FRAGMENT_NODE)
	{
		FinalizeRootElement(rNode);
	}

	CNode::InternalAdjustPrefix(rNode.m_pDOMNode, bQualified);
	rNode.AdjustPrefix();

	xercesc::DOMWriter* pWriter = GetWriter();
	m_bWriter = true;

	if (!m_sEncoding.empty())
		pWriter->setEncoding(X(m_sEncoding));

	if (bPrettyPrint &&
	    pWriter->canSetFeature(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, true))
		pWriter->setFeature(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, true);

	XMLCh* szXml = pWriter->writeToString(*(rNode.m_pDOMNode->getOwnerDocument()));
	tstring sXml = XC2TS( szXml );
	xercesc::XMLString::release( &szXml );
	return sXml;
}
Exemple #3
0
// Inherits XMLSpy generation source function.
tstring CNode::InternalGetNodeValue(ENodeType eNodeType, xmlNodePtr pNode)
{
	if (pNode == NULL)
		return _T("");

	xmlChar* szContent = NULL;
	if (eNodeType == Element) {
		if(pNode->children && pNode->children->type == XML_TEXT_NODE)
			szContent = xmlNodeGetContent(pNode->children);
	} else {
		szContent = xmlNodeGetContent(pNode);
	}

	tstring sContent;
	if(szContent) {
		sContent = XC2TS(szContent);
		xmlFree(szContent);
	}
	return sContent;
}
Exemple #4
0
bool CDoc::InternalErrorHandler::handleError(const xercesc::DOMError& domError)
{
	m_sErrors += XC2TS(domError.getMessage());
	m_sErrors += _T("\n");
	return true; // continue
}