Page 1 of 3

Problem with XML job

Posted: Tue May 25, 2010 3:56 pm
by nani1974
Hi,
I am getting this error in my XML job.....anyone...please help me out

TEST..XML_Input_1: Unable to resolve prefix 'xs'.
pattern = '/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element/xs:complexType/xs:attribute'(Unknown URI, 15, 143)
Remaining tokens: ('/')

Thanks in Advance
Kumar

Posted: Tue May 25, 2010 4:07 pm
by eostic
Usually it means that your xml contains namespaces (the xs: is actually in your xml document, in front of the element and attribute names), and is in your xpath (look at the description property of each column on your xmlInput Stage output link), but you don't have the namespace declared in the namespace section.......look in the transformation settings tab for the namespace declaration property box and do a "load" of the same table definition that used for import of metadata on your output link.

Ernie

NAME SPACE ISSUE

Posted: Wed May 26, 2010 8:16 am
by nani1974
Hi Eostic,
Thanks for your reply.
I added the name space,but still i am getting same error,the name space should be same as description in output link?,,i tried to paste the same what ever i have in description and run the job then i was getting a different error (TEST..XML_Input_1: The transformation XSLT stylesheet is invalid) again i changed and did a direct load from the same table defination but getting same error like before ....
TEST..XML_Input_1: Unable to resolve prefix 'xs'.
pattern = '/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element/xs:complexType/xs:attribute'(Unknown URI, 15, 143)
Remaining tokens: ('/')

Thanks
Kumar

Posted: Wed May 26, 2010 8:49 am
by anbu
You have not defined xs in your namespace.

Can you show your namespace declaration?

Posted: Wed May 26, 2010 9:04 am
by nani1974
Hi,
this is namespace i load from the table defination.

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

Thanks
Kumar

Posted: Wed May 26, 2010 9:15 am
by Aquilis
Having declaring above mentioned namespace declaration, do Load the metadata from same XML data file (or with XSD, if you have) in output link columns Tab too.

Posted: Wed May 26, 2010 9:30 am
by anbu
Did you declare this in Transformation settings in Output?

Posted: Wed May 26, 2010 9:32 am
by nani1974
Hi,
I loaded the same XML data file in the output columns..but i added only two columns 'name' and 'attribute'..you think is that a problem.

Posted: Wed May 26, 2010 9:36 am
by nani1974
hi,
The description for the two columns are

/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element/xs:complexType/xs:attribute/@name
/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element/xs:complexType/xs:attribute

Posted: Wed May 26, 2010 9:38 am
by nani1974
hi anbu,
Yes i declare the same in trasformation settings in output.

Posted: Wed May 26, 2010 1:35 pm
by nani1974
hi,
I have 'XSD' layout with column attributes like this:....................
<xs:element name="Cart" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="HC_ID" form="unqualified" type="xs:string" />
<xs:attribute name="STATUS" form="unqualified" type="xs:string" />

And i have main 'XML' metadata like this ..............

<?xml version="1.0"?>
<CompressableData>
<PMxml><ProductsAndRelations xmlns="http://tempuri.org/ProductsAndRelations.xsd">
<Cart HC_ID="-9" PKG_HC_ID="0" CONTRACT="" FID_NAME="193" QUANTITY="1" STATUS="Void" ACTION="10" HC_CATEGORY="" HC_SUB_CATEGORY=""

Can any one please suggest how to proceed with this kind of data,because i have put 'XML' data in UNIX box but i cannot understand how to read the data and how to load the columns in datastage,,when i try to load through table defination i am not getting all the field names like regular XML tree,,so my main question is how to load columns and how to read the data from the 'XML' metadata which i kept in UNIX box.

Posted: Wed May 26, 2010 2:28 pm
by eostic
It "looks" like you have xml inside of xml...meaning...you have a very primitve document called "CompressableData" with one element called PMxml, and it contains itself.....another xml document. It's an interesting technique that comes up once in awhile, most often when people want to pass complete xml documents as arguments inside another protocol which is itself also xml (such as SOAP). That's why you see all the escaped stuff (&lt).

Use two XMLInput Stages. Separate them with a Transformer, just in case some confusions occur with xpath laying around (clear out the Description property on the output link of the intermediate Transformer).

Your first XMLInput Stage will just have one column. PXxml. Give it a longvarchar and some long length that will pick up the whole document that it contains. Put /CompressableData/PXxml/text() in the Description on the output link of your XMLInput Stage (for now I will assume that you know how to pick up this xml document from disk or message queue and feed it into XMLInput)

Then in your second XMLInput Stage you will use the "actual" metadata that has Contract and Quantity and Status and all those other pieces of information.

Probably try to debug this separately first. Have one job with the first xmlInput Stage that writes the output to a file. Once you have that working, then build a job that gets the saved xml content parsed correctly...then put them together.

Ernie

Posted: Thu May 27, 2010 8:14 am
by nani1974
hi Ernie,
Its qiute complex job ernie, and also this is my first time dealing with XML data.
I am reading the file as single row, but the question is how to add the fields...i mean i should add the fields manually, because when i import the table defination i am not able to read fields in a tree like regular XML file, so how to add the particular fields and how data can parse into different fields.

Posted: Thu May 27, 2010 9:20 am
by eostic
Please read again my prior entry. If the data coming in looks like you have pasted, then it is one xml document "inside" the other....you need two xml stages...one after the other in succession.

Ernie

Posted: Thu May 27, 2010 9:37 am
by nani1974
hi,
I did exactly as you mentioned my job is like this...
folder-XMLInput-XMLinput-Trasformer-Seqfile.
i read file in a single row in first input stage and i pass it on to second input stage and in the output of second XML input stage i manually added the fields ("description for output is /CompressableData/PXxml/text()")and trying to run the job then i am getting this error

Abnormal termination of stage TEST..XML_Input_1 detected