Groovy XML Parser Dollar Sign in Attribute $
I am using 开发者_如何学JAVAXMLParser to parse an xml document that has the following structure:
<Tag>
<SubTag att1="some.directory.structure.ClassName$InternalClass" att2="value2"/>
</Tag>
I am trying to store the value of att1 in a String with:
def att1Value = root.Tag[0].iterator().toList()[0]['@att1']
However, when I read att1Value, it's value is "some.directory.structure.ClassName". Is Groovy treating the $InternalClass as a variable? How do I capture the whole value of att1?
Thanks.
This code:
xml = '''<Tag>
<SubTag att1="some.directory.structure.ClassName$InternalClass" att2="value2"/>
</Tag>'''
root = new XmlParser().parseText( xml )
att1value = root.SubTag[0].@att1
Gives me the result
"some.directory.structure.ClassName$InternalClass"
精彩评论