- Регистрация
- 01.10.2016
- Сообщения
- 340
- Благодарностей
- 48
- Баллы
- 28
so i need to create a string in xpath
i need to creat a loop that im already in to grab all the comments
my main string alreay conisit of
but is it posible to next a string in a string befor the second (main string) runs? so i can grab the commentors name and their comment?
if it is what would it look like?
i can grab the whole reply section but then its a jubiled togetehr mess. i need to parse it out neater then it is
basicly i want to grab all of the //div[contains(@class,'UFICommentContent')]
inside the DocumentNode ive grabed
parse out the exsisiting actor name and comment separate them by the charicter,then place a difrent charicter at he end of the string here, then i want and move to the next comment UFICommentContent in the document.... but how do i loop it? im lost on this part?
Код:
//div[contains(@class,'UFICommentContent')]; // every comment wraper
//a[contains(@class,'UFICommentActorName')]; // inside wrapper poster's name for comment
//span[contains(@class,'UFICommentBody')]/span; // inside wraper the post data from that comment
//span/img; // inside wrapper & inside comment body this is incase of emoji or images
my main string alreay conisit of
Код:
string fullPost, postUrl, postText, postAuthor, postTime, postAction, postBody, postComment;
postUrl = postText = postAuthor = postTime = postAction = fullPost = postBody = postComment = string.Empty;
if it is what would it look like?
i can grab the whole reply section but then its a jubiled togetehr mess. i need to parse it out neater then it is
basicly i want to grab all of the //div[contains(@class,'UFICommentContent')]
inside the DocumentNode ive grabed
parse out the exsisiting actor name and comment separate them by the charicter,then place a difrent charicter at he end of the string here, then i want and move to the next comment UFICommentContent in the document.... but how do i loop it? im lost on this part?
Код:
var CommentsBlockNode = doc1.DocumentNode.SelectNodes("//div[contains(@class,'UFICommentContent')]");
var CommentorNameNode = doc1.CommentsBlockNode.SelectSingleNodes("//a[contains(@class,'UFICommentActorName')]");
var CommentorBodyNode = doc1.CommentsBodykNode.SelectNodes("//span[contains(@class,'UFICommentBody')]");