jjzjj

SimpleXml

全部标签

java - 使用 SimpleXML 反序列化

编辑:删除了之前的编辑我正在尝试反序列化以下内容:113768812002013-08-19...213768812002013-08-19使用@RootpublicclassMatches{@ElementListprivateListlist;publicListgetMatches(){returnlist;}}和@Root(name="KAMP",strict=false)publicclassMatch{@Element(name="ID",required=false)publicStringId;@Element(name="SQLTID",required=false)

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 - laravel 下载一个新创建的 xml 文件

我正在尝试创建xmlfile并从我的程序下载它,但它运行得不是很好。这是我的代码:$xml=newSimpleXMLElement('');$xml->addAttribute('version','1.0');$xml->addChild('datetime',date('Y-m-dH:i:s'));$person=$xml->addChild('person');$person->addChild('firstname','Someone');$person->addChild('secondname','Something');$person->addChild('telepho

xml - xml 文件错误,标记中的数据过早结束

我用过这个系统,但它不知道发生了什么!行:197核心.phpforeach($this->getAll()as$banner){行:191核心.php$_xmlBanners=simplexml_load_file(PATH_XML."banners.xml");我的xml:http://lineagefree.com/acp/images/l2jbr.pnghttp://l2j.lt/topai/balsuoti-7907.phphttp://l2j.lt/topai/mokamas-7907.php(.*)http://lineagefree.com/acp/images/top1

php - Simplexml_load_string($string) 返回一个空对象但 $string 包含 xml?下面的代码

我使用cURL以xml格式检索一些信息。....$xml=curl_exec($ch);$data=simplexml_load_string($xml);print_r($data);//output-SimpleXMLElementObject()如果我尝试-print_r($xml);并查看页面源代码我明白了Matt.SmithSmithMattmalematt@company.co.ukenASystemAdministrator8000OrganisationTitle20707LondonOffice0Unassigned0UnassignedUnassignedUnass

PHP simplexml : why does xpath stop working?

供应商稍微更改了XMLheader后发生了一件奇怪的事情。我曾经能够使用xpath阅读内容,但现在我什至无法通过获得回复$xml->xpath('/');他们改变了它...%nitf;]>...为此:... 最佳答案 这很可能是因为他们在文档中引入了默认namespace(xmlns="http://iptc.org/std/NewsML/2003-10-10/")。简单地说,SimpleXML对默认命名空间的支持不是很好。你能尝试显式注册一个命名空间前缀吗:$xml->registerXPathNamespace("n","htt

php - file_get_contents 通过 php 失败,通过浏览器工作

我想要实现的目标:获取对API端点的请求,检索XML并随后解析结果。我正在发送一个file_get_contents请求来实现这一点。问题:`file_get_Contents`fails,error:Warning:file_get_contents(https://api.twitter.com/1.1/statuses/mentions_timeline.json):failedtoopenstream:Aconnectionattemptfailedbecausetheconnectedpartydidnotproperlyrespondafteraperiodoftime,o

php - simplexml 帮助我如何解析这个?

我没有做过任何xml项目,所以我不太确定如何处理这些数据...我正在使用curl向salesforce发出请求,他们给我返回一个我需要解析的响应。我想使用simplexml。这是响应的一部分:https://na6-api.salesforce.com/services/Soap/m/18.0/falsefalsehttps://na6-api.salesforce.com/services/Soap/u/18.0/!AQ4AQLtDIqY.false$USDfalsefalsefalseOxsdfgsdfgsdfgsdfg###@gmail.com######asdfasdfen_U

php - 在 php 中使用 simplexml 从 plist 样式的 xml 获取键/值对

这是来自xml文件的示例位:NameJoeSmithTypeProfileRoleUserSomeNumber1SomeBoolean我有两个不同的目标。第一个是从dict中提取一个数组看起来像的节点:[Name]=>JoeSmith[Type]=>Profile[Role]=>User[SomeNumber]=>1[SomeBoolean]=>true包含bool值并不重要,所以如果这增加了太多的复杂性,我宁愿现在只知道如何处理其他值。第二个目标是能够选择值节点(、等)以便我可以更改值。我知道我需要根据前面关键元素的文本值来选择它。我认为以下XPath应该有效://key[.=$ke

PHP:调用子标记 simplexml

尝试使用PHP解析YouTube提要simplexml_load_file();我可以很简单地使用访问其他标签$xml->id;当我尝试访问时与$xml->openSearch->totalResults;我没有得到任何结果 最佳答案 openSearch是一个namespace-它不是标签名称、父名称或类似名称。文档中某处将有一个名为xmlns:openSearch的属性,它定义了openSearch命名空间(带有URL)。您可以使用children方法获取特定命名空间的子级,并执行如下操作:$xml->children('ope