public static function getNamedTagInTagList($szName, $xtlTagList) { $lszHierarchicalNames = null; $nCount = 0; $boAbort = false; $boFound = false; $boLastNode = false; $szString; $szTagNameToFind; $nCurrentIndex = 0; $xtReturnTag = null; $xtCurrentTag = null; $nTagCount = 0; $xtlCurrentTagList = null; $nCount2 = 0; if (is_null($xtlTagList)) { return null; } if (count($xtlTagList) == 0) { return null; } $lszHierarchicalNames = new CSV_StringList(); $lszHierarchicalNames = CSV_SharedFunctions::getStringListFromCharSeparatedString($szName, '.'); $xtlCurrentTagList = $xtlTagList; // loop over the hierarchical list for ($nCount = 0; $nCount < $lszHierarchicalNames->getCount() && !$boAbort; $nCount++) { if ($nCount == $lszHierarchicalNames->getCount() - 1) { $boLastNode = true; } $szString = (string) $lszHierarchicalNames[$nCount]; // look to see if this tag name has the special "[]" array chars $szTagNameToFind = CSV_SharedFunctions::getArrayNameAndIndex(szString, $nCurrentIndex); $nCurrentIndex = $nIndex; $boFound = false; $nCount2 = 0; for ($nTagCount = 0; $nTagCount < $xtlCurrentTagList->getCount() && !$boFound; $nTagCount++) { $xtCurrentTag = $xtlCurrentTagList->getXmlTagForIndex($nTagCount); // if this is the last node then check the attributes of the tag first if ($xtCurrentTag->getName() == $szTagNameToFind) { if ($nCount2 == $nCurrentIndex) { $boFound = true; } else { $nCount2++; } } if ($boFound) { if (!$boLastNode) { $xtlCurrentTagList = $xtCurrentTag->getChildTags(); } else { // don't continue the search $xtReturnTag = $xtCurrentTag; } } } if (!$boFound) { $boAbort = true; } } return $xtReturnTag; }
public function addParam2(CSV_SOAPParameter $spSOAPParam, $boOverWriteValue) { $lszHierarchicalNames; $nCurrentIndex = 0; $szTagNameToFind; $szString; $nCount = 0; $nCount2 = 0; $lspParamList; $spWorkingSOAPParam; $spNewSOAPParam; $boFound = false; $lspaAttributeList; $spaAttribute; $spaNewAttribute; $spaSOAPParamAttributeList; // need to check the name of the incoming item to see if it is a // complex soap parameter $lszHierarchicalNames = new CSV_StringList(); $lszHierarchicalNames = CSV_SharedFunctions::getStringListFromCharSeparatedString($spSOAPParam->getName(), '.'); if ($lszHierarchicalNames->getCount() == 1) { $this->m_lspSOAPParamList->add($spSOAPParam); } else { $lspParamList = $this->m_lspSOAPParamList; //complex for ($nCount = 0; $nCount < $lszHierarchicalNames->getCount(); $nCount++) { // get the current tag name $szString = (string) $lszHierarchicalNames->getAt($nCount); //continuework $szTagNameToFind = CSV_SharedFunctions::getArrayNameAndIndex($szString, $nCurrentIndex); // first thing is to try to find the tag in the list if ($boFound || $nCount == 0) { // try to find this tag name in the list $spWorkingSOAPParam = CSV_Functions::isSOAPParamInParamList($lspParamList, $szTagNameToFind, $nCurrentIndex); if ($spWorkingSOAPParam == null) { $boFound = false; } else { $boFound = true; // is this the last item in the hierarchy? if ($nCount == $lszHierarchicalNames->getCount() - 1) { if ($boOverWriteValue) { // change the value $spWorkingSOAPParam->setValue($spSOAPParam->getValue()); } // add the attributes to the list for ($nCount2 = 0; $nCount2 < $spSOAPParam->getSOAPParamAttributeList()->getCount(); $nCount2++) { //$spaAttribute = $spaSOAPParamAttributeList[$nCount2]; $spaAttribute = $spSOAPParam->getSOAPParamAttributeList()->getAt($nCount2); if ($spaAttribute != null) { $spaNewAttribute = new CSV_SOAPParamAttribute($spaAttribute->getName(), $spaAttribute->getValue()); $spWorkingSOAPParam->getSOAPParamAttributeList()->add($spaNewAttribute); } } } $lspParamList = $spWorkingSOAPParam->getSOAPParamList(); } } if (!$boFound) { // is this the last tag? if ($nCount == $lszHierarchicalNames->getCount() - 1) { $lspaAttributeList = new CSV_SOAPParamAttributeList(); for ($nCount2 = 0; $nCount2 < $spSOAPParam->getSOAPParamAttributeList()->getCount(); $nCount2++) { $spaSOAPParamAttributeList = $spSOAPParam->getSOAPParamAttributeList(); $spaAttribute = $spaSOAPParamAttributeList->getAt($nCount2); if ($spaAttribute != null) { $spaNewAttribute = new CSV_SOAPParamAttribute($spaAttribute->getName(), $spaAttribute->getValue()); $lspaAttributeList->add($spaNewAttribute); } } $spNewSOAPParam = new CSV_SOAPParameter($szTagNameToFind, $spSOAPParam->getValue(), $lspaAttributeList); $lspParamList->add($spNewSOAPParam); } else { $spNewSOAPParam = new CSV_SOAPParameter($szTagNameToFind, '', null); $lspParamList->add($spNewSOAPParam); $lspParamList = $spNewSOAPParam->getSOAPParamList(); } } } } $this->m_boPacketBuilt = false; }