Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added syblingElements method

  • Loading branch information...
commit 17bcd0961823c1e14f220c5f52fb20e8f7a7b202 1 parent fa8d284
Blake Watters authored
Showing with 15 additions and 0 deletions.
  1. +5 −0 Classes/Element.h
  2. +10 −0 Classes/Element.m
View
5 Classes/Element.h
@@ -150,6 +150,11 @@
*/
-(NSArray*)childElements;
+/**
+ * An array of child Elements in document order
+ */
+-(NSArray*)syblingElements;
+
/**
* The first child Element for this element (or nil if none).
View
10 Classes/Element.m
@@ -217,6 +217,16 @@ -(NSArray*)childElements{
return kids;
}
+-(NSArray*)syblingElements{
+ NSMutableArray* syblings = [NSMutableArray array];
+ Element* e = self;
+ while (e){
+ [syblings addObject: e];
+ e = e.nextSybling;
+ }
+ return syblings;
+}
+
-(NSDictionary*)contentsOfChildren{
NSMutableDictionary* result = [NSMutableDictionary dictionary];
Element* e = [self firstChild];
Please sign in to comment.
Something went wrong with that request. Please try again.