remove empty tag from xml output

Hi All,

My problem is output is coming like below.

- <ListOfDtlInstructions>
- <PickticketDtlInstruction>
<PktLineNbr>1000</PktLineNbr>

<SpclInstrNbr>1</SpclInstrNbr>

<SpclInstrType>PT</SpclInstrType>

<SpclInstrCode>A1</SpclInstrCode>

- <PickticketInstrFields>
<SpclInstrDesc>Line 1</SpclInstrDesc>

</PickticketInstrFields>

</PickticketDtlInstruction>

- <PickticketDtlInstruction>
<PktLineNbr>1000</PktLineNbr>

<SpclInstrNbr>2</SpclInstrNbr>

<SpclInstrType>PT</SpclInstrType>

<SpclInstrCode>A2</SpclInstrCode>

- <PickticketInstrFields>
<SpclInstrDesc>Line 1</SpclInstrDesc>

</PickticketInstrFields>

</PickticketDtlInstruction>

- <PickticketDtlInstruction>
<PktLineNbr>1000</PktLineNbr>

<SpclInstrNbr>3</SpclInstrNbr>

<SpclInstrType>PT</SpclInstrType>

<SpclInstrCode>B2</SpclInstrCode>

- <PickticketInstrFields>
<SpclInstrDesc>Line 1</SpclInstrDesc>

</PickticketInstrFields>

</PickticketDtlInstruction>

- <PickticketDtlInstruction>
<PktLineNbr>1000</PktLineNbr>

<SpclInstrNbr>4</SpclInstrNbr>

<SpclInstrType>PT</SpclInstrType>

<SpclInstrCode>C2</SpclInstrCode>

- <PickticketInstrFields>
<SpclInstrDesc>Pack by Store</SpclInstrDesc>

</PickticketInstrFields>

</PickticketDtlInstruction>

</ListOfDtlInstructions>

This blue highlighted area is we are skiping some record based on condition while mapping under LOOP. We do not want this blue line should appear as a output.

Could please help anybody. It’s bit urgent.

Thanks in advance.

bye
Kaushik

check out this post:
http://wmusers.com/forum/showthread.php?t=4704&highlight=remove+empty

Hi,

I wanted to make more clear. XML output is coming below currently.

<ListOfDtlInstructions>
- <PickticketDtlInstruction>
<PktLineNbr>1000</PktLineNbr>
<SpclInstrNbr>1</SpclInstrNbr>
<SpclInstrType>PT</SpclInstrType>
<SpclInstrCode>A1</SpclInstrCode>
- <PickticketInstrFields>
<SpclInstrDesc>Line 1</SpclInstrDesc>
</PickticketInstrFields>
</PickticketDtlInstruction>



</ListOfDtlInstructions>

Output Expected is below

<ListOfDtlInstructions>
- <PickticketDtlInstruction>
<PktLineNbr>1000</PktLineNbr>
<SpclInstrNbr>1</SpclInstrNbr>
<SpclInstrType>PT</SpclInstrType>
<SpclInstrCode>A1</SpclInstrCode>
- <PickticketInstrFields>
<SpclInstrDesc>Line 1</SpclInstrDesc>
</PickticketInstrFields>
</PickticketDtlInstruction>
</ListOfDtlInstructions>


Blue line is coming because we do not want to map field other than Pktline number 1000. Which we have checking using Branch on set of records and sequence.

is heading of child elements ( like <PktLineNbr>, <SpclInstrNbr>, <SpclInstrType> etc.) . How can I remove this null heading from xml output. Thanks for your help.

bye
kr

Is this field in your Schema/DocumentType Mandatory?

You can try this in the documentToXMLString step set “generateRequiredTags=false”


HTH
RMG

How do I check that?

“generateRequiredTags=false” I do not have access to change it. Is WM administrator can help me.

The behavior you’re seeing is due the use of LOOP and an output array. If there are 10 items in the input array the output array will also have 10 items–whether you explicitly map anything to each array element or not.

If you want to conditionally map elements from the input list to an output list you’ll need to do something other than specifying an output array in the LOOP. One possible approach, which will work well if the input list is relatively small (a few hundred items or less), is to use appendToDocumentList to add each element you want to keep to the output array. Another approach is to use one of the Java collection classes to gather the target list and then convert it to an IS document list when the loop is complete.

Thanks for your reply. I just wanted explain how my code is. I am new in webmethods. Need some more help

input array has 12 records, each set of record has 4 line.

Could be LineA = 4
Line B = 4 , so on

i have following.

LOOP on input array
Branch
Sequence on LineA = Line B
MAP ( to output array

For Line A = 4 records it should create 4 line only in output. But It’s creating 4 records with data and remaining 8 records with only element name.

My input array has 50 fields. but I need only 5 fields to my output array. How I can use appendToDocumentList in this case. Could you please help me. I never use it.

Thank you very much.

Before you call appendToDocumentList is the Document mapped empty PickticketDtlInstruction? check there not to have before you append.

Also aren’t you using “pub.xml:documentToXMLString” step which creates xmldata string as output and process it further?

HTH,
RMg

I want to output empty tag like .But i don’t know how to do. Pls help me. Thanks