草庐IT

PHP-While

全部标签

xml - PHP SimpleXML xpath : contains and position

这是我的PHP代码:$xml=newSimpleXMLElement('data.xml',null,true);$q=$xml->xpath('post/misc[contains(tags,"animal")][position()这是XML文件:1animal,tiger0.52plant,coconut0.53animal,lion0.54animal,monkey0.5如何获取标签中包含“动物”的前2个元素?xpath结果应该是post:id=1和post:id=3,但是它返回了所有包含animal的元素>. 最佳答案 将

xml - 连接被拒绝 : connect while parsing xml with groovy

我有以下xml片段:尝试使用以下方法解析此xml时:defsqlMapOld=newXmlParser().parse(file)我收到以下错误:Exceptionthrown:Connectionrefused:connectjava.net.ConnectException:Connectionrefused:connect如果我从xml片段中删除DOCTYPE,这个错误就会消失。有没有办法阻止groovy脚本尝试连接到URL? 最佳答案 如果您使用的是合适的解析器,请尝试使用load-external-dtd功能。defpar

SQL 2012 - 遍历 XML 列表(更好地替代 WHILE 循环)

使用SQL2012并将XML传递到存储过程中,存储过程必须接受该输入并将传递到存储过程的XML部分中的每个项目写入表中。XML看起来像:MyTextMessage2013-09-2510:52:37.098JohnJamesRobPeteSam存储过程的输出应该是插入到表中的5行(上面的每个SendTo),并且每行在MyMsg和MsgTime该表中的字段。我可以得到SendTo的数量,也可以得到XMLSendToList,但我不知道如何遍历它来进行插入。我可以使用以下SQL来获取XML中的内容。SELECTx.value('(/MyXML/MyMsg)[1]','VARCHAR(102

c# - 系统.Xml.XmlException : Unexpected end of file while parsing Name has occurred

我正在使用通过SqlCommand.ExecuteXmlReader检索的XmlReader。Hereismyinput当我运行这行代码时:XDocumentcurrentXDoc=XDocument.Load(ktXmlReader.ReadSubtree());它第一次工作,按预期读取第一个Product节点。第二次运行时,出现以下异常:System.Xml.XmlException:Message:UnexpectedendoffilewhileparsingNamehasoccurred.Line1,position2048.Stacktrace:atSystem.Xml.Xm

c# - XmlDocument 抛出 "An error occurred while parsing EntityName"

我有一个函数,我将一个字符串作为参数传递给名为filterXML的参数,其中一个属性中包含“&”。我知道XML不会识别它,它会给我一个错误。这是我的代码:publicXmlDocumentTestXMLDoc(stringfilterXml){XmlDocumentdoc=newXmlDocument();XmlNoderoot=doc.CreateElement("ResponseItems");//putthatrootintoourdocument(whichisanemptyplaceholdernow)doc.AppendChild(root);try{XmlDocument

xml - 如何修复 soapenv :Envelope issue in XSD schema while validating with SOAP request/response

我有一个SOAP请求:-58和SOAP响应:-TheDataretrievedfromtheDatabase58fdfdf44sse现在我的XSD模式是:-现在我的问题是每当我尝试根据此XSD架构验证我的SOAP请求时,我都会收到以下错误:-Notvalid.Error-Line1,133:org.xml.sax.SAXParseException;lineNumber:1;columnNumber:133;cvc-elt.1:Cannotfindthedeclarationofelement'soapenv:Envelope'.请帮助...我需要知道我应该在我的XSD架构中修改什么,

xml - PHP DOMNode insertAfter?

我对如何重新排序节点有点困惑。我正在尝试添加两个简单的“向上移动项目”和“向下移动项目”功能。虽然insertBefore()做了我想在前一个节点之前移动同级节点的操作,但在DOM中向下移动一个节点的最简单方法是什么?非常感谢! 最佳答案 代码示例:try{$li->parentNode->insertBefore($ul,$li->nextSibling);}catch(\Exception$e){$li->parentNode->appendChild($ul);} 关于xml-PH

使用vscode运行php

使用vscode运行php一、安装扩展我们先打开vscode然后转到安装扩展的地方这里我们需要两个扩展,一个是phpserver,一个是phpdebug单击安装即可二、配置扩展我们先新建一个php文件单击改文件然后文件-->首选项-->设置设置一下php的exe将这些添加进去即可。不过要注意,是你的php文件的路径,这里的是我的。{"php.validate.executablePath":"php路径/php.exe","php.debug.executablePath":"php路径/php.exe","phpserver.phpConfigPath":"php路径/php.ini","p

php - 使用 SoapClient 从 PHP 中的 WSDL 获取元素

我想从中获取文本嵌套在中的元素WSDLblock。有问题的WSDL是Ebay的Tradingapi。有问题的片段看起来像这样:941我目前正在这样做:$xml=newDOMDocument();$xml->load($this->wsdl);$version=$xml->getElementsByTagName('Version')->item(0)->nodeValue;这行得通,但我想知道是否有一种方法可以使用PHP的SOAP扩展在本地获取它?我想像下面这样的东西会起作用,但它不起作用:$client=newSoapClient($this->wsdl);$version=$cli

php - 在 Magento 的管理模块中显示模板

我是Magento的新手。我正在尝试为Magento管理面板开发一个自定义模块。我的代码如下位置:app/etc/modulesDigitab_Brandlogo.xmltruelocal位置:app/code/local/Digitab/Brandlogo/Block/Adminhtmllogo.php_controller='adminhtml_brandlogo';$this->_blockGroup='brandlogo';$this->_headerText=Mage::helper('brandlogo')->__('BrandLogoManager');$this->_a