Processing Files with BOM

6-50 Oracle Fusion Middleware Users Guide for Technology Adapters The following is a sample nxsd file: ?xml version= 1.0 encoding= UTF-8 ? xsd:schema xmlns:xsd=http:www.w3.org2001XMLSchema xmlns:nxsd=http:xmlns.oracle.compcbpelnxsd xmlns:tns=http:TargetNamespace.comInboundService targetNamespace=http:TargetNamespace.comInboundService elementFormDefault=qualified attributeFormDefault=unqualified nxsd:parseBom=true nxsd:version=NXSD nxsd:stream=chars nxsd:encoding=UTF8 xsd:element name=Root-Element xsd:complexType xsd:sequence xsd:element name=mydata minOccurs=1 maxOccurs=unbounded nxsd:style=array nxsd:cellSeparatedBy={eol} xsd:complexType xsd:sequence xsd:element name=C1 type=xsd:string nxsd:style=fixedLength nxsd:length=3 xsd:sequence xsd:complexType xsd:element xsd:sequence xsd:complexType xsd:element xsd:schema

6.3 Translator XPath Functions

The translator XPath functions can translate data from a native format such as CSV, fixed-length, tab-delimited, and COBOL Copybook formats to an XML format and from an XML format to a native format. The translator XPath functions are of two types, streaming and non-streaming. The difference is that the streaming translator XPath functions implement the batching transformation approach while the non-streaming XPath functions do not implement the batching transformation approach. With the batching transformation approach, files that are of the order of a few gigabytes GB can be processed without running into memory issues. This section includes the following topics: ■ Section 6.3.1, Terminologies ■ Section 6.3.2, Translator XPath Functions

6.3.1 Terminologies

This section describes the terminologies that you must understand for using translation XPath functions. Attachment Element An attachment element unusually refers to the actual content elsewhere by using an href attribute. The actual content may be present in a file system or in a database table. An attachment is usually represented by using the following schema construct: element name=hrefelement complexType attribute name=href type=string 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.