我第一次用XMLDOM,写了个小例如下:create or replace procedure aaaproc
is
document xmldom.DOMDocument;
domElement xmldom.DOMElement;
tempnode xmldom.DOMNode;
RR varchar2(4000);
xmldoc clob;
begin
document := xmldom.newDOMDocument;
domElement := xmldom.createElement(document,'coco');
xmldom.setAttribute(domElement,'uname','huangj');
--xmldom.setNodeValue(domElement,'helloworld');
tempnode := xmldom.appendChild(xmldom.makeNode(document),xmldom.makeNode(domElement));
xmldom.setVersion(document, '1.0');
xmldom.setCharset(document, 'GBK');
xmldoc := ' ';
xmldom.writeToClob(document, xmldoc);
xmldom.freeDocument(document);
RR := xmldoc;
dbms_output.put_line(RR);
end;输出结果为:
<?xml version = '1.0'?>
<coco uname="huangj"/>而后我想在<coco uname="huangj"></coco>标记之间添加点内容,就加了句
xmldom.setNodeValue(domElement,'helloworld');重新创建时出错
PROCEDURE DLYX.AAAPROC 编译错误
错误:PLS-00306: 调用 'SETNODEVALUE' 时参数个数或类型错误
行:15
文本:xmldom.setNodeValue(domElement,'helloworld');
错误:PL/SQL: Statement ignored
行:15
文本:xmldom.setNodeValue(domElement,'helloworld');
这样的话这句要怎么写?那位要是有XMLDOM帮助文档的话方便就给我一份,谢谢!!!
is
document xmldom.DOMDocument;
domElement xmldom.DOMElement;
tempnode xmldom.DOMNode;
RR varchar2(4000);
xmldoc clob;
begin
document := xmldom.newDOMDocument;
domElement := xmldom.createElement(document,'coco');
xmldom.setAttribute(domElement,'uname','huangj');
--xmldom.setNodeValue(domElement,'helloworld');
tempnode := xmldom.appendChild(xmldom.makeNode(document),xmldom.makeNode(domElement));
xmldom.setVersion(document, '1.0');
xmldom.setCharset(document, 'GBK');
xmldoc := ' ';
xmldom.writeToClob(document, xmldoc);
xmldom.freeDocument(document);
RR := xmldoc;
dbms_output.put_line(RR);
end;输出结果为:
<?xml version = '1.0'?>
<coco uname="huangj"/>而后我想在<coco uname="huangj"></coco>标记之间添加点内容,就加了句
xmldom.setNodeValue(domElement,'helloworld');重新创建时出错
PROCEDURE DLYX.AAAPROC 编译错误
错误:PLS-00306: 调用 'SETNODEVALUE' 时参数个数或类型错误
行:15
文本:xmldom.setNodeValue(domElement,'helloworld');
错误:PL/SQL: Statement ignored
行:15
文本:xmldom.setNodeValue(domElement,'helloworld');
这样的话这句要怎么写?那位要是有XMLDOM帮助文档的话方便就给我一份,谢谢!!!
tempnode := xmldom.appendChild(domElement,xmldom.makeNode(text)); XMLDOM帮助文档我也找了很久都未果,痛苦
在Oracle的帮助文档里有关于xmldom的文档,贴在这里,希望有用http://www.oracle.com/pls/db102/portal.all_books#index-XMLPL/SQL Packages and Types Reference
XML DB Developer's Guide
XML Developer's Kit Programmer's Guide