PHP使用分组解析XML文件[关闭](PHP parse XML file with grouping [closed])
我有来自库源的以下xml代码:
<?xml version="1.0" encoding="UTF-8"?> <Data> <MyData> <Column Collections="Books.ID"> <Row>1534</Row> <Row>2753</Row> <Row>3734</Row> <Row>4029</Row> <Row>5242</Row> <Row>6833</Row> <Row>7275</Row> <Row>8456</Row> </Column> <Column Collections="Books.InStock"> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> </Column> <Column Collections="Books.HowMany"> <Row>12</Row> <Row>4</Row> <Row>19</Row> <Row>2</Row> <Row>0</Row> <Row>18</Row> <Row>52</Row> <Row>26</Row> <Row>32</Row> <Row>4</Row> </Column> </MyData> </Data>
如何将该数据放入使用SimpleXML的html表中?
I have the following xml code from a library source:
<?xml version="1.0" encoding="UTF-8"?> <Data> <MyData> <Column Collections="Books.ID"> <Row>1534</Row> <Row>2753</Row> <Row>3734</Row> <Row>4029</Row> <Row>5242</Row> <Row>6833</Row> <Row>7275</Row> <Row>8456</Row> </Column> <Column Collections="Books.InStock"> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> <Row>0</Row> </Column> <Column Collections="Books.HowMany"> <Row>12</Row> <Row>4</Row> <Row>19</Row> <Row>2</Row> <Row>0</Row> <Row>18</Row> <Row>52</Row> <Row>26</Row> <Row>32</Row> <Row>4</Row> </Column> </MyData> </Data>
How can I put that data into a html table with SimpleXML?
原文:https://stackoverflow.com/questions/39300847
最满意答案
看起来这是不可能的。
一种解决方法是使用触发器:
CREATE OR REPLACE TRIGGER test_trigger BEFORE INSERT OR UPDATE ON test_table FOR EACH ROW WHEN ( new.test_attr IS NULL ) BEGIN :new.test_attr := NEW test_t(); END test_trigger; /
它不会完全忽略非默认构造函数,覆盖默认构造函数
CONSTRUCTOR FUNCTION test_t(in_val NUMBER) RETURN SELF AS RESULT
尝试使用
DEFAULT NEW test_t(1)
定义表时导致异常:ORA-06553:PLS-307:太多的'TEST_T'声明与此调用相匹配
Looks like this is not possible.
One workaround would be to use a trigger:
CREATE OR REPLACE TRIGGER test_trigger BEFORE INSERT OR UPDATE ON test_table FOR EACH ROW WHEN ( new.test_attr IS NULL ) BEGIN :new.test_attr := NEW test_t(); END test_trigger; /
It does not completely ignore non-default constructors by the way, overriding the default constructor
CONSTRUCTOR FUNCTION test_t(in_val NUMBER) RETURN SELF AS RESULT
leads to an exception when trying to define the table with
DEFAULT NEW test_t(1)
:ORA-06553: PLS-307: too many declarations of 'TEST_T' match this call
相关问答
更多-
对象的默认值(Default value for object)[2022-09-20]
您可以使用String对象而不是原始值: var a = new String("hello"); a.x = "0"; a.y = 10; var b = new String("world"); b.x = "10"; b.y = 10; var textStrings = [a, b]; 您也可以使用特殊对象。 将对象转换为字符串时,将自动使用toString方法: function Text(t, x, y) { this.text = t; this.x = x; this.y = y ... -
https://www.sqlite.org/datatype3.html 3.1。 柱亲和力的测定 如果列的声明类型包含字符串“BLOB”,或者未指定类型,则列具有关联BLOB。 所以我们可以假设默认类型是BLOB。 https://www.sqlite.org/datatype3.html 3.1. Determination Of Column Affinity If the declared type for a column contains the string "BLOB" or if no ...
-
NUMBER(精度,刻度) 如果未指定精度,则列存储给定的值。 如果没有指定比例,则刻度为零。 更多信息在: http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1832 NUMBER (precision, scale) If a precision is not specified, the column stores values as given. If no scale is specif ...
-
您需要将NULL转换为用户定义的类型。 尝试这个: PACKAGE PKG_DEVICE AS TYPE STR_ASSOC_ARR is table of VARCHAR(255) index by BINARY_INTEGER; procedure proc_create_device ( in_deviceid in raw , in_devicecert in clob , in_status in number , in_caps in STR_ASSO ...
-
我认为你有一个问题,因为日期时间的字符串格式。 MySQL不会将您的字符串格式理解为datetime值。 尝试使用参数(假设代码中的某个地方有一个SqlCommand对象): string query = "INSERT INTO master (NoInvoice, Name, Date, Type, Additionaltext) VALUES (@NoInvoice, @sName, @dtDate, @sType, @sAdditionalText)"; using(SqlCommand comma ...
-
看起来这是不可能的。 一种解决方法是使用触发器: CREATE OR REPLACE TRIGGER test_trigger BEFORE INSERT OR UPDATE ON test_table FOR EACH ROW WHEN ( new.test_attr IS NULL ) BEGIN :new.test_attr := NEW test_t(); END test_trigger; / 它不会完全忽略非默认构造函数,覆盖默认构造函数 CONSTRUCTOR FUNCTION ...
-
这在Oracle中也是如此。 Oracle语法几乎相同。 在Oracle中不使用关键字WITH ,只使用关键字DEFAULT 。 Oracle中的USER是USER而不是SESSION_USER 。 This works the same in Oracle. The Oracle syntax is almost the same. You don't use the keyword WITH in Oracle, only the keyword DEFAULT. And the user in Ora ...
-
您无法根据内容类型为Sharepoint中的列设置默认值。 你可以做的是修改使用内容类型/列的列表的editform和newform aspx页面,然后使用JQuery根据选定的内容类型设置值。 You cannot set a default value for a column in Sharepoint based on the content type. What you could do though is modify the editform and newform aspx pages of ...
-
oracle列的默认值(oracle default value for a column)[2022-09-07]
您可以为调用所需函数的表编写INSERT触发器。 You can write an INSERT trigger for the table that calls the function you want. -
此页面InformIT:MySQL中的数据类型声称空间列不能具有DEFAULT值,但我无法在MySQL文档中找到该信息: 3.2.3指定列默认值 对于除BLOB和TEXT类型,空间类型或具有AUTO_INCREMENT属性的列之外的所有类型,您可以指定DEFAULT def_value子句以指示... 在我的5.1框中测试显示与您相同的错误。 所以声称可能是正确的。 This page InformIT: Data Types in MySQL claims that spatial columns can ...