当前位置: 首页>>代码示例>>C++>>正文


C++ DOMElement::getNextSibling方法代码示例

本文整理汇总了C++中DOMElement::getNextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::getNextSibling方法的具体用法?C++ DOMElement::getNextSibling怎么用?C++ DOMElement::getNextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOMElement的用法示例。


在下文中一共展示了DOMElement::getNextSibling方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getGeometryTypeOfElem

void ILI2Reader::SetFieldValues(OGRFeature *feature, DOMElement* elem) {
  int type = 0;
  //recursively search children
  for (DOMElement *childElem = (DOMElement *)elem->getFirstChild();
        type == 0 && childElem && childElem->getNodeType() == DOMNode::ELEMENT_NODE;
        childElem = (DOMElement*)childElem->getNextSibling()) {
    type = getGeometryTypeOfElem(childElem);
    if (type == 0) {
      if (childElem->getFirstChild() && childElem->getFirstChild()->getNodeType() == DOMNode::ELEMENT_NODE) {
        SetFieldValues(feature, childElem);
      } else {
        char *fName = fieldName(childElem);
        int fIndex = feature->GetFieldIndex(fName);
        if (fIndex != -1) {
          char * objVal = getObjValue(childElem);
          if (objVal == NULL)
            objVal = getREFValue(childElem); // only to try
          feature->SetField(fIndex, objVal);
          CPLFree(objVal);
        } else {
          CPLDebug( "OGR_ILI","Attribute '%s' not found", fName);
          m_missAttrs.push_back(fName);
        }
        CPLFree(fName);
      }
    } else {
      feature->SetGeometryDirectly(getGeometry(childElem, type));
    }
  }
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:30,代码来源:ili2reader.cpp

示例2: LoadDualityCalculate

ret_ CXMLLoaderActions::LoadDualityCalculate(CProgram &Program,
											 const DOMElement *pElement,
											 const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	//
	auto_xerces_str wsOperator	("operator");
	auto_xerces_str	sOperator	(pElement->getAttribute(wsOperator));

	EDualityCalculate Calculate;

	if (SUCCESS != GetDualityOperator(sOperator, Calculate))
		return XML_LOADER_ERROR;

	//
	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	CAutoPtr<CVariable> OV[3];
	size_ n = 0;

	while (pSub)
	{
		ret_ Ret = LoadVariable(Program.Data(), pSub, OV[n].Ptr(), pPDU);

		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			if (3 <= ++n)
				break;

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	COptDualityCalculate *pODC = new COptDualityCalculate(
		OV[0].Ptr(),
		Calculate,
		OV[1].Ptr(),
		OV[2].Ptr());

	if (false_v == Program.AddOperator(pODC))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:52,代码来源:CXMLLoaderActions.cpp

示例3: LoadAddItem

ret_ CXMLLoaderActions::LoadAddItem(CProgram &Program,
									const DOMElement *pElement,
									const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	auto_xerces_str wsName("name");
	auto_xerces_str sName(pElement->getAttribute(wsName));
	
	// Check if there is the container
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	// Check if there is the table identified by the attribute
	CWindow *pWindow = m_pTmpContainer->GetChild(sName);

	if (!pWindow || WINDOW_TABLE != pWindow->Type())
		return XML_LOADER_ERROR;

	COptAddItem *pOpt = new COptAddItem(sName);

	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	while (pSub)
	{
		CVariable *pV = null_v;
		ret_ Ret = LoadVariable(Program.Data(),
								pSub,
								pV,
								pPDU);

		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			pOpt->AddVariable(pV);
		
		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:51,代码来源:CXMLLoaderActions.cpp

示例4: OGRPolygon

OGRPolygon *getPolygon(DOMElement *elem) {
  OGRPolygon *pg = new OGRPolygon();

  DOMElement *boundaryElem = (DOMElement *)elem->getFirstChild(); // outer boundary
  while (boundaryElem != NULL) {
    char* pszTagName = XMLString::transcode(boundaryElem->getTagName());
    if (cmpStr(ILI2_BOUNDARY, pszTagName) == 0)
      pg->addRingDirectly(getBoundary(boundaryElem));
    XMLString::release(&pszTagName);
    boundaryElem = (DOMElement *)boundaryElem->getNextSibling(); // inner boundaries
  }

  return pg;
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:14,代码来源:ili2reader.cpp

示例5: LoadProgram

ret_ CXMLLoaderActions::LoadProgram(const CData *pParentData,
									CProgram &Program,
									const DOMElement *pElement,
									const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pParentData)
		return PARAMETER_NULL | PARAMETER_1;

	if (!pElement)
		return PARAMETER_NULL | PARAMETER_3;
#endif

	auto_xerces_str wsDataBlock("data_block");
	auto_xerces_str wsProcessBlock("process_block");

	DOMElement *pChild = (DOMElement *)pElement->getFirstChild();

	if (!pChild)
		return XML_LOADER_ERROR;

	Program.Data().SetParent(pParentData);

	while (pChild)
	{
		if (0 == XMLString::compareString(pChild->getNodeName(),
										  wsDataBlock))
		{
			CData Data;

			if (SUCCESS != (LoadDataBlock(Data,  pChild)))
				return XML_LOADER_ERROR;

			Program.SetData(Data);
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsProcessBlock))
		{
			if (SUCCESS != LoadProcessBlock(Program, pChild, pPDU))
				return XML_LOADER_ERROR;
		}

		pChild = (DOMElement *)pChild->getNextSibling();
	}

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:47,代码来源:CXMLLoaderActions.cpp

示例6: LoadReadFile

ret_ CXMLLoaderActions::LoadReadFile(CProgram &Program,
									 const DOMElement *pElement,
									 const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	CAutoPtr<CVariable> OV[3];
	size_ n = 0;

	while (pSub)
	{
		ret_ Ret = LoadVariable(Program.Data(), pSub, OV[n].Ptr(), pPDU);

		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			if (3 <= ++n)
				break;

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (n != 3)
		return XML_LOADER_ERROR;

	COptReadFile *pOperator = new COptReadFile(OV[0].Ptr(),
											   OV[1].Ptr(),
											   OV[2].Ptr());

	if (false_v == Program.AddOperator(pOperator))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:43,代码来源:CXMLLoaderActions.cpp

示例7: if

OGRCircularString *ILI2Reader::getArc(DOMElement *elem) {
  // elem -> ARC
  OGRCircularString *arc = new OGRCircularString();
  // previous point -> start point
  OGRPoint *ptStart = getPoint((DOMElement *)elem->getPreviousSibling()); // COORD or ARC
  // end point
  OGRPoint *ptEnd = new OGRPoint();
  // point on the arc
  OGRPoint *ptOnArc = new OGRPoint();
  // double radius = 0; // radius

  DOMElement *arcElem = (DOMElement *)elem->getFirstChild();
  while (arcElem != NULL) {
    char* pszTagName = XMLString::transcode(arcElem->getTagName());
    char* pszObjValue = getObjValue(arcElem);
    if (cmpStr("C1", pszTagName) == 0)
      ptEnd->setX(CPLAtof(pszObjValue));
    else if (cmpStr("C2", pszTagName) == 0)
      ptEnd->setY(CPLAtof(pszObjValue));
    else if (cmpStr("C3", pszTagName) == 0)
      ptEnd->setZ(CPLAtof(pszObjValue));
    else if (cmpStr("A1", pszTagName) == 0)
      ptOnArc->setX(CPLAtof(pszObjValue));
    else if (cmpStr("A2", pszTagName) == 0)
      ptOnArc->setY(CPLAtof(pszObjValue));
    else if (cmpStr("A3", pszTagName) == 0)
      ptOnArc->setZ(CPLAtof(pszObjValue));
    else if (cmpStr("R", pszTagName) == 0) {
      // radius = CPLAtof(pszObjValue);
    }
    CPLFree(pszObjValue);
    XMLString::release(&pszTagName);
    arcElem = (DOMElement *)arcElem->getNextSibling();
  }
  arc->addPoint(ptStart);
  arc->addPoint(ptOnArc);
  arc->addPoint(ptEnd);
  delete ptStart;
  delete ptOnArc;
  delete ptEnd;
  return arc;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:42,代码来源:ili2reader.cpp

示例8: if

OGRLineString *ILI2Reader::getArc(DOMElement *elem) {
  // elem -> ARC
  OGRLineString *ls = new OGRLineString();
  // previous point -> start point
  OGRPoint *ptStart = getPoint((DOMElement *)elem->getPreviousSibling()); // COORD or ARC
  // end point
  OGRPoint *ptEnd = new OGRPoint();
  // point on the arc
  OGRPoint *ptOnArc = new OGRPoint();
  double radius = 0; // radius

  DOMElement *arcElem = (DOMElement *)elem->getFirstChild();
  while (arcElem != NULL) {
    char* pszTagName = XMLString::transcode(arcElem->getTagName());
    char* pszObjValue = getObjValue(arcElem);
    if (cmpStr("C1", pszTagName) == 0)
      ptEnd->setX(atof(pszObjValue));
    else if (cmpStr("C2", pszTagName) == 0)
      ptEnd->setY(atof(pszObjValue));
    else if (cmpStr("C3", pszTagName) == 0)
      ptEnd->setZ(atof(pszObjValue));
    else if (cmpStr("A1", pszTagName) == 0)
      ptOnArc->setX(atof(pszObjValue));
    else if (cmpStr("A2", pszTagName) == 0)
      ptOnArc->setY(atof(pszObjValue));
    else if (cmpStr("A3", pszTagName) == 0)
      ptOnArc->setZ(atof(pszObjValue));
    else if (cmpStr("R", pszTagName) == 0)
      radius = atof(pszObjValue);
    CPLFree(pszObjValue);
    XMLString::release(&pszTagName);
    arcElem = (DOMElement *)arcElem->getNextSibling();
  }
  ptEnd->flattenTo2D();
  ptOnArc->flattenTo2D();
  interpolateArc(ls, ptStart, ptOnArc, ptEnd, arcIncr);
  delete ptStart;
  delete ptOnArc;
  delete ptEnd;
  return ls;
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:41,代码来源:ili2reader.cpp

示例9: oFieldDefn

void ILI2Reader::setFieldDefn(OGRFeatureDefn *featureDef, DOMElement* elem) {
  int type = 0;
  //recursively search children
  for (DOMElement *childElem = (DOMElement *)elem->getFirstChild();
        type == 0 && childElem && childElem->getNodeType() == DOMNode::ELEMENT_NODE;
        childElem = (DOMElement*)childElem->getNextSibling()) {
    type = getGeometryTypeOfElem(childElem);
    if (type == 0) {
      if (childElem->getFirstChild() && childElem->getFirstChild()->getNodeType() == DOMNode::ELEMENT_NODE) {
        setFieldDefn(featureDef, childElem);
      } else {
        char *fName = fieldName(childElem);
        if (featureDef->GetFieldIndex(fName) == -1) {
          CPLDebug( "OGR_ILI", "AddFieldDefn: %s",fName );
          OGRFieldDefn oFieldDefn(fName, OFTString);
          featureDef->AddFieldDefn(&oFieldDefn);
        }
        CPLFree(fName);
      }
    }
  }
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:22,代码来源:ili2reader.cpp

示例10: LoadEmpty

ret_ CXMLLoaderActions::LoadEmpty(CProgram &Program,
								  const DOMElement *pElement, 
								  const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	//
	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	CAutoPtr<CVariable> OV;

	while (pSub)
	{
		ret_ Ret = LoadVariable(Program.Data(), pSub, OV.Ptr(), pPDU);
		
		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			break;

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	COptEmpty *pOperator = new COptEmpty(OV.Ptr());

	if (false_v == Program.AddOperator(pOperator))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:37,代码来源:CXMLLoaderActions.cpp

示例11: LoadIf

ret_ CXMLLoaderActions::LoadIf(CProgram &Program,
							   const DOMElement *pElement,
							   const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_3);
#endif

	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	auto_xerces_str wsDataBlock			("data_block");
	auto_xerces_str wsExpressionUnitary	("expression_unitary");
	auto_xerces_str wsExpressionDuality	("expression_duality");
	auto_xerces_str wsConditionUnitary	("condition_unitary");
	auto_xerces_str wsConditionDuality	("condition_duality");
	auto_xerces_str wsProgram			("program");

	CProgramIf *pPI = new CProgramIf();

	pPI->Data().SetParent(&Program.Data());
	
	while (pSub)
	{
		if (0 == XMLString::compareString(pSub->getNodeName(),
										  wsDataBlock))
		{
			CData Data;

			if (SUCCESS != (LoadDataBlock(Data, pSub)))
				return XML_LOADER_ERROR;

			pPI->SetData(Data);
		}
		else if (0 == XMLString::compareString(pSub->getNodeName(),
											   wsExpressionUnitary)
				 || 0 == XMLString::compareString(pSub->getNodeName(),
												  wsExpressionDuality)
				 || 0 == XMLString::compareString(pSub->getNodeName(),
												  wsConditionUnitary)
				 || 0 == XMLString::compareString(pSub->getNodeName(),
												  wsConditionDuality))
		{
			CExpression *pExpression = null_v;

			if (SUCCESS != LoadExpression(pPI->Data(),
										  pSub,
										  pExpression,
										  pPDU))
			{
				return XML_LOADER_ERROR;
			}

			if (false_v == pPI->AddExpression(pExpression))
				return XML_LOADER_ERROR;
		}
		else if (0 == XMLString::compareString(pSub->getNodeName(),
											   wsProgram))
		{
			CProgram *pProgram = new CProgram();

			if (SUCCESS != LoadProgram(&pPI->Data(),
									   *pProgram,
									   pSub,
									   pPDU))
			{
				return XML_LOADER_ERROR;
			}

			if (false_v == pPI->AddOperator(pProgram))
				return XML_LOADER_ERROR;
		}

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (false_v == Program.AddOperator(pPI))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:84,代码来源:CXMLLoaderActions.cpp

示例12: LoadConfigGroup

ret_ CXMLLoaderActions::LoadConfigGroup(CProgram &Program,
										const DOMElement *pElement,
										const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	//
	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	CAutoPtr<CVariable> OV[2];
	size_ n = 0;

	while (pSub)
	{
		if (0 == XMLString::compareString(pSub->getNodeName(),
										  m_wsGroupVariable))
		{
			if (SUCCESS != LoadGroupVariable(Program.Data(),
											 pElement,
											 OV[0].Ptr()))
			{
				return XML_LOADER_ERROR;
			}

			n++;
			break;
		}

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	pSub = (DOMElement *)pSub->getNextSibling();

	while (pSub)
	{
		if (0 == XMLString::compareString(pSub->getNodeName(),
										  m_wsSolidVariable))
		{
			if (SUCCESS != LoadSolidVariable(Program.Data(), 
											 pElement, 
											 OV[1].Ptr()))
			{
				return XML_LOADER_ERROR;
			}

			n++;
			break;
		}

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (2 != n)
		return XML_LOADER_ERROR;

	COptConfigGroup *pOperator = new COptConfigGroup(OV[0].Ptr(), OV[1].Ptr());

	if (false_v == Program.AddOperator(pOperator))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:68,代码来源:CXMLLoaderActions.cpp

示例13: LoadWhile

ret_ CXMLLoaderActions::LoadWhile(CProgram &Program,
								  const DOMElement *pElement,
								  const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_3);
#endif

	auto_xerces_str	wsPosition	("position");
	auto_xerces_str	sPosition	(pElement->getAttribute(wsPosition));
	bool_			b = true_v;

	if (0 == strcmp(sPosition, "head"))
		b = true_v;
	else if (0 == strcmp(sPosition, "foot"))
		b = false_v;

	//
	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	auto_xerces_str wsDataBlock			("data_block");
	auto_xerces_str wsExpressionUnitary	("expression_unitary");
	auto_xerces_str wsExpressionDuality	("expression_duality");
	auto_xerces_str wsConditionUnitary	("condition_unitary");
	auto_xerces_str wsConditionDuality	("condition_duality");
	auto_xerces_str wsProcessBlock		("process_block");

	CData Data;
	CExpression *pExpression = null_v;
	CProgramWhile *pPW = null_v;

	Data.SetParent(&Program.Data());

	while (pSub)
	{
		if (0 == XMLString::compareString(pSub->getNodeName(),
										  wsDataBlock))
		{
			if (SUCCESS != (LoadDataBlock(Data, pSub)))
				return XML_LOADER_ERROR;
		}
		else if (0 == XMLString::compareString(pSub->getNodeName(),
											   wsExpressionUnitary)
				 || 0 == XMLString::compareString(pSub->getNodeName(),
												  wsExpressionDuality)
				 || 0 == XMLString::compareString(pSub->getNodeName(),
												  wsConditionUnitary)
				 || 0 == XMLString::compareString(pSub->getNodeName(),
												  wsConditionDuality))
		{
			if (SUCCESS != LoadExpression(Data, pSub, pExpression, pPDU))
				return XML_LOADER_ERROR;
			
			pPW = new CProgramWhile(b, pExpression, &Data);
			pPW->Data().SetParent(&Program.Data());
		}
		else if (0 == XMLString::compareString(pSub->getNodeName(),
											   wsProcessBlock))
		{
			if (!pPW)
				return XML_LOADER_ERROR;
			
			if (SUCCESS != LoadProcessBlock(*pPW, pSub, pPDU))
				return XML_LOADER_ERROR;
		}

		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (false_v == Program.AddOperator(pPW))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:78,代码来源:CXMLLoaderActions.cpp

示例14: LoadProcessor


//.........这里部分代码省略.........
	auto_xerces_str wsDataBlock("data_block");
	auto_xerces_str wsStart("start");
	auto_xerces_str wsOnClick("on_click");
	auto_xerces_str wsOnMessage("on_message");
	auto_xerces_str wsEnd("end");

	m_pTmpContainer = CUIManager::Instance()->GetContainer(sName);
	
	// Check if there is corresponding container, it should be exist
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	CProtocolInfo *pProtocol = CProtocolManager::Instance()->GetProtocol();

	// Protocol should be loaded
	if (!pProtocol)
		return XML_LOADER_ERROR;

	//
	DOMElement *pChild = (DOMElement *)pElement->getFirstChild();

	if (!pChild)
		return XML_LOADER_ERROR;

	while (pChild)
	{
		if (0 == XMLString::compareString(pChild->getNodeName(),
										  wsDataBlock))
		{
			if (SUCCESS != LoadDataBlock(m_pTmpContainer->Data(), pChild))
				return XML_LOADER_ERROR;

			m_pTmpContainer->Data().SetParent(&CUIManager::Instance()->Data());
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsStart))
		{
			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   m_pTmpContainer->StartProgram(),
									   pChild))
			{
				return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsOnClick))
		{
			auto_xerces_str sName(pChild->getAttribute(wsName));

			CProgram *pProgram = null_v;

			if (!m_pTmpContainer->AddOnClickProcessor(sName, pProgram))
				return XML_LOADER_ERROR;

			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   *pProgram,
									   pChild))
			{
				return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsOnMessage))
		{
			auto_xerces_str sPDU(pChild->getAttribute(wsPDU));

			CPDUInfo *pPDUInfo = null_v;

			if (SUCCESS != pProtocol->GetPDU(sPDU, pPDUInfo))
				return XML_LOADER_ERROR;

			CProgram *pProgram = null_v;

			if (!m_pTmpContainer->AddMessageProcessor(sPDU, pProgram))
				return XML_LOADER_ERROR;

			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   *pProgram,
									   pChild,
									   pPDUInfo))
			{
				return XML_LOADER_ERROR;
			}
		}
		else if (0 == XMLString::compareString(pChild->getNodeName(),
											   wsEnd))
		{
			if (SUCCESS != LoadProgram(&m_pTmpContainer->Data(),
									   m_pTmpContainer->EndProgram(),
									   pChild))
			{
				return XML_LOADER_ERROR;
			}
		}

		pChild = (DOMElement *)pChild->getNextSibling();
	}

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:101,代码来源:CXMLLoaderActions.cpp

示例15: LoadExpression

ret_ CXMLLoaderActions::LoadExpression(const CData &Data,
									   const DOMElement *pElement,
									   CExpression *&pExpression,
									   const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);

	if (pExpression)
		return (PARAMETER_NOT_NULL | PARAMETER_3);
#endif

	auto_xerces_str wsExpressionUnitary	("expression_unitary");
	auto_xerces_str wsExpressionDuality	("expression_duality");
	auto_xerces_str wsConditionUnitary	("condition_unitary");
	auto_xerces_str wsConditionDuality	("condition_duality");
	auto_xerces_str wsCalculate			("calculate");
	auto_xerces_str wsRelation			("relation");

	if (0 == XMLString::compareString(pElement->getNodeName(),
									  wsExpressionUnitary))
	{
		DOMElement *pChild = (DOMElement *)pElement->getFirstChild();

		if (!pChild)
			return XML_LOADER_ERROR;

		CExpression *pExp = null_v;

		while (pChild)
		{
			if (0 == XMLString::compareString(pChild->getNodeName(),
											  wsExpressionUnitary)
				|| 0 == XMLString::compareString(pChild->getNodeName(),
												 wsExpressionDuality)
				|| 0 == XMLString::compareString(pChild->getNodeName(),
												 wsConditionUnitary)
				|| 0 == XMLString::compareString(pChild->getNodeName(),
												 wsConditionDuality))
			{
				if (SUCCESS != LoadExpression(Data, pChild, pExp, pPDU))
					return XML_LOADER_ERROR;

				break;
			}

			pChild = (DOMElement *)pChild->getNextSibling();
		}

		if (!pExp)
			return XML_LOADER_ERROR;

		pExpression = (CExpression *)new CExpNot(pExp);
	}
	else if (0 == XMLString::compareString(pElement->getNodeName(),
										   wsExpressionDuality))
	{
		DOMElement *pChild = (DOMElement *)pElement->getFirstChild();

		if (!pChild)
			return XML_LOADER_ERROR;

		size_ n = 0;
		CExpression *pExp[2] = {null_v, null_v};

		while (pChild)
		{
			if (2 <= n)
				break;

			if (0 == XMLString::compareString(pChild->getNodeName(),
											  wsExpressionUnitary)
				|| 0 == XMLString::compareString(pChild->getNodeName(),
												 wsExpressionDuality)
				|| 0 == XMLString::compareString(pChild->getNodeName(),
												 wsConditionUnitary)
				|| 0 == XMLString::compareString(pChild->getNodeName(),
												 wsConditionDuality))
			{
				if (SUCCESS != LoadExpression(Data, pChild, pExp[n++], pPDU))
					return XML_LOADER_ERROR;
			}

			pChild = (DOMElement *)pChild->getNextSibling();
		}

		if (2 != n)
			return XML_LOADER_ERROR;

		auto_xerces_str sRelation(pElement->getAttribute(wsRelation));

		if (0 == strcmp((const ch_1 *)sRelation, "and"))
			pExpression = (CExpression *)new CExpAnd(pExp[0], pExp[1]);
		else if (0 == strcmp((const ch_1 *)sRelation, "or"))
			pExpression = (CExpression *)new CExpOr(pExp[0], pExp[1]);
		else
			return XML_LOADER_ERROR;
	}
	else if (0 == XMLString::compareString(pElement->getNodeName(),
//.........这里部分代码省略.........
开发者ID:shoutrain,项目名称:ComEgg,代码行数:101,代码来源:CXMLLoaderActions.cpp


注:本文中的DOMElement::getNextSibling方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。