XMLTransformer - ConsumeChild

Hi!

I try to create a diagramm based on a XML-file. I am using a changed variant of ProcessDocument. The biggest change I made is removing everything connectred to writing XML, because I only need to read.
My problem is that my programm doesn't read the Child elements. The child in ConsumeChild is always null and the Allocate method for the child -which I overrode- is never called.
Why could that be? What am I missing?

Did you register in your GoXmlReader the transformer for the element type of your child elements?

yes, I did.

this is the ConsumeChild of my node-element

public override void ConsumeChild(Object parent, Object child)
{ base.ConsumeChild(parent, child); ContentNode n = (ContentNode)parent; n.Add(child); }
This is Allocate of the child-element and the transformert is registered:
public override Object Allocate() { Content content = new Content(); return content; }
Content is a herited from GoGroup

Well, that certainly looks OK.

You did set BodyConsumesChildElements to true on your parent element transformer, right? I'm just guessing at what might be wrong, since it isn't obvious to me.

Thanks, for trying to help. Actually it was only a really stupid copy-and-paste mistake, so that I used the same TransformerType twice, for the child and the child’s child.

But there is still a problem. For this XML file:












Both images are created but only the first content element is created.
Why?

Are you saying that the Allocate method for the “content” element type transformer is only called once?

At the moment I am not totally sure about that and just now I can’t reproduce it. What I know for sure is, that ConsumeChild is called once for the node transformer and twice for the content transformer. In both cases the value of small is false.

As soon as I can test it again, I will write more information about how often allocate is called.

So I examined a little bit more, what happens.

The elements got all allocated and the attributes seem to be right. What causes a problem is the fact that ConsumeChild of the node transformer is only called with the first content element as child but not with the second. So it isn't added to the node.
Sorry for confusing with wrong information in the posts before.

We’ll investigate this. Try setting GoXmlReader.UseDOM to true.

Thanks a lot for your help. That helped - also to solve my next problem ;-)

Yes, there’s a bug doing the XML parsing when there are nested elements and when using an XmlTextReader instead of using XML DOM. We’ll fix this for the next release (2.5.3), which should be coming out soon.