PHP - 解析XML(PHP - Parse XML)
我正在尝试学习API并尝试使用亚马逊的AWSECommerceService。 使用下面的XML,我试图解析具体的值。 特别是,我想得到一个嵌套在一个嵌套中的值,例如数字。 我以为我可以用PHP SimpleXML做到这一点,但我很难做到这一点。 为什么这段代码不起作用?
<?php $xml=simplexml_load_file("test.xml") or die("Error: Cannot create object"); echo $xml->ItemLookupResponse[0]->Offers->TotalOffers . "<br>"; ?>
I am attempting to learn APIs and trying with the Amazon's AWSECommerceService. Using the XML below, I am trying to parse out specific values. In particular, I would like to get a value that is within a nest such as the number with . I thought I could do this with PHP SimpleXML but I am having a hard time doing this. Why won't this code work?
<?php $xml=simplexml_load_file("test.xml") or die("Error: Cannot create object"); echo $xml->ItemLookupResponse[0]->Offers->TotalOffers . "<br>"; ?>
原文:https://stackoverflow.com/questions/40519561
最满意答案
您好我自己找到了解决方案。
在属性窗口的RowSourcefield中添加'。
'源数据'!项目
要么
Me.LB_Project.RowSource = "'Source data'!" & ThisWorkbook.Sheets("Source data").Range("Project").Address
这解决了我在sheetname中的空间问题
Hello i found a solution myself.
to add ' around the sheetname in the RowSourcefield in property window.
'Source data'!Project
or
Me.LB_Project.RowSource = "'Source data'!" & ThisWorkbook.Sheets("Source data").Range("Project").Address
This solwed my problem with the space in the sheetname
相关问答
更多-
你的范围不正确。 它应该是lbxCurrent.RowSource = "'List of Accounts'!A2:A4"由于工作表名称中的空格而导致错误 Your Range is incorrect. It should be lbxCurrent.RowSource = "'List of Accounts'!A2:A4" You're getting the error due to spaces in your sheet name
-
使用Pass through查询在Access中设置RowSource(Setting RowSource in Access with Pass through query)[2023-05-14]
您正在设置querydef,但不使用它。 Me.animal.RowSource = strSQL 应该 Me.animal.RowSource = "animal" 要么 Me.animal.RowSource = Q.Name 您的第二个代码示例有效,因为Access SELECT SQL可以在Access查询中使用,也可以直接用作行源。 PS Q.Close应该是Set Q = Nothing ,但实际上并不需要,因为它是一个局部变量,在sub的末尾被销毁。 You are setting a ... -
Access 2013在其rowsource中引用了一个组合框自己的标签(Access 2013 refer to a combobox's own tag in its rowsource)[2023-08-14]
这是我建议的例子。 Option Explicit Private Sub Form_Load() Const DROPDOWN_SQL As String = "SELECT DropdownNames FROM Table WHERE DropdownCategory = " Const DOUBLE_QUOTES As String = """" Dim ctl As Control Dim strRowsource As Stri ... -
你的SQL在日期和类似之间有一些奇怪的间距。 尝试这个。 Me.lstGngSheets.RowSource = "SELECT gangID, fileName, date, crossStreets FROM tblgangSheets " & _ "WHERE borough LIKE ""*" & DQ(Me.cboBoro.Value) & _ "*"" AND date BETWEEN #" & txtDtBeg.Value & "# and #" & txtDtEnd.Value & "# ...
-
一种方法是在用于命名范围的公式中使用IFERROR,这样如果命名范围不返回任何内容,则它指的是特定范围/单元格。 =IFERROR(INDEX(EquipTable[Equip], MATCH(0,EquipTable[Flag],0), 1):INDEX(EquipTable[Equip], MATCH(0,EquipTable[Flag],0)+COUNTIF(EquipTable[Flag],0)-1, 1),A1) 这里A1是指定范围将引用的单元格,如果公式未返回任何有效范围。 根据您的要求更改公 ...
-
您好我自己找到了解决方案。 在属性窗口的RowSourcefield中添加'。 '源数据'!项目 要么 Me.LB_Project.RowSource = "'Source data'!" & ThisWorkbook.Sheets("Source data").Range("Project").Address 这解决了我在sheetname中的空间问题 Hello i found a solution myself. to add ' around the sheetname in the RowSou ...
-
如何检查每个单元格中是否有值的循环: Dim CountLng as Long 'Set CountLng to maximum row in column A that you would like to search for. 'This example uses the number of rows in the entire used range of the worksheet CountLng = ActiveSheet.UsedRange.Rows.Count With listbox1 ...
-
重置列表框行源(Reset listbox rowsource)[2023-12-08]
除非您将表单保存为空,否则属性窗口中设置的rowsource将保持不变。 在VBA代码中设置它不会将其存储在窗体属性上。 The rowsource set in the property window will persist unless you save the form with it empty. Setting it in VBA code will not store it on the forms properties. -
SQL SP作为带变量的Listbox Rowsource - Server 2008(SQL SP as Listbox Rowsource with variables — Server 2008)[2021-12-29]
在SQL Server中,我有一个名为[Guitars]的表,其中包含 Model Make ------------ ------ Les Paul Gibson SG Gibson Stratocaster Fender Telecaster Fender 和名为[GetModels]的存储过程定义为 CREATE PROCEDURE [dbo].[GetModels] @Make nvarchar(50) = '' AS BEGIN ... -
试试这个 - 我想我终于理解你为什么要寻找RowSource - 抱歉我一开始并没有“得到”它。 您尝试提取的字段是描述表中的外键。 此函数应作为所有此类字段的通用解决方案(假设RowSource始终具有主键,而描述第二个)。 如果没有RowSource,它只会拉取字段的值。 它基于您的原始代码,而不是@ron提出的更改,但它应该让您朝着正确的方向前进。 您应该修复它以使其参数化,并允许变体数据类型,如ron建议的(+1 ron) 顺便说一句,使用和号( & )在VBA中将字符串连接在一起以避免这样的事情: ...