Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
存在名称空间时更新XML_Xml_Oracle_Xml Namespaces_Updatexml - Fatal编程技术网

存在名称空间时更新XML

存在名称空间时更新XML,xml,oracle,xml-namespaces,updatexml,Xml,Oracle,Xml Namespaces,Updatexml,我必须更新XML中的值: <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:s

我必须更新XML中的值:

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
                  xmlns:o="urn:schemas-microsoft-com:office:office" 
                  xmlns:x="urn:schemas-microsoft-com:office:excel" 
                  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
                  xmlns:html="http://www.w3.org/TR/REC-html40">
            <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
                <Author>XXXXXX</Author>
                <LastAuthor>UCB User</LastAuthor>
                <Created>2019-10-31T13:04:09Z</Created>
                <Version>14.00</Version>
            </DocumentProperties>
            <a>5</a>
        </Workbook>
//.getClobVal()最终是因为ORA-21500:内部错误代码,参数:[%s],%s],%s],%s],%s],%s],%s]()

上面的代码不会改变任何东西。我认为这是因为DocumentProperties标记中声明了另一个名称空间。但我不知道如何在子句中声明名称空间

当我尝试使用此代码更新/Workbook/a中的值时,它可以正常工作:

select UPDATEXML(xml_val,
   '/Workbook/a/text()',2020-01-08,
    'xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
              xmlns:o="urn:schemas-microsoft-com:office:office" 
              xmlns:x="urn:schemas-microsoft-com:office:excel" 
              xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
              xmlns:html="http://www.w3.org/TR/REC-html40"').getClobVal() as last
from tt;
我尝试过但不起作用的不同名称空间组合:

--一,

--二,

--三,

--四,


注意:我无法删除DocumentProperties标记中的名称空间声明,因为此XML是format file的一部分,
DocumentProperties
元素及其子元素位于名称空间
urn:schemas microsoft com:office:office
,它具有快捷方式
o
;您需要在Xpath中为这些元素添加名称空间前缀:

选择UPDATEXML(
xml_val,
“/工作簿/o:DocumentProperties/o:Created/text()”,
'2020-01-08',
'xmlns=“urn:schemas microsoft com:office:spreadsheet”
xmlns:o=“urn:schemas microsoft com:office:office”
xmlns:x=“urn:schemas microsoft com:office:excel”
xmlns:ss=“urn:schemas microsoft com:office:spreadsheet”
xmlns:html=”http://www.w3.org/TR/REC-html40"'
)作为更新的xml
来自tt;
小提琴

select UPDATEXML(xml_val,
   '/Workbook/a/text()',2020-01-08,
    'xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
              xmlns:o="urn:schemas-microsoft-com:office:office" 
              xmlns:x="urn:schemas-microsoft-com:office:excel" 
              xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
              xmlns:html="http://www.w3.org/TR/REC-html40"').getClobVal() as last
from tt;
xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
xmlns:o="urn:schemas-microsoft-com:office:office" 
xmlns:x="urn:schemas-microsoft-com:office:excel" 
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="urn:schemas-microsoft-com:office:office"
xmlns:o="urn:schemas-microsoft-com:office:office" 
xmlns:x="urn:schemas-microsoft-com:office:excel" 
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel" 
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="urn:schemas-microsoft-com:office:office"
| UPDATED_XML | | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"><DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"><Author>XXXXXX</Author><LastAuthor>UCB User</LastAuthor><Created>2020-01-08</Created><Version>14.00</Version></DocumentProperties><a>5</a></Workbook> |