I have to read specific tag attributes from an XML-file and return them to a Template-Document.
I've finished reading the file itself, now how can I read one tag only and parse its attributes?
<?xml version="1.0" encoding="UTF-8"?>
<instances
name="instance-name"
port="60535"
username="bar"
password="foo"
string_var="barfoo">
some xml (up to 5k lines and 3 k elements i do not need)
</instances>
How can I read the string until I encounter the ">" for instances? And how can I put the values into variables?
Wanted output:
TPAR_PORT = 60535
TPAR_USERNAME = bar
TPAR_PASSWORD = foo
TPAR_INSTANCE = instance-name
By the way it does not matter if the values are with or without single quotes