Terminologies Translator XPath Functions

Native Format Builder Wizard 6-51 complexType element The href attribute contains the actual location of the data being referred to. It can contain the path to a file in the file system or a pointer primary key to a database entity. Scalable DOM Scalable DOM SDOM, from Oracle XML Developer Kit Oracle XDK, provides scalable and pluggable support for DOM. This removes problems of memory inefficiency, limited scalability, and lack of control over the DOM configuration. Using the lazy materialization mechanism, Oracle XDK only creates nodes that are accessed and frees unused nodes from memory. Applications can process very large XML documents with improved scalability.

6.3.2 Translator XPath Functions

A translator may be required while reading and writing files. This section discusses the following translator XPath functions: ■ doTranslateFromNative Function ■ doTranslateToNative Function ■ doStreamingTranslate Function

6.3.2.1 doTranslateFromNative Function

The doTranslateFromNative XPath function translates input data into XML. The input data can be a string, an attachment element, or a base64Binary element. ora:dotranslateFromNativeinput,nxsdTemplate,nxsdRoot,tar getType ,attachment element? The following table describes the parameters used in the syntax for using this function: Parameter Description input Input data for the XPath function; the data can either be a string data that must be translated, an Oracle File or FTP Adapter attachment, an attachment referring to an external file path, or a base64Binary element. nxsdTemplate NXSD schema to use to translate the input data into XML format. nxsdRoot Root element in the NXSD schema. targetType This parameter decides how the XPath function translates the native data into XML. Must be set to either DOM, or ATTACHMENT or SDOM. If the targetType parameter is: ■ DOM, then the translated data is returned as a DOM. ■ ATTACHMENT, then the translated data is returned as an attachment. If the optional parameter attachmentElement is available to the XPath function, then the XPath function uses the corresponding href attribute to write the translated XML. However, if the parameter is absent, then the XPath function creates a new database-backed attachment and returns that. See Example 6–4 for more details. ■ SDOM, then the translated data is returned as SDOM. You must use this if the returned XML file is huge. 6-52 Oracle Fusion Middleware Users Guide for Technology Adapters Example 6–1 Configuring the XPath Function When the Input Data Is of String Type and Must Be Converted to an XML DOM variables variable… variable name=csv_data type=xsd:string variables assign name=assignCSVData copy from expression=this, is, csv, data… to variable=csv_data copy assign assign name=doTranslateFromNativeCall copy from expression=ora: doTranslateFromNative bpws:getVariableDatacsv_ data,xsdaddress-csv.xsd,Root-Element,DOM to variable=returnVariable query=ns1:Root-Element copy assign In this example: ■ csv_data is a BPEL variable containing CSV data to be translated into XML. ■ xsdaddress-csv.xsd is relative path to the NXSD schema in the project. ■ Root-Element is a root element in the NXSD schema This is optional. ■ returnVariable is the returned XML data as DOM. Example 6–2 When the Input data is an Attachment, Which Must Be Translated to a DOM 1. Define attachmentElement in the schema of the BPEL process, as follows: schema targerNamespace=… element name=attachmentElement complexType attribute name=href type=string complexType element schema 2. Create a variable of type attachment element in the schema of the BPEL process, as follows: variables variable… variable name=attachmentVariable type=client:attachmentElement variables 3. Assign the source file path that you must translate, as follows: assign name=AssignAttachmentReference copy from expression=tmpxpathinaddress.csv to variable=attachmentVariable attachmentElement This parameter is optional. This is the attachment for the returned XML file. Parameter Description