gnustep-dev
[Top][All Lists]
Advanced

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

Re: Unresolved Issues with libxml2


From: Fred Kiefer
Subject: Re: Unresolved Issues with libxml2
Date: Wed, 07 Mar 2012 23:33:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2

On 07.03.2012 21:58, Ivan Vučica wrote:
On Sunday, March 4, 2012, Fred Kiefer wrote:

On 04.03.2012 22:32, Ivan Vučica wrote:

Subclassing NSXMLElement and overriding +[NSXMLDocument
replacementClassForClass:] (still nonfunctional in GNUstep)


Sorry, I am mostly interested in this small part of your mail. Why do you
think that this method is still non-functional? Do you have an example,
where it fails or results in unexpected behaviour?
Last time I tried your OPML test application that part seemed to work.


Last time I tried it, it didn't, and I thought I checked this before
sending mail. I'm certain I did, and I'm (nearly) certain it still doesn't
work right, since I just rebuilt base and the OPML app, and attempting to
set node text fails (doubleclick on the node):

2012-03-07 21:43:59.194 OPML[14244] Problem posting notification:
<NSException: 0x99e0c9c>  NAME:NSInvalidArgumentException
REASON:NSXMLNode(instance) does not recognize attributeForName: INFO:(null)

From what I can see, I'm calling attributeForName: only on
OPMLOutlineXMLNode instances, so seeing NSXMLNode is definitely wrong.

Ah, now I see where the misunderstanding comes from. Here is your code for replacementClassForClass:


+(Class)replacementClassForClass:(Class)cls
{
    if(cls == [NSXMLElement class])
    {
        return [OPMLOutlineXMLElement class];
    }
    if(cls == [NSXMLDocument class])
    {
        return [OPMLOutline class];
    }
    return cls;
}

As you can see you are not dealing with the class NSXMLNode itself. Now the big difference is that the current GNUstep code comes up with other nodes as the Apple code. Most nodes are NSXMLElement and get handled correctly by your code, but some of them are normal NSXMLNode and these get ignored. Now what the message you get shows is that the parse or rather the whole libxml2 has a slightly different view on nodes than Apples code has. In libxml2 even the string value of a node ends up as a child node. What we could try to do is to filter out these extra nodes in our wrapper code, but this will be a huge amount of work.

Does my explanation help you to come to a common understanding of what is going on here?

Fred



reply via email to

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