문제

I am trying to build some utility to create document model from a string like xpath:

setName(document,"college/class/student[14]@name","Rob"),

so, this function should create nodes and attributes in the document if it doesn't exist and move on if the node already exists.

I am failing to validate and implement the '[14]' part, ie creating 13 blank followed with adding attribute name with value of "Rob". As, there can also be cases of

setName(document,"university/college[2]/class[12]/student[14]@name","Rob")\

Thanks in Advance Tirthankar

도움이 되었습니까?

해결책

You need a recursive parser that is able to handle the indexes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top