Plsqlap_Document_API Overview¶
The package Plsqlap_Document_API is meant as a replacement for the deprecated package Plsqlap_Record_API. A PL/SQL AP Document is a dynamic data structure that corresponds to a document modeled in a serverpackage model in Developer Studio. A document consist of simple and compound attributes. A simple attribute (or just an attribute) is of a given type and contains a value. A compound attribute (an aggregate) can contain just a single document or a collection of documents (an array).
Some operations modeled in Developer Studio take array of documents as argument rather then a single document. PL/SQL AP Document allows also creation of an array of documents.
Document handling¶
Developer Studio generates Meta data for each modeled document. This Meta data is available in the middle tire (in Java), but not in the database layer. Therefore this is developers responsibility to handle proper document structure. Any discrepancy from the Meta data definition will result in runtime errors.
In communication between layers documents are serialized to and from IFS XML. IFS XML is just a subset of XML. The framework will normally serialize attribute names to upper case XML tag names with underscores, but it is possible to override default behavior using properties in Developer Studio. Therefore all names in PL/SQL AP Document are case sensitive.
A PL/SQL AP Document is implemented as an in-memory collection of elements, so for performance reasons every operation that can be performed on any element or level in the structure is always performed in the scope of the main (root) document.
Re-writing code to use PL/SQL AP Documents instead of the obsolete Records API is quite straight forward, but may sometimes require changes in order of creating the structure. For example it is possible to add a record as an aggregate to another record where both records are created independently, while the aggregated document has to be created in scope of the main document.
Element names¶
Because PL/SQL AP Documents are serialized to/from XML and the document element names then correspond to XML element (tag) names, there are some limitations on element names defined in the XML specification:
- Element names are case-sensitive
- Element names must start with a letter or underscore
- Element names cannot start with the letters xml (or XML, or Xml, etc)
- Element names can contain letters, digits, hyphens, underscores, and periods
- Element names cannot contain spaces
The Plsqlap_Document_API package validates element names according to the above rules.
Examples¶
Creating a Record with some simple attributes:
rec_ := PLSQLAP_Record_API.New_record('TEST_ORDER');
PLSQLAP_Record_API.Set_Value(rec_, 'COMPANY', 'AB', PLSQLAP_Record_API.dt_Text);
PLSQLAP_Record_API.Set_Value(rec_, 'ORDER_NO', 10001, PLSQLAP_Record_API.dt_Integer);
PLSQLAP_Record_API.Set_Value(rec_, 'DELIVERY_DATE', date_, PLSQLAP_Record_API.dt_Date);
Corresponding code that uses the PL/SQL AP Document API:
doc_ := PLSQLAP_Document_API.New_Document('TEST_ORDER');
PLSQLAP_Document_API.Add_Attribute(doc_, 'COMPANY', 'AB');
PLSQLAP_Document_API.Add_Attribute(doc_, 'ORDER_NO', 10001, type_ => PLSQLAP_Document_API.TYPE_INTEGER);
PLSQLAP_Document_API.Add_Attribute(doc_, 'DELIVERY_DATE', date_, type_ => PLSQLAP_Document_API.TYPE_DATE);
Adding an aggregate to a Record:
agg_ := PLSQLAP_Record_API.New_record('ADDRESS');
PLSQLAP_Record_API.Set_Value(agg_, 'STREET', 'Gullbergs Strandgata 15', PLSQLAP_Record_API.dt_Text);
PLSQLAP_Record_API.Set_Value(agg_, 'CITY', 'Gothenburg', PLSQLAP_Record_API.dt_Text);
Plsqlap_Record_API.Add_Aggregate(rec_, 'DELIVERY_ADDR', agg_);
Adding an aggregate to a Document:
id_ := PLSQLAP_Document_API.Add_Aggregate(doc_, 'DELIVERY_ADDR', 'ADDRESS');
PLSQLAP_Document_API.Add_Attribute(doc_, 'STREET', 'Gullbergs Strandgata 15', id_);
PLSQLAP_Document_API.Add_Attribute(doc_, 'CITY', 'Gothenburg', id_);
Note the difference when adding aggregates. When working with Record API you just create a new Record and add it to the main Record first when it is complete. Quite often developers create new functions that simply return the newly created record that is supposed to be added as an aggregate to another record. This approach will not work with documents. Everything has to be always created in the context of the main document, so the document has to be passed as an IN OUT
parameter to such subroutine.
Adding an array to a Record:
FOR i_ in 1..3 LOOP
det_ := PLSQLAP_Record_API.New_record('ITEM');
PLSQLAP_Record_API.Set_Value(det_, 'PROD_ID', 'C0'||i_, PLSQLAP_Record_API.dt_Text);
PLSQLAP_Record_API.Set_Value(det_, 'AMOUNT', 100*i_, PLSQLAP_Record_API.dt_Integer);
PLSQLAP_Record_API.Add_Array(rec_,'ORDER_ITEMS', det_);
END LOOP;
Adding an array to a Document:
arr_ := PLSQLAP_Document_API.Add_Array(doc_, 'ORDER_ITEMS');
FOR i_ in 1..3 LOOP
id_ := PLSQLAP_Document_API.Add_Document(doc_, 'ITEM', arr_);
PLSQLAP_Document_API.Add_Attribute(doc_, 'PROD_ID', 'C0'||i_, id_);
PLSQLAP_Document_API.Add_Attribute(doc_, 'AMOUNT', 100*i_, id_, PLSQLAP_Document_API.TYPE_INTEGER);
END LOOP;
Even is the main goal of Plsqlap_Document_API package is creation and maintenance of documents that are supposed to be sent and retrieved using methods in Plsqlap_Server_API, it is also possible to use the package to work with XML documents that contain additional information and/or don't comply to IFS XML specification.
Procedure Add_Xml_Attribute can be used to add optional XML attributes to an arbitrary element in the structure. Because of that all Add_Attribute methods exist as both procedures and functions that return ID of the attribute that can then be sent as parameter to Add_Xml_Attribute. Those additional XML attributes will be present in the XML created with the To_Xml procedure if the xml_attrs_ parameter is set to TRUE
.
By default IFS XML contains additional level for aggregates and arrays ('DELIVERY_ADDR
' and 'ORDER_ITEMS
' in examples above). To skip this additional level when creating an XML document set the value of the agg_level_ parameter to FALSE
in call to To_Xml.
Fetching values from a Document can be done in several ways. While the Record API has practically only one method Get_Value and handling of different types has to be done by the developer, the PL/SQL AP Document API offers a version for each type. All Get_Value functions require ID of the attribute they are supposed to fetch value form. The ID can be obtained in several ways. Functions Find_Element_Id and Get_Element_Id return ID of a named attribute within a document, but they can also search in deep in the structure if the path_ parameter is representing a search path with slashes ('/
') as name separators. If the path_ is pointing an element within an array, the first element in the array will be referred. The Find_Element_Id function will return NULL
if the element is not found, while the Get_Element_Id will raise an exception in the same situation. There are also overloaded versions of all Get_Value functions that take path_ instead of ID as argument - those function just call Find_Element_Id internally. Note that those versions of functions can return NULL
in two situations: the value of the searched attribute is NULL or the attribute is not found.
Especially when working with arrays it can be necessary to iterate through all elements in the array. The function Get_Child_Elements returns a collection (a table) with a list of of all child element IDs of a given element. An overloaded version of this function takes path_ as argument.
Some examples of how to fetch values:
val_ := PLSQLAP_Document_API.Get_Value(doc_, PLSQLAP_Document_API.Get_Element_Id(doc_, 'COMPANY'));
dbms_output.put_line('COMPANY='||val_);
val_ := PLSQLAP_Document_API.Get_Value(doc_, PLSQLAP_Document_API.Get_Element_Id(doc_, 'ORDER_ITEMS/ITEM/PROD_ID'));<br/>dbms_output.put_line('First PRODUCT ID='||val_);
id_ := PLSQLAP_Document_API.Get_Element_Id(doc_, 'ORDER_ITEMS');
list_ := PLSQLAP_Document_API.Get_Child_Elements(doc_, id_);
for i in 1..list_.count loop
list2_ := PLSQLAP_Document_API.Get_Child_Elements(doc_, list_(i));
for j in 1..list2_.count loop
id_ := list2_(j);
if PLSQLAP_Document_API.Get_Name(doc_, id_) = 'AMOUNT' then
num_val_ := PLSQLAP_Document_API.Get_Number_Value(doc_, id_);
dbms_output.put_line('AMOUNT('||i||')='||num_val_);
end if;
end loop;
end loop;
The above example will raise an exception if any of those searched attributes can not be found. The same block can be written as follow using the overloaded versions of functions:
val_ := PLSQLAP_Document_API.Get_Value(doc_, 'COMPANY'); -- will return NULL if COMPANY not found
dbms_output.put_line('COMPANY='||val_);
val_ := PLSQLAP_Document_API.Get_Value(doc_, 'ORDER_ITEMS/ITEM/PROD_ID'); -- will return NULL if the attribute can not be found
dbms_output.put_line('First PRODUCT ID='||val_);
list_ := PLSQLAP_Document_API.Get_Child_Elements(doc_, 'ORDER_ITEMS'); -- will return empty collection if ORDER_ITEMS can not be found
for i in 1..list_.count loop
list2_ := PLSQLAP_Document_API.Get_Child_Elements(doc_, list_(i));
for j in 1..list2_.count loop
id_ := list2_(j);
if PLSQLAP_Document_API.Get_Name(doc_, id_) = 'AMOUNT' then
num_val_ := PLSQLAP_Document_API.Get_Number_Value(doc_, id_);
dbms_output.put_line('AMOUNT('||i||')='||num_val_);
end if;
end loop;
end loop;
Data Types and Constants¶
Constants defining possible data types of attributes:
TYPE_TEXT |
Text represented by VARCHAR2 or CLOB in PL/SQL |
TYPE_INTEGER |
Integer represented by NUMBER in PL/SQL |
TYPE_FLOAT |
Float represented by NUMBER in PL/SQL |
TYPE_BOOLEAN |
Boolean represented as BOOLEAN in PL/SQL |
TYPE_BINARY |
Binary represented as BLOB in PL/SQL |
TYPE_DATE |
Date represented as DATE in PL/SQL |
TYPE_TIME |
Time represented as DATE in PL/SQL |
TYPE_TIMESTAMP |
Timestamp represented as DATE in PL/SQL |
TYPE_COMPOUND |
Denotes a compound attribute, i.e. an aggregate or array |
TYPE_DOCUMENT |
Denotes element (document) of a compound attribute |
Public types:
Element_ID |
Used to represent ID of any element in the document structure. |
Document |
Record type representing the entire document. Note that content of the record is an implementation detail and may not be directly changed or accessed. |
Child_Table |
Collection (TABLE) of element IDs that represent child (nested) elements of a given element. Child elements to a document on any level are attributes, simple or compound. Child elements to a compound attribute are documents. Simple attributes do not have any child elements. |
Xml_Attribute |
Record type representing an optional XML attribute (not used by the IFS framework). The record contains only two fields:name VARCHAR2(200),<br/> value VARCHAR2(4000) |
Xml_Attr_Table |
Collection (TABLE) of Xml_Attribute that represents all optional XML attributes for a given element. |
Public methods¶
Create a new document¶
FUNCTION New_Document (
name_ IN VARCHAR2,
array_ IN BOOLEAN DEFAULT FALSE,
namespace_ IN VARCHAR2 DEFAULT NULL ) RETURN Document
PROCEDURE New_Document (
main_ OUT Document,
name_ IN VARCHAR2,
array_ IN BOOLEAN DEFAULT FALSE,
namespace_ IN VARCHAR2 DEFAULT NULL )
Parameters:
- name_ - The name of the document. It has to be the same as the name of the corresponding document modeled in Developer Studio. Note that the name is case sensitive.
- array_ - If
TRUE
create an array of documents rather then a single document. - namespace_ - optional namespace name.
- Returns an instance of newly created document.
Add an attribute to a document¶
FUNCTION Add_Attribute (
main_ IN OUT Document,
name_ IN VARCHAR2,
value_ IN <one of: VARCHAR2, CLOB, BOOLEAN, BLOB>,
parent_id_ IN Element_Id DEFAULT NULL,
namespace_ IN VARCHAR2 DEFAULT NULL ) RETURN Element_Id
PROCEDURE Add_Attribute (
main_ IN OUT Document,
name_ IN VARCHAR2,
value_ IN <one of: VARCHAR2, CLOB, BOOLEAN, BLOB>,
parent_id_ IN Element_Id DEFAULT NULL,
namespace_ IN VARCHAR2 DEFAULT NULL )
FUNCTION Add_Attribute (
main_ IN OUT Document,
name_ IN VARCHAR2,
value_ IN <one of: NUMBER, DATE>,
parent_id_ IN Element_Id DEFAULT NULL,
type_ IN VARCHAR2 DEFAULT <depends on value type>,
namespace_ IN VARCHAR2 DEFAULT NULL ) RETURN Element_Id
PROCEDURE Add_Attribute (
main_ IN OUT Document,
name_ IN VARCHAR2,
value_ IN <one of: NUMBER, DATE>.
parent_id_ IN Element_Id DEFAULT NULL,
type_ IN VARCHAR2 DEFAULT <depends on value type>,
namespace_ IN VARCHAR2 DEFAULT NULL )
Parameters:
- main_ - Document instance created by New_Document.
- name_ - The name of the attribute. It has to be the same as the name of the corresponding attribute modeled in Developer Studio. Note that the name is case sensitive.
- value_ - The value of the attribute. Binary values (
BLOB
) are always encoded to Base64 text. If the text is shorter then 32767 bytes, it will be stored asVARCHAR2
, even if the parameter's data type isCLOB
orBLOB
. - parent_id_ - The ID of the parent document the attribute is supposed to be added to. If
NULL
the attribute will be added to the main document, i.e. on the top level in the structure. - type_ - Subtype specification for versions of the subroutine taking
NUMBER
andDATE
as data type for value_. Allowed subtypes forNUMBER
areTYPE_INTEGER
andTYPE_FLOAT
(default) and forDATE
areTYPE_DATE
,TYPE_TIME
andTYPE_TIMESTAMP
(default). - namespace_ - optional namespace name.
In case you need to add optional XML attributes you can use the function instead of procedure to directly obtain ID of the created attribute that can be used in call to Add_Xml_Attribute.
Add an aggregate (a compound attribute) to a document¶
FUNCTION Add_Aggregate (
main_ IN OUT Document,
name_ IN VARCHAR2,
doc_name_ IN VARCHAR2,
parent_id_ IN Element_Id DEFAULT NULL,
namespace_ IN VARCHAR2 DEFAULT NULL,
doc_namespace_ IN VARCHAR2 DEFAULT NULL ) RETURN Element_Id
FUNCTION Add_Aggregate (
main_ IN OUT Document,
doc_name_ IN VARCHAR2,
parent_id_ IN Element_Id DEFAULT NULL,
namespace_ IN VARCHAR2 DEFAULT NULL,
doc_namespace_ IN VARCHAR2 DEFAULT NULL ) RETURN Element_Id
Parameters:
- main_ - Document instance created by New_Document.
- name_ - The name of the aggregate (compound attribute). It has to be the same as the name of the corresponding aggregate modeled in Developer Studio. Note that the name is case sensitive. If not given the aggregate name will be the same as the encapsulated document's name.
- doc_name_ - Document name of the document stored within this aggregate. The name has to be the same as the corresponding document name modeled in Developer Studio. Note that the name is case sensitive.
- parent_id_ - The ID of the parent document the attribute is supposed to be added to. If
NULL
the attribute will be added to the main document, i.e. on the top level in the structure. - namespace_ - optional aggregate namespace name.
- doc_namespace_ - optional document namespace name.
- Returns ID of the created document.
Note that there is no difference between an aggregate and an array with one element. This method does the same as a sequence Add_Array and then Add_Document.
Add an array (a compound attribute) to a document¶
FUNCTION Add_Array (
main_ IN OUT Document,
name_ IN VARCHAR2,
parent_id_ IN Element_Id DEFAULT NULL,
namespace_ IN VARCHAR2 DEFAULT NULL ) RETURN Element_Id
Parameters:
- main_ - Document instance created by New_Document.
- name_ - The name of the array (compound attribute). It has to be the same as the name of the corresponding array modeled in Developer Studio. Note that the name is case sensitive.
- parent_id_ - The ID of the parent document the attribute is supposed to be added to. If
NULL
the attribute will be added to the main document, i.e. on the top level in the structure. - namespace_ - optional namespace name.
- Returns ID of the created array.
Add a document to an array (compound attribute)¶
FUNCTION Add_Document (
main_ IN OUT Document,
name_ IN VARCHAR2,
array_id_ IN Element_Id DEFAULT NULL,
namespace_ IN VARCHAR2 DEFAULT NULL) RETURN Element_Id
Parameters:
- main_ - Document instance created by New_Document.
- name_ - Document name of the document that is supposed to be added to an array. The name has to be the same as the corresponding document name modeled in Developer Studio. Note that the name is case sensitive.
- array_id_ - The ID of the array the document is supposed to be added to. If
NULL
and the main document is created as an array (with array_ argument to the New_Document set toTRUE
), the document will be added to the top level array. - namespace_ - optional namespace name.
- Returns ID of the created document.
Add an optional XML attribute to an element¶
Note that XML attributes are not used by the IFS framework.
PROCEDURE Add_Xml_Attribute (
main_ IN OUT Document,
id_ IN Element_Id,
name_ IN VARCHAR2,
value_ IN VARCHAR2 )
PROCEDURE Add_Xml_Attribute (
main_ IN OUT Document,
name_ IN VARCHAR2,
value_ IN VARCHAR2 )
Parameters:
- main_ - Document instance created by New_Document.
- id_ - ID of the element the XML attribute is supposed to be added to. The version of procedure without the
id_
parameter adds the attribute to the main (root) element. - name_ - The name of the XML attribute.
- value_ - The value of the XML attribute.
Return ID of the root element¶
FUNCTION Get_Root_Id (
main_ IN Document ) RETURN Element_Id
Parameters:
- main_ - Document instance created by New_Document.
- Returns the ID of the root element (document) in the structure. The document is implicitly created by the New_Document function.
Retrieve the total number of elements¶
FUNCTION Get_Element_Count (
main_ IN Document ) RETURN BINARY_INTEGER
Parameters:
- main_ - Document instance created by New_Document.
- Returns the total number of elements in the document. The document is implicitly created by the New_Document function.
Find an ID of an element denoted by its path¶
FUNCTION Find_Element_Id (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN Element_Id
FUNCTION Find_Element_Id (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN Element_Id
FUNCTION Get_Element_Id (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN Element_Id
FUNCTION Get_Element_Id (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN Element_Id
Parameters:
- main_ - Document instance created by New_Document.
- path_ - The path pointing out the searched element. It can be just a name of an attribute within a document, if parent_id_ points out a document, main or not, or it can be a sequence of names separated by slashes ('
/
') starting from the element given by parent_id_. The algorithm will start searching in child elements to the element given by parent_id_, so the name of the top level element shall not be included. If the search path includes elements within an array, the first element in the array will be taken. - parent_id_ - The ID of the element the search is supposed to start from. Versions without this parameter will start searching from the main (root) document, i.e. the top level in the structure.
- Returns ID of the searched element. If not found the Find_Element_Id function will return
NULL
while Get_Element_Id will raise an exception.
Obtain value of an attribute¶
FUNCTION Get_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN VARCHAR2
FUNCTION Get_Number_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN NUMBER
FUNCTION Get_Boolean_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN BOOLEAN
FUNCTION Get_Date_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN DATE
FUNCTION Get_Time_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN DATE
FUNCTION Get_Timestamp_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN DATE
FUNCTION Get_Clob_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN CLOB
FUNCTION Get_Blob_Value (
main_ IN Document,
id_ IN Element_Id ) RETURN BLOB
Parameters:
- main_ - Document instance created by New_Document.
- id_ - The ID of the attribute value is supposed to be fetched from.
- Returns value of the given attribute. Note that binary values (
BLOB
) are supposed to be stored as a Base64 encoded text. For Boolean valuesNULL
is treated asFALSE
.
Overloaded versions that internally call Find_Element_Id:
FUNCTION Get_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN VARCHAR2
FUNCTION Get_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN VARCHAR2
FUNCTION Get_Number_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN NUMBER
FUNCTION Get_Number_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN NUMBER
FUNCTION Get_Boolean_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN BOOLEAN
FUNCTION Get_Boolean_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN BOOLEAN
FUNCTION Get_Date_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN DATE
FUNCTION Get_Date_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN DATE
FUNCTION Get_Time_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN DATE
FUNCTION Get_Time_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN DATE
FUNCTION Get_Timestamp_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN DATE
FUNCTION Get_Timestamp_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN DATE
FUNCTION Get_Clob_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN CLOB
FUNCTION Get_Clob_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN CLOB
FUNCTION Get_Blob_Value (
main_ IN Document,
path_ IN VARCHAR2,
parent_id_ IN Element_Id ) RETURN BLOB
FUNCTION Get_Blob_Value (
main_ IN Document,
path_ IN VARCHAR2 ) RETURN BLOB
Parameters:
- main_ - Document instance created by New_Document.
- path_ - The path pointing out the searched element. It can be just a name of an attribute within a document, if parent_id_ points out a document, main or not, or it can be a sequence of names separated by slashes ('
/
') starting from the element given by parent_id_. The algorithm will start searching in child elements to the element given by parent_id_ or from root for versions of functions not expecting the parent_id_ parameter, so the name of the top level element shall not be included. If the search path includes elements within an array, the first element in the array will be taken. - parent_id_ - The ID of the element the search is supposed to start from. Versions without this parameter will start searching from the main (root) document, i.e. the top level in the structure.
- Returns value of the given attribute. Note that binary values (
BLOB
) are supposed to be stored as a Base64 encoded text. For Boolean valuesNULL
value is treated asFALSE
. If the element given by the path_ parameter is not found, those functions will returnNULL
.
Change value of an attribute¶
PROCEDURE Set_Value (
main_ IN OUT Document,
id_ IN Element_Id,
value_ IN <one of: VARCHAR2, CLOB, BOOLEAN, BLOB> )
PROCEDURE Set_Value (
main_ IN OUT Document,
id_ IN Element_Id,
value_ IN <one of: NUMBER, DATE>,
type_ IN VARCHAR2 DEFAULT <depends on value type> )
Parameters:
- main_ - Document instance created by New_Document.
- id_ - The ID of the attribute.
- value_ - The new value of the attribute. Binary values (
BLOB
) are always encoded to Base64 text. If the text is shorter then 32767 bytes, it will be stored asVARCHAR2
, even if the parameter's data type isCLOB
orBLOB
. - type_ - Subtype specification for versions of the subroutine taking
NUMBER
andDATE
as data type for value_. Allowed subtypes forNUMBER
areTYPE_INTEGER
andTYPE_FLOAT
(default) and forDATE
areTYPE_DATE
,TYPE_TIME
andTYPE_TIMESTAMP
(default).
Obtain value of an optional XML attribute¶
FUNCTION Get_Xml_Attribute (
main_ IN Document,
id_ IN Element_Id,
name_ IN VARCHAR2 ) RETURN VARCHAR2
FUNCTION Get_Xml_Attribute (
main_ IN Document,
name_ IN VARCHAR2 ) RETURN VARCHAR2
Parameters:
- main_ - Document instance created by New_Document.
- id_ - ID of the element the XML attribute is supposed to be fetched from. The version of function without the
id_
parameter fetches the attribute from the main (root) element. - name_ - The name of the XML attribute.
- Returns value of the optional XML attribute or
NULL
if not found.
Fetch all optional XML attributes for an element¶
FUNCTION Get_Xml_Attributes (
main_ IN Document,
id_ IN Element_Id ) RETURN Xml_Attr_Table
FUNCTION Get_Xml_Attributes (
main_ IN Document ) RETURN Xml_Attr_Table
Parameters:
- main_ - Document instance created by New_Document.
- id_ - ID of the element XML attributes are supposed to be fetched from. The version of function without the
id_
parameter fetches attributes from the main (root) element. - Returns collection (table) with all optional XML attributes for given element.