generating flat file from xml file
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
generating flat file from xml file
Hi,
I have an .xsd and .xml file. I have created a xml file definition with .xsd file.
Now i want to know what are the stage that i have to use to generate the data from xml file to a sequential file. i never used xml stages before. I appreciate if anybody can give some inputs.
Thanks.
I have an .xsd and .xml file. I have created a xml file definition with .xsd file.
Now i want to know what are the stage that i have to use to generate the data from xml file to a sequential file. i never used xml stages before. I appreciate if anybody can give some inputs.
Thanks.
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
This is the example xml file that i am using and i am using external source stage before xml input stage
It is compiling but when i run it i get the following errors:
XML_Input_0: Error when checking operator: Could not find input field "shiporder"
Error when checking operator: Could not find input field "orderid"
Error when checking operator: Could not find input field "orderperson"
Error when checking operator: Could not find input field "name"
Error when checking operator: Could not find input field "address"
Error when checking operator: Could not find input field "city"
Error when checking operator: Could not find input field "country"
Error when checking operator: Could not find input field "title"
Error when checking operator: Could not find input field "note"
Error when checking operator: Could not find input field "quantity"
Error when checking operator: Could not find input field "price"
can you please tell me the reason?
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
This is the example xml file that i am using and i am using external source stage before xml input stage
It is compiling but when i run it i get the following errors:
XML_Input_0: Error when checking operator: Could not find input field "shiporder"
Error when checking operator: Could not find input field "orderid"
Error when checking operator: Could not find input field "orderperson"
Error when checking operator: Could not find input field "name"
Error when checking operator: Could not find input field "address"
Error when checking operator: Could not find input field "city"
Error when checking operator: Could not find input field "country"
Error when checking operator: Could not find input field "title"
Error when checking operator: Could not find input field "note"
Error when checking operator: Could not find input field "quantity"
Error when checking operator: Could not find input field "price"
can you please tell me the reason?
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
i am using the source method as specific program and for source program, i am giving the path of the xml file. and under format tab iam using all delimiters and quotes as none. In the xml input stage, under the input and output tabs iam using url/path and selecting the column as shiporder , since it is at the start of the xml file.
You want the source program to simply be "ls" (list)....and that sends the "name" of the XML documents into the XMLInput Stage. Search around for xml, or check out my blog link below -- I have the full syntax there for the "ls" for reading XML...
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
kirankto79,
I gave you an example to use the sequential file to pull in the xml instead of to use the Folder stage as Craig suggested.
For sequential file, just define the whole file as one large column, e.g. xmldoc, varchar 2048, then in your xml_input_02 Input tab's XML Source Column select the "xmldoc".
I gave you an example to use the sequential file to pull in the xml instead of to use the Folder stage as Craig suggested.
For sequential file, just define the whole file as one large column, e.g. xmldoc, varchar 2048, then in your xml_input_02 Input tab's XML Source Column select the "xmldoc".
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It's pretty easy to handle XML in parallel. You don't use the sequential file unless you want to stream the data into the xml stage as a full xml document record. I wouldn't recommend that. You should be able to give it a path to the xml document. You can use the list approach in a previous post to do that.