create or replace procedure UpdatePrintFormat
(
ItemTypeValue varchar2,--打印分类(Item节点中Type属性的值)
lableorTextBox varchar2,--lable /textbox
nameortext varchar2,-- text /name
nameortextValues varchar2,
PointValues varchar2,--要添加的坐标
PointValuesOnly varchar2,--唯一标识
AttributeSize varchar2,--要添加的大小
FontValue varchar2,--字体
actionType varchar2,-- add /remove/ update
Uname varchar2--用户名
)
as
xmlPar XMLPARSER.parser := XMLPARSER.NEWPARSER;
doc xmldom.DOMDocument; lenItem integer;
lenchildnodes integer;
ItemNodes xmldom.DOMNodeList;
ItemNode xmldom.DOMNode;
ChildNodes xmldom.DOMNodeList;
ChildNode xmldom.DOMNode;
parentNode xmldom.DOMNode;
ChildNodeAttributes xmldom.DOMNamedNodeMap;
lenChildNodeAttributes integer;
ChildNodeAttribute xmldom.DOMNode;
tempNode xmldom.DOMNode;
tempNode1 xmldom.DOMElement;
tempNode2 xmldom.DOMNode;
tempNode3 xmldom.DOMNodeList;
tempNode4 xmldom.DOMNode;
tempNode5 xmldom.DOMNode;
tempnodevalue varchar2(500);
domNodeMap xmldom.DOMNamedNodeMap;
xmlClobData clob;
defaultColb clob;
begin select medic_settings into xmlClobData from medic_base t where username=Uname;
xmlPar := xmlparser.newParser;
xmlparser.parseClob(xmlPar,xmlClobData); doc := xmlparser.getDocument(xmlPar); xmlparser.freeParser(xmlPar);--获取item
ItemNodes:=xmldom.getElementsByTagName(doc, 'Item' );
lenItem:=xmldom.getLength(ItemNodes);
FOR i in 0..lenItem-1
loop
--得到每一个Item
ItemNode :=xmldom.item( ItemNodes,i );
--得到Item的属性集合
domNodeMap := xmldom.getAttributes(ItemNode);
--得到并判断Type属性
tempnode := xmldom.item(domNodeMap, 0);
tempnodevalue := xmldom.getNodeValue(tempnode);
if(tempnodevalue=ItemTypeValue)--得到Type
then
--获得该Item下的PageHeader
tempNode3:= xmldom.getChildNodes(ItemNode);
tempNode4:= xmldom.item(tempNode3, 0);
-- 获得该获得该Item下的PageHeader下的Lable/TextBox
ChildNodes := xmldom.getChildNodes(tempNode4);
if(actionType='add')--增加节点
then
tempNode1:=xmldom.createElement(doc,lableorTextBox);
xmldom.setAttribute(tempNode1,nameortext,nameortextValues);
xmldom.setAttribute(tempNode1,'Location',PointValues);
xmldom.setAttribute(tempNode1,'Size',AttributeSize);
xmldom.setAttribute(tempNode1,'Font',FontValue);
tempNode2:=xmldom.makeNode(tempNode1);
tempNode5:= xmldom.getLastChild(tempNode4);
tempNode:= xmldom.appendChild(tempNode5,tempNode2);
else
lenchildnodes:=xmldom.getLength(ChildNodes);
--删改节点
for k in 0..lenchildnodes-1
loop
ChildNode := xmldom.item(ChildNodes, k);
ChildNodeAttributes := xmldom.getAttributes(ChildNode);
lenChildNodeAttributes:=xmldom.getLength(ChildNodeAttributes);
for l in 0..lenChildNodeAttributes-1
loop
ChildNodeAttribute:= xmldom.item(ChildNodeAttributes, l);
--获得要进行操作的节点(根据唯一坐标)
if(xmldom.getNodeValue(ChildNodeAttribute)=PointValuesOnly)
then
tempnodevalue:=xmldom.getNodeValue(ChildNodeAttribute);
if(actionType='remove')--删除
then
parentNode:=xmldom.getParentNode(ChildNode);
tempNode:=xmldom.removeChild(parentNode ,ChildNode);
else if(actionType='update')--修改
then
if(nameortextValues is not null) then
xmldom.setAttribute(xmldom.makeElement(ChildNode),nameortext,nameortextValues);
end if;
if(PointValues is not null) then
xmldom.setAttribute(xmldom.makeElement(ChildNode),'Location',PointValues);
end if;
if(AttributeSize is not null) then
xmldom.setAttribute(xmldom.makeElement(ChildNode),'Size',AttributeSize);
end if;
if(FontValue is not null) then
xmldom.setAttribute(xmldom.makeElement(ChildNode),'Font',FontValue);
end if;
end if;
end if;
end if;
end loop;
end loop;
end if;
end if;
end loop;
DBMS_LOB.CreateTemporary(defaultColb, TRUE);
xmldom.writeToClob(doc,defaultColb);
update medic_base t set t.medic_settings=defaultColb where username=Uname;xmldom.freeDocument(doc);
end UpdatePrintFormat;
/
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货