How to generate XML empty element for a numeric field

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
LisaM
Participant
Posts: 6
Joined: Sun Jan 29, 2006 1:38 pm

How to generate XML empty element for a numeric field

Post by LisaM »

Hello Tx friends,

I am trying to generate a XML empty element(with tags) for a numeric field. However, I've got the element omitted when I assigned the value "NONE" in my map rule. Can some one tell me the trick?

Thank you in advance,

Lisa
Lisa
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

I think you need to specify it as a mandatory field. which version are you using?
LisaM
Participant
Posts: 6
Joined: Sun Jan 29, 2006 1:38 pm

Post by LisaM »

It's version 8.0. Do you know where exactly should I specify it as a mandatory field? Where in Type Tree or XSD?

Thanks,

Lisa
Lisa
LisaM
Participant
Posts: 6
Joined: Sun Jan 29, 2006 1:38 pm

Post by LisaM »

It's version 8.0. Do you know where exactly should I specify it as a mandatory field? Where in Type Tree or XSD?

Thanks,

Lisa
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

In the type tree specify the range of the item as 1:1
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

If your xsd specifies the field as optional then you shouldn't be generating empty tags.
LisaM
Participant
Posts: 6
Joined: Sun Jan 29, 2006 1:38 pm

Post by LisaM »

Thanks for the posting...

I have tried to specify the range, it didn't work. (1:1 is default)

In terms of the XSD, it is an element in a sequence. I tried to specify minoccurs = 1 , still not working.

Any idea about what I should do with the XSD to generate the empty tag ?

BTW, if the field is string, I can just simply assign " " and get the empty tag output pefectly. But for numeric, I have nothing but "NONE" to work with...

:(
Lisa
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

Your output should be charater not number. XML is all text.
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

janhess wrote:Your output should be charater not number. XML is all text.
I have not worked in TX. But faced similar prob in XML stage and work aorund was - write null to numeric column and then set the XML property -covert Null to empty as true.

It worked.
Regards,
S. Kirtikumar.
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

Where are you specifying NONE in the rule? If it is at the top level of the element then it is probably omitted. If you do it at the item level for the element you should get your tags but the resulting XML wil be invalid based on your schema which requires a value.
Post Reply