Capitalize XML
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/a465ec83 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/a465ec83 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/a465ec83 Branch: refs/heads/master Commit: a465ec83025a8a3664a1b0f9a28c86021287952a Parents: ef73b77 Author: liu.yu <[email protected]> Authored: Tue Aug 15 11:22:21 2017 +0800 Committer: liu.yu <[email protected]> Committed: Tue Aug 22 11:33:03 2017 +0800 ---------------------------------------------------------------------- docs/odb_user/src/asciidoc/_chapters/load.adoc | 59 +++++++++++++++++++++ 1 file changed, 59 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/a465ec83/docs/odb_user/src/asciidoc/_chapters/load.adoc ---------------------------------------------------------------------- diff --git a/docs/odb_user/src/asciidoc/_chapters/load.adoc b/docs/odb_user/src/asciidoc/_chapters/load.adoc index 087c0dc..6a2eb86 100644 --- a/docs/odb_user/src/asciidoc/_chapters/load.adoc +++ b/docs/odb_user/src/asciidoc/_chapters/load.adoc @@ -637,6 +637,65 @@ odb considers the string following the âemâ character as the path of the fil NOTE: odb does not load rows where the size of the input file is greater than the target database column. +======= +[[load_xml_files]] +== Load XML Files +Trafodion odb supports loading XML files into tables, the key construct for XML files can be an element or an attribute. + +=== Load XML Files Where Data is Stored in Element Nodes + +. Create a table. +``` +./odb64luo -x "create table testxmlload(id int, name char(20))" +``` + +[start=2] +. Suppose you have a xml file where data is stored in element nodes like the following. +``` +-bash-4.1$ cat test.xml +<?xml version="1.0" encoding="UTF-8"?> +<data> +<id>1</id> +<name>hello</name> +</data> +``` + +TIP: To check what will be loaded before loading XML file into table, run the following command +`./odb64luo -l src=test.xml :tgt=testxmlload:xmltag=data:xmldump` + +[start=3] +. Load the test.xml file into the table, run the following command. +``` +./odb64luo -l src=test.xml:tgt=testxmlload:xmltag=data +``` + +TIP: `xmltag=data` means odb will load data from the element nodes. For more information, see <<Data Loading Operators>>. + +=== Load XML Files Where Data is Stored in Attribute Nodes +. Create a table. +``` +./odb64luo -x "create table testxmlload(id int, name char(20))" +``` + +[start=2] +. Suppose you have a XML file where data is stored in attribute nodes like the following. +``` +-bash-4.1$ cat test.xml +<?xml version="1.0" encoding="UTF-8"?> +<data id="1" name="hello"></data> +``` + +TIP: To check what will be loaded before loading XML file into table, run the following command. +`./odb64luo -l src=test.xml:tgt=testxmlload:xmltag=data:xmldump` + +[start=3] +. Load the test.xml file into the table, run the following command. +``` +./odb64luo -l src=test.xml:tgt=testxmlload:xmltag=+data +``` + +TIP: `xmltag=+data` (with a plus sign specified) means odb will load data from the attribute nodes. For more information, see <<Data Loading Operators>>. + <<< == Reduce the ODBC Buffer Size odb allocates memory for the ODBC buffers during load/extract operations based on the max possible length of the
