mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 10:40:37 +00:00
Parse XML into tree for processing.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37785 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7c8eda0462
commit
22d1969783
2 changed files with 24 additions and 11 deletions
|
@ -84,20 +84,25 @@ didStartElement: (NSString*)elementName
|
|||
|
||||
// FIXME: We should use proper memory management here
|
||||
AUTORELEASE(element);
|
||||
|
||||
if (key != nil)
|
||||
if ([@"document" isEqualToString: elementName])
|
||||
{
|
||||
[currentElement setElement: element forKey: key];
|
||||
currentElement = element;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For Arrays
|
||||
[currentElement addElement: element];
|
||||
if (key != nil)
|
||||
{
|
||||
[currentElement setElement: element forKey: key];
|
||||
}
|
||||
else
|
||||
{
|
||||
// For Arrays
|
||||
[currentElement addElement: element];
|
||||
}
|
||||
currentElement = element;
|
||||
}
|
||||
|
||||
// Maintain the stack...
|
||||
[stack addObject: currentElement];
|
||||
currentElement = element;
|
||||
|
||||
[stack addObject: currentElement];
|
||||
}
|
||||
|
||||
- (void) parser: (NSXMLParser*)parser
|
||||
|
@ -105,7 +110,10 @@ didStartElement: (NSString*)elementName
|
|||
namespaceURI: (NSString*)namespaceURI
|
||||
qualifiedName: (NSString*)qName
|
||||
{
|
||||
currentElement = [stack lastObject];
|
||||
[stack removeLastObject];
|
||||
if (![@"document" isEqualToString: elementName])
|
||||
{
|
||||
currentElement = [stack lastObject];
|
||||
[stack removeLastObject];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue