mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Added -nextElement
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13465 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6f1eb7e388
commit
d9f901a7b1
2 changed files with 32 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-04-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSXML.m: New method ([-nextElement]) to traverse
|
||||
tree skipping non-element nodes.
|
||||
|
||||
Thu Apr 11 15:34:33 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/GSAttributedString.m ([GSMutableAttributedString
|
||||
|
|
|
@ -749,7 +749,7 @@ static NSMapTable *nodeNames = 0;
|
|||
/**
|
||||
* Return the children of this node
|
||||
* <example>
|
||||
* - (GSXMLNode*) nextElement: (GSXMLNode*)node
|
||||
* - (GSXMLNode*) elementRecursive: (GSXMLNode*)node
|
||||
* {
|
||||
* while (node != nil)
|
||||
* {
|
||||
|
@ -759,7 +759,7 @@ static NSMapTable *nodeNames = 0;
|
|||
* }
|
||||
* if ([node children] != nil)
|
||||
* {
|
||||
* node = [self nextElement: [node children]];
|
||||
* node = [self elementRecursive: [node children]];
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
|
@ -853,7 +853,7 @@ static NSMapTable *nodeNames = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* initialisae node
|
||||
* initialise node
|
||||
*/
|
||||
- (id) initWithNamespace: (GSXMLNamespace*) ns name: (NSString*) name
|
||||
{
|
||||
|
@ -993,7 +993,10 @@ static NSMapTable *nodeNames = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* return the next node at this level.
|
||||
* Return the next node at this level. This method can return any type
|
||||
* of node, and it may be more convenient to use the -nextElement node
|
||||
* if you are parsing a document where you wish to ignore non-element
|
||||
* nodes such as whitespace text separating elements.
|
||||
*/
|
||||
- (GSXMLNode*) next
|
||||
{
|
||||
|
@ -1007,6 +1010,26 @@ static NSMapTable *nodeNames = 0;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next element node, skipping past any oyther node types
|
||||
* (such as text nodes). If there is no element node to be returned,
|
||||
* this method returns nil.
|
||||
*/
|
||||
- (GSXMLNode*) nextElement
|
||||
{
|
||||
xmlNodePtr ptr = ((xmlNodePtr)(lib))->next;
|
||||
|
||||
while (ptr->next != NULL)
|
||||
{
|
||||
if (ptr->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
return [GSXMLNode nodeFrom: ptr->next];
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the namespace of the node.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue