Problem with XML job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Problem with XML job

Post 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
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

NAME SPACE ISSUE

Post 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
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

You have not defined xs in your namespace.

Can you show your namespace declaration?
You are the creator of your destiny - Swami Vivekananda
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post 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
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post 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.
Aquilis
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Did you declare this in Transformation settings in Output?
You are the creator of your destiny - Swami Vivekananda
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post 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.
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post 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
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post by nani1974 »

hi anbu,
Yes i declare the same in trasformation settings in output.
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post 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.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post 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.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
nani1974
Premium Member
Premium Member
Posts: 52
Joined: Fri Aug 31, 2007 10:59 am

Post 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
Post Reply