문제

I have an Xml tag <com:Id>33638</com:Id> I want to read the value 33638 from the tag, I have parsed the xml string and stored to another string variable but cant read the value using

String id  = 'com:Id'.text();
도움이 되었습니까?

해결책

This works fine:

def t = "<com:Id>33638</com:Id>"
def xml = new XmlParser(false, false).parseText(t)
println xml.text()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top