Oracle® Application Server
XML Java API Reference
10g Release 2 (10.1.2)

Part no. B12024-03
September 2004

oracle.xml.transx
Interface TransX


public interface TransX

TransX Utility API


Method Summary
 void close()
          Help reclaim used resources.
 int load(java.lang.String file)
          Load a dataset on a file.
 int load(java.net.URL url)
          Load a dataset on a URL.
 void open(java.lang.String constr, java.lang.String user, java.lang.String pwd)
          Start a data loading session.
 void setLoadingMode(int mode)
          Set the operation mode on duplicates.
 void setPreserveWhitespace(boolean flag)
          Tell the loader to treat whitespaces to be significant.
 void setValidationMode(boolean flag)
          Set the validation mode.
 java.io.Reader unload(java.lang.String table, java.lang.String[] columns)
          Unload a dataset.
 void unload(java.lang.String table, java.lang.String[] columns, java.io.Writer out)
          Unload a dataset.
 boolean validate(java.lang.String file)
          Validate a dataset on a file.
 boolean validate(java.net.URL url)
          Validate a dataset on a URL.

 

Method Detail

open

public void open(java.lang.String constr,
                 java.lang.String user,
                 java.lang.String pwd)
          throws java.sql.SQLException
Start a data loading session. This methods establishs a database connection to the given JDBC URL to be used for subsequent load() call(s).
Parameters:
constr - a database url of the form jdbc:Oracle:<driver_type>:@[additional_parameters]
user - the database user on whose behalf the connection is being made
pwd - the user's password
java.sql.SQLException
See Also:
open(java.lang.String, java.lang.String, java.lang.String), close()

load

public int load(java.lang.String file)
         throws java.lang.Exception
Load a dataset on a file. A database connection must have been established by a preceding call to open().
Parameters:
file - a file name
Returns:
the total number of inserted and/or updated rows
java.lang.Exception
See Also:
open(java.lang.String, java.lang.String, java.lang.String)

load

public int load(java.net.URL url)
         throws java.lang.Exception
Load a dataset on a URL. A database connection must have been established by a preceding call to open().
Parameters:
url - a URL
Returns:
the total number of inserted and/or updated rows
java.lang.Exception
See Also:
open(java.lang.String, java.lang.String, java.lang.String)

unload

public java.io.Reader unload(java.lang.String table,
                             java.lang.String[] columns)
                      throws java.lang.Exception
Unload a dataset. A database connection must have been established by a preceding call to open().
Parameters:
table - a table name
columns - column names, means * when null
Returns:
the dataset in XML
java.lang.Exception
See Also:
open(java.lang.String, java.lang.String, java.lang.String), load(java.lang.String)

unload

public void unload(java.lang.String table,
                   java.lang.String[] columns,
                   java.io.Writer out)
            throws java.lang.Exception
Unload a dataset. A database connection must have been established by a preceding call to open().
Parameters:
table - a table name
columns - column names, means * when null
out - a Writer to write the dataset in XML to
java.lang.Exception
See Also:
open(java.lang.String, java.lang.String, java.lang.String), load(java.lang.String)

close

public void close()
           throws java.sql.SQLException
Help reclaim used resources. This method should be called after loading is complete.
java.sql.SQLException
See Also:
open(java.lang.String, java.lang.String, java.lang.String)

setLoadingMode

public void setLoadingMode(int mode)
Set the operation mode on duplicates. In the case when there are one or more existing rows in the database whose values in the key columns are the same as those in the dataset to be loaded, the loader (1)skips duplicate rows, (2)updates them or (3)throws an exception, depending on the current loading mode specified by this method. The loader by default skips duplicates. i.e. The flag is SKIP.
Parameters:
mode - a loading mode
See Also:
LoadingMode

setPreserveWhitespace

public void setPreserveWhitespace(boolean flag)
Tell the loader to treat whitespaces to be significant. The flag is false by default: If this call is not made or if false is passed to the flag argument, the loader ignores the type of whitespace characters in the dataset and load them as space characters. Consecutive whitespace characters in the dataset are treated as one space character.
Parameters:
flag - true for exceptions, false otherwise.

setValidationMode

public void setValidationMode(boolean flag)
Set the validation mode. The flag is true by default: If this call is not made or if true is passed to the flag argument, the loader performs validation of the dataset format against the canonical schema definition on each load() call. The validation mode should be disabled only if the dataset has already been validated.
Parameters:
flag - determines whether the loader should be validating
See Also:
validate(java.lang.String)

validate

public boolean validate(java.lang.String file)
                 throws java.lang.Exception
Validate a dataset on a file. Once the dataset has been validated, the validation mode can safely be disabled.

The instance document does not have to be opened for validation.

Parameters:
file - a file name
Returns:
true if successfully validated, false otherwise
java.lang.Exception
See Also:
setValidationMode(boolean), validate(java.lang.String)

validate

public boolean validate(java.net.URL url)
                 throws java.lang.Exception
Validate a dataset on a URL. Once the dataset has been validated, the validation mode can safely be disabled.

The instance document does not have to be opened for validation.

Parameters:
url - a URL string
Returns:
true if successfully validated, false otherwise
java.lang.Exception
See Also:
validate(java.lang.String)

Oracle® Application Server
XML Java API Reference
10g Release 2 (10.1.2)

Part no. B12024-03
September 2004

Copyright © 2003, 2004, Oracle. All rights reserved.