5: -- |----------------------------< valueOf >---------------------------------|
6: -- -------------------------------------------------------------------------
7: --
8: FUNCTION value_Of
9: (doc in xmldom.DOMDocument
10: ,xpath in varchar2
11: )return varchar2 is
12: retval varchar2(32767);
13: --
12: retval varchar2(32767);
13: --
14: Begin
15: --
16: if (not xmldom.IsNull(doc)) then
17: xslprocessor.valueOf(xmlDom.makeNode(doc),xpath, retval);
18: end if;
19: return retval;
20: End value_Of;
13: --
14: Begin
15: --
16: if (not xmldom.IsNull(doc)) then
17: xslprocessor.valueOf(xmlDom.makeNode(doc),xpath, retval);
18: end if;
19: return retval;
20: End value_Of;
21: --
28: ,xpath in varchar2
29: ) return varchar2 is
30: --
31: retval varchar2(32767);
32: xmldoc xmldom.DOMDocument;
33: parser xmlparser.parser;
34: --
35: Begin
36:
38: xmlparser.parseClob(parser,doc);
39: xmldoc:=xmlparser.getDocument(parser);
40: xmlparser.freeParser(parser);
41: retval:=hr_xml_util.value_Of(xmldoc,xpath);
42: xmldom.freeDocument(xmldoc);
43: return retval;
44: exception
45: when others then
46: xmlparser.freeParser(parser);
43: return retval;
44: exception
45: when others then
46: xmlparser.freeParser(parser);
47: xmldom.freeDocument(xmldoc);
48: return null;
49: End value_Of;
50: --
51: -- -------------------------------------------------------------------------
57: ,xpath in varchar2
58: ) return varchar2 is
59: --
60: retval varchar2(32767);
61: xmldoc xmldom.DOMDocument;
62: parser xmlparser.parser;
63: --
64: Begin
65:
67: xmlparser.parseBuffer(parser,doc);
68: xmldoc:=xmlparser.getDocument(parser);
69: xmlparser.freeParser(parser);
70: retval:=hr_xml_util.value_Of(xmldoc,xpath);
71: xmldom.freeDocument(xmldoc);
72: return retval;
73: Exception
74: when others then
75: xmlparser.freeParser(parser);
72: return retval;
73: Exception
74: when others then
75: xmlparser.freeParser(parser);
76: xmldom.freeDocument(xmldoc);
77: return null;
78: End value_Of;
79:
80: --
84: --
85:
86: FUNCTION convert_CLOB_To_XMLDocument(
87: p_document in CLOB
88: )return xmldom.DOMDocument is
89: --
90: x_xmlDocument xmldom.DOMDocument;
91: l_parser xmlparser.Parser;
92: Begin
86: FUNCTION convert_CLOB_To_XMLDocument(
87: p_document in CLOB
88: )return xmldom.DOMDocument is
89: --
90: x_xmlDocument xmldom.DOMDocument;
91: l_parser xmlparser.Parser;
92: Begin
93: -- CLOB --> xmldom.DOMDocument
94: l_parser := xmlparser.newParser;
89: --
90: x_xmlDocument xmldom.DOMDocument;
91: l_parser xmlparser.Parser;
92: Begin
93: -- CLOB --> xmldom.DOMDocument
94: l_parser := xmlparser.newParser;
95: xmlparser.ParseCLOB(l_parser,p_document);
96: x_xmlDocument := xmlparser.getDocument(l_parser);
97: xmlparser.freeParser(l_parser);
105: --
106:
107: FUNCTION get_All_EOs_List
108: (p_transaction_document in CLOB
109: ) return xmlDOM.DOMNodeList is
110: --
111: l_parser xmlparser.Parser;
112: -- xmlDOM.DOMNodeList
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
108: (p_transaction_document in CLOB
109: ) return xmlDOM.DOMNodeList is
110: --
111: l_parser xmlparser.Parser;
112: -- xmlDOM.DOMNodeList
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
109: ) return xmlDOM.DOMNodeList is
110: --
111: l_parser xmlparser.Parser;
112: -- xmlDOM.DOMNodeList
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
110: --
111: l_parser xmlparser.Parser;
112: -- xmlDOM.DOMNodeList
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
118: l_AM_Node xmlDOM.DOMNode;
111: l_parser xmlparser.Parser;
112: -- xmlDOM.DOMNodeList
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
118: l_AM_Node xmlDOM.DOMNode;
119: l_TXN_Node xmlDOM.DOMNode;
112: -- xmlDOM.DOMNodeList
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
118: l_AM_Node xmlDOM.DOMNode;
119: l_TXN_Node xmlDOM.DOMNode;
120: --
113: l_TransCache_NodeList xmlDOM.DOMNodeList;
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
118: l_AM_Node xmlDOM.DOMNode;
119: l_TXN_Node xmlDOM.DOMNode;
120: --
121: Begin
114: l_EO_NodeList xmlDOM.DOMNodeList;
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
118: l_AM_Node xmlDOM.DOMNode;
119: l_TXN_Node xmlDOM.DOMNode;
120: --
121: Begin
122: --
115: -- xmlDOM.DOMNode
116: rootNode xmlDOM.DOMNode;
117: l_TransCache_Node xmlDOM.DOMNode;
118: l_AM_Node xmlDOM.DOMNode;
119: l_TXN_Node xmlDOM.DOMNode;
120: --
121: Begin
122: --
123: l_parser := xmlparser.newParser;
120: --
121: Begin
122: --
123: l_parser := xmlparser.newParser;
124: rootNode := xmldom.makeNode(xmldom.getDocumentElement(convert_CLOB_To_XMLDocument(p_transaction_document)));
125: -- Now get the
126: l_TransCache_NodeList :=xmldom.getChildrenByTagName(xmldom.makeElement(rootNode),'TransCache');
127: l_TransCache_Node :=xmldom.item(l_TransCache_NodeList,0);
128: -- Now get the
122: --
123: l_parser := xmlparser.newParser;
124: rootNode := xmldom.makeNode(xmldom.getDocumentElement(convert_CLOB_To_XMLDocument(p_transaction_document)));
125: -- Now get the
126: l_TransCache_NodeList :=xmldom.getChildrenByTagName(xmldom.makeElement(rootNode),'TransCache');
127: l_TransCache_Node :=xmldom.item(l_TransCache_NodeList,0);
128: -- Now get the
129: l_AM_Node :=xmldom.getFirstChild(l_TransCache_Node);
130: -- Now get the Node and get its Sibling -->
123: l_parser := xmlparser.newParser;
124: rootNode := xmldom.makeNode(xmldom.getDocumentElement(convert_CLOB_To_XMLDocument(p_transaction_document)));
125: -- Now get the
126: l_TransCache_NodeList :=xmldom.getChildrenByTagName(xmldom.makeElement(rootNode),'TransCache');
127: l_TransCache_Node :=xmldom.item(l_TransCache_NodeList,0);
128: -- Now get the
129: l_AM_Node :=xmldom.getFirstChild(l_TransCache_Node);
130: -- Now get the Node and get its Sibling -->
131: l_TXN_Node :=xmldom.getNextSibling(xmldom.getFirstChild(l_AM_Node));
125: -- Now get the
126: l_TransCache_NodeList :=xmldom.getChildrenByTagName(xmldom.makeElement(rootNode),'TransCache');
127: l_TransCache_Node :=xmldom.item(l_TransCache_NodeList,0);
128: -- Now get the
129: l_AM_Node :=xmldom.getFirstChild(l_TransCache_Node);
130: -- Now get the Node and get its Sibling -->
131: l_TXN_Node :=xmldom.getNextSibling(xmldom.getFirstChild(l_AM_Node));
132: l_EO_NodeList := xmldom.getElementsByTagName(xmldom.makeElement(l_TXN_Node),'EO');
133: return l_EO_NodeList;
127: l_TransCache_Node :=xmldom.item(l_TransCache_NodeList,0);
128: -- Now get the
129: l_AM_Node :=xmldom.getFirstChild(l_TransCache_Node);
130: -- Now get the Node and get its Sibling -->
131: l_TXN_Node :=xmldom.getNextSibling(xmldom.getFirstChild(l_AM_Node));
132: l_EO_NodeList := xmldom.getElementsByTagName(xmldom.makeElement(l_TXN_Node),'EO');
133: return l_EO_NodeList;
134: End get_All_EOs_List;
135:
128: -- Now get the
129: l_AM_Node :=xmldom.getFirstChild(l_TransCache_Node);
130: -- Now get the Node and get its Sibling -->
131: l_TXN_Node :=xmldom.getNextSibling(xmldom.getFirstChild(l_AM_Node));
132: l_EO_NodeList := xmldom.getElementsByTagName(xmldom.makeElement(l_TXN_Node),'EO');
133: return l_EO_NodeList;
134: End get_All_EOs_List;
135:
136: --
138: -- |----------------------------< test_Primary_Key >---------------------------------|
139: -- -------------------------------------------------------------------------
140: --
141: FUNCTION test_Primary_Key(
142: p_EO_Row_Node xmldom.DOMNode
143: ,p_primaryKey in varchar
144: ,p_primarykey_Value in varchar
145: ) return boolean is
146: x_match boolean;
143: ,p_primaryKey in varchar
144: ,p_primarykey_Value in varchar
145: ) return boolean is
146: x_match boolean;
147: l_primary_key_NodeList xmldom.DOMNodeList;
148: l_temp_Node xmldom.DOMNode;
149: l_node_Value varchar2(1024);
150: Begin
151: x_match :=false;
144: ,p_primarykey_Value in varchar
145: ) return boolean is
146: x_match boolean;
147: l_primary_key_NodeList xmldom.DOMNodeList;
148: l_temp_Node xmldom.DOMNode;
149: l_node_Value varchar2(1024);
150: Begin
151: x_match :=false;
152: -- Get the list of children whose name is = p_primaryKey
149: l_node_Value varchar2(1024);
150: Begin
151: x_match :=false;
152: -- Get the list of children whose name is = p_primaryKey
153: l_primary_key_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(p_EO_Row_Node),p_primaryKey);
154: if (xmldom.getLength(l_primary_key_NodeList) > 0) then
155: for i in 1..xmldom.getLength(l_primary_key_NodeList) loop
156: -- For each node in list extract its Text & compare with expected value
157: l_temp_Node := xmldom.getFirstChild(xmldom.item(l_primary_key_NodeList,i-1));
150: Begin
151: x_match :=false;
152: -- Get the list of children whose name is = p_primaryKey
153: l_primary_key_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(p_EO_Row_Node),p_primaryKey);
154: if (xmldom.getLength(l_primary_key_NodeList) > 0) then
155: for i in 1..xmldom.getLength(l_primary_key_NodeList) loop
156: -- For each node in list extract its Text & compare with expected value
157: l_temp_Node := xmldom.getFirstChild(xmldom.item(l_primary_key_NodeList,i-1));
158: l_node_Value := xmldom.getNodeValue(l_temp_Node);
151: x_match :=false;
152: -- Get the list of children whose name is = p_primaryKey
153: l_primary_key_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(p_EO_Row_Node),p_primaryKey);
154: if (xmldom.getLength(l_primary_key_NodeList) > 0) then
155: for i in 1..xmldom.getLength(l_primary_key_NodeList) loop
156: -- For each node in list extract its Text & compare with expected value
157: l_temp_Node := xmldom.getFirstChild(xmldom.item(l_primary_key_NodeList,i-1));
158: l_node_Value := xmldom.getNodeValue(l_temp_Node);
159: -- if node's text matches expected value return true else continue
153: l_primary_key_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(p_EO_Row_Node),p_primaryKey);
154: if (xmldom.getLength(l_primary_key_NodeList) > 0) then
155: for i in 1..xmldom.getLength(l_primary_key_NodeList) loop
156: -- For each node in list extract its Text & compare with expected value
157: l_temp_Node := xmldom.getFirstChild(xmldom.item(l_primary_key_NodeList,i-1));
158: l_node_Value := xmldom.getNodeValue(l_temp_Node);
159: -- if node's text matches expected value return true else continue
160: if l_node_Value = p_primarykey_Value then
161: return true;
154: if (xmldom.getLength(l_primary_key_NodeList) > 0) then
155: for i in 1..xmldom.getLength(l_primary_key_NodeList) loop
156: -- For each node in list extract its Text & compare with expected value
157: l_temp_Node := xmldom.getFirstChild(xmldom.item(l_primary_key_NodeList,i-1));
158: l_node_Value := xmldom.getNodeValue(l_temp_Node);
159: -- if node's text matches expected value return true else continue
160: if l_node_Value = p_primarykey_Value then
161: return true;
162: end if; -- End of if l_Node_Value = p_primarykey_Value
171: -- |----------------------------< check_Primary_Keys >---------------------------------|
172: -- -------------------------------------------------------------------------
173: --
174: FUNCTION check_Primary_Keys(
175: p_EO_Row_Node xmldom.DOMNode
176: ,p_pk_1 in varchar default null
177: ,p_value_1 in varchar default null
178: ,p_pk_2 in varchar default null
179: ,p_value_2 in varchar default null
308: ,p_value_4 in varchar default null
309: ,p_pk_5 in varchar default null
310: ,p_value_5 in varchar default null
311: )return varchar2 is
312: -- xmlDOM.DOMNodeList
313: l_EO_NodeList xmlDOM.DOMNodeList;
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
309: ,p_pk_5 in varchar default null
310: ,p_value_5 in varchar default null
311: )return varchar2 is
312: -- xmlDOM.DOMNodeList
313: l_EO_NodeList xmlDOM.DOMNodeList;
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
317: l_EORowNode xmlDOM.DOMNode;
310: ,p_value_5 in varchar default null
311: )return varchar2 is
312: -- xmlDOM.DOMNodeList
313: l_EO_NodeList xmlDOM.DOMNodeList;
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
317: l_EORowNode xmlDOM.DOMNode;
318: l_desired_Node xmlDOM.DOMNode;
311: )return varchar2 is
312: -- xmlDOM.DOMNodeList
313: l_EO_NodeList xmlDOM.DOMNodeList;
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
317: l_EORowNode xmlDOM.DOMNode;
318: l_desired_Node xmlDOM.DOMNode;
319: -- varchar2
312: -- xmlDOM.DOMNodeList
313: l_EO_NodeList xmlDOM.DOMNodeList;
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
317: l_EORowNode xmlDOM.DOMNode;
318: l_desired_Node xmlDOM.DOMNode;
319: -- varchar2
320: l_Node_Name varchar2(1024);
313: l_EO_NodeList xmlDOM.DOMNodeList;
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
317: l_EORowNode xmlDOM.DOMNode;
318: l_desired_Node xmlDOM.DOMNode;
319: -- varchar2
320: l_Node_Name varchar2(1024);
321: x_return_value varchar2(1024);
314: l_desired_NodeList xmlDOM.DOMNodeList;
315: -- xmlDOM.DOMNode
316: l_EO_Node xmlDOM.DOMNode;
317: l_EORowNode xmlDOM.DOMNode;
318: l_desired_Node xmlDOM.DOMNode;
319: -- varchar2
320: l_Node_Name varchar2(1024);
321: x_return_value varchar2(1024);
322: -- Boolean
328: if p_EO_name is not null then
329: -- get the list of all Children that are EOs
330: l_EO_NodeList := get_All_EOs_List(p_transaction_document);
331:
332: if (xmldom.getLength(l_EO_NodeList) > 0) then -- Some EOs are retrieved
333: for i in 1..xmldom.getLength(l_EO_NodeList) loop
334: l_EO_Node :=xmldom.item(l_EO_NodeList,i-1);
335: -- Get the Name of the EO
336: l_Node_Name :=xmldom.getAttribute(xmldom.makeElement(l_EO_Node),'Name');
329: -- get the list of all Children that are EOs
330: l_EO_NodeList := get_All_EOs_List(p_transaction_document);
331:
332: if (xmldom.getLength(l_EO_NodeList) > 0) then -- Some EOs are retrieved
333: for i in 1..xmldom.getLength(l_EO_NodeList) loop
334: l_EO_Node :=xmldom.item(l_EO_NodeList,i-1);
335: -- Get the Name of the EO
336: l_Node_Name :=xmldom.getAttribute(xmldom.makeElement(l_EO_Node),'Name');
337: -- if it is the desired EO then proceed to filter else process next EONode
330: l_EO_NodeList := get_All_EOs_List(p_transaction_document);
331:
332: if (xmldom.getLength(l_EO_NodeList) > 0) then -- Some EOs are retrieved
333: for i in 1..xmldom.getLength(l_EO_NodeList) loop
334: l_EO_Node :=xmldom.item(l_EO_NodeList,i-1);
335: -- Get the Name of the EO
336: l_Node_Name :=xmldom.getAttribute(xmldom.makeElement(l_EO_Node),'Name');
337: -- if it is the desired EO then proceed to filter else process next EONode
338: if l_Node_Name = p_EO_name then
332: if (xmldom.getLength(l_EO_NodeList) > 0) then -- Some EOs are retrieved
333: for i in 1..xmldom.getLength(l_EO_NodeList) loop
334: l_EO_Node :=xmldom.item(l_EO_NodeList,i-1);
335: -- Get the Name of the EO
336: l_Node_Name :=xmldom.getAttribute(xmldom.makeElement(l_EO_Node),'Name');
337: -- if it is the desired EO then proceed to filter else process next EONode
338: if l_Node_Name = p_EO_name then
339: -- We get the Row Node with the assumption that there is only 1 EORow for an EO
340: -- Later if we need to fetch Multiple EoRows we need do the following
338: if l_Node_Name = p_EO_name then
339: -- We get the Row Node with the assumption that there is only 1 EORow for an EO
340: -- Later if we need to fetch Multiple EoRows we need do the following
341: -- 1. Get the EORow identifier
342: -- 2. xmldom.getChildrenByTagName(xmldom.makeElement(l_EO_Node),
344: l_EORowNode := xmldom.getNextSibling(xmldom.getFirstChild(l_EO_Node));
345: l_is_desired_EORow := check_Primary_Keys(l_EORowNode
346: ,p_pk_1
340: -- Later if we need to fetch Multiple EoRows we need do the following
341: -- 1. Get the EORow identifier
342: -- 2. xmldom.getChildrenByTagName(xmldom.makeElement(l_EO_Node),
343: -- 3. Repeat the following steps for every EORow node.
344: l_EORowNode := xmldom.getNextSibling(xmldom.getFirstChild(l_EO_Node));
345: l_is_desired_EORow := check_Primary_Keys(l_EORowNode
346: ,p_pk_1
347: ,p_value_1
348: ,p_pk_2
353: ,p_value_4
354: ,p_pk_5
355: ,p_value_5);
356: if l_is_desired_EORow = true then -- Checks if the EORow passes the primary key filter
357: l_desired_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(l_EORowNode),p_desired_node_value);
358:
359: if (xmldom.getLength(l_desired_NodeList) > 0) then -- Some Desired Nodes are Present
360: l_desired_Node := xmldom.item(l_desired_NodeList,0);
361: l_desired_Node := xmldom.getFirstChild(l_desired_Node);
355: ,p_value_5);
356: if l_is_desired_EORow = true then -- Checks if the EORow passes the primary key filter
357: l_desired_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(l_EORowNode),p_desired_node_value);
358:
359: if (xmldom.getLength(l_desired_NodeList) > 0) then -- Some Desired Nodes are Present
360: l_desired_Node := xmldom.item(l_desired_NodeList,0);
361: l_desired_Node := xmldom.getFirstChild(l_desired_Node);
362: x_return_value := xmldom.getNodeValue(l_desired_Node);
363: return x_return_value;
356: if l_is_desired_EORow = true then -- Checks if the EORow passes the primary key filter
357: l_desired_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(l_EORowNode),p_desired_node_value);
358:
359: if (xmldom.getLength(l_desired_NodeList) > 0) then -- Some Desired Nodes are Present
360: l_desired_Node := xmldom.item(l_desired_NodeList,0);
361: l_desired_Node := xmldom.getFirstChild(l_desired_Node);
362: x_return_value := xmldom.getNodeValue(l_desired_Node);
363: return x_return_value;
364: end if; -- End of if that checks if we have any Desired Nodes inside this EORow
357: l_desired_NodeList := xmldom.getChildrenByTagName(xmldom.makeElement(l_EORowNode),p_desired_node_value);
358:
359: if (xmldom.getLength(l_desired_NodeList) > 0) then -- Some Desired Nodes are Present
360: l_desired_Node := xmldom.item(l_desired_NodeList,0);
361: l_desired_Node := xmldom.getFirstChild(l_desired_Node);
362: x_return_value := xmldom.getNodeValue(l_desired_Node);
363: return x_return_value;
364: end if; -- End of if that checks if we have any Desired Nodes inside this EORow
365:
358:
359: if (xmldom.getLength(l_desired_NodeList) > 0) then -- Some Desired Nodes are Present
360: l_desired_Node := xmldom.item(l_desired_NodeList,0);
361: l_desired_Node := xmldom.getFirstChild(l_desired_Node);
362: x_return_value := xmldom.getNodeValue(l_desired_Node);
363: return x_return_value;
364: end if; -- End of if that checks if we have any Desired Nodes inside this EORow
365:
366: end if; -- End of if that Checks if the EORow passes the primary key filter