XML document parsing behaviour with IS

Hi,

I am trying to parse XML document using pub.xml:xmlStringtoXMLNode and pub.xml:xmlNodeToDocument

I have created an IS schema from a DTD and created a corresponding Document Type in IS. According to the structure of the document I do have several document lists inside my “global document”.

To build the logic and navigate through my document, I make extensive use of the LOOP step to loop through my document lists.
While testing my code, I found out that some times some of my LOOP steps were not executed in some situations. And after looking carefully to the XML, I found out that the resulted IS document after parsing didn’t contain a document list when there is only one element in the list which caused the LOOP not being executed.

May be this is not very clear so here is an example:
Let say you have an Order with several line items, parsing will give you

Order
LineItem
LineItem[0]
LineItem[1]

where LineItem is a document list so that your LOOP works fine

now, if you have only one line item in your XML document and even if the associated IS document defines LineItem as a document list, you will get

Order
LineItem

Whiwh cause the LOOP not being executed, now if the parsing give something like

Order
LineItem
LineItem[0]

Even if there is only one element in your document list, the LOOP will be executed.

I don’t know if someone had faced that “problem” before. Is this by design? or a bug in the parser? Is there any fix or do I have to write code to handle the 1 line item case separately!!

Any feedback?

For information, I am using IS 6.1 with Developer 6.1, is this a bug in version 6.1 or was it working fine with 6.0.1 and 4.6?

while using the pub.xml:xmlNodeToDocument service specify in the parameters set arrays (LineItem) and also set the documentTypeName that you are referencing.

This will accomplishes your problem.

Regards,

Thanks RMG,

It worked fine by setting the documentTypeName in pub.xml:xmlNodetoDocument but you have to set the makeArrays property to false and arrays should be null.

\Kacem

yes,i agree with you.In my posting i missed to mention the makeArray=false setting.

Cheers

Hi,
Even this is not working in my case.
I have a very big doc type(Pip3A4 PO).I have the data even, I am trying to convert it to document using xmlNodeToDocument, setting makeArrays false and giving the doctype name.
Even then, it is not giving me list elements.

Can anyone help me in this.

Thanks
Muralidhar B