pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: none


From: David Philippi
Subject: Re: none
Date: Thu, 15 Aug 2002 18:07:04 +0200
User-agent: KMail/1.4.1

On Thursday 15 August 2002 13:17, Ingo Ruhnke wrote:
> Having a ->next in a child function causes quite weird behaviour:

> <something></something>
> <somethingelse></somethingelse>

> When I pass a function a pointer to 'something', which should do
> something with the content of 'something', I expect it to use the
> 'something' node, not to jump mysteriously to 'somethingelse', which
> it currently does. At best the function shouldn't even have access to
> 'somethingelse', but as far as I understand libxml one cannot forbit
> that. The child function may be freely jump around in the content of
> 'something' and call xmlIsBlankNode() there, thats ok, but it
> shouldn't play around with the something-root-node itself.

I'm calling the factories with what's contained between the tags they shall 
parse. If I find a <primary-button> and call the ButtonFactory with 
cur->children it get's only what's inside the <primary-button> until the 
</primary-button>.
Since multiple buttons ought to be wrapped by a <multiple-button> which is 
also handeld by the ButtonFactory there may be nothing valid in the XML 
block given to the ButtonFactory that is not handeld by the ButtonFactory.
It may jump around in this code as much as it likes as long as it doesn't 
step up in the hierarchy. Everything on the same level or below won't be 
touched by the Controller in any case.

> ScrollerFactory shouldn't care about the child content, neighter
> should ScrollerFactory play around with the root-node.
> The problem is that the factories play around with the root-node, not
> with the child node. The ->children call refers to the parent node.
> <action-axis>   <- this is what the factory caller gets and what the
> ->children is refering to <axis-button> <- this is what factory gets and
> which ->next is called on [...]
>   </axis-button>
> </action-axis>

I'm still unsure what you want to say here. Am I guessing right that a call 
to next on </axis-button> above would set cur to </action-axis> ?
If that's the case then an empty <action-axis> may confuse the parser as is 
but I'm not sure how to fix it.
To make sure we're talking about the same thing - ScrollerFactory e.g. is not 
a single factory but instead an abstract factory for the base class 
containing a collection of concrete factories for the concrete Scrollers.

> Anyway, beside this problem we should either add a
> JumpToNextNonEmptyNode(xmlNodePtr& cur); or find a way to tell libxml
> to skip them automatically. I am currently using a very minimal subset
> of libxml functions, so the chances are very good that it provides a
> way nice ways to handle this.

The design I used bases on the assumption that when I call the factory with 
cur->children it may never step up to the level cur itself is placed unless 
this is done explicitely. If this may happen through a ->next then there's 
something wrong with the code right now.

Bye David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]