I am parsing an xml through DOM parser and I have to check that whether a partcular child exists or not in the xml. For example
<Employee>
<Emp>
<Name> A </Name>
<Designation> C </Designation>
<Experience> D </Experience>
</Emp>
<Emp>
<Name> x </Name>
<Designation> y </Designation>
</Emp>
</Employee>
and so on...As you can see "experience" tag is present for some employees and may not be present for other. How I can check wheth开发者_开发知识库er Experience tag is present for any employee or not. Any help is appreciated.
Well this thing can be checked.You can write a piece of code to check this tag is present or not.In case of tag not present you can return some value may be null
.
if([elementName isEqualToString:@"emp"])
{
attributeOfColoumn = [attributeDict objectForKey:@"Experience"];
if([attributeOfColoumn isEqualToString:@""])
{
return yes;
}
}
精彩评论