Groovy web console

subscribe to the feed Subscribe
to this
site
xml attribute (via #groovywebconsole)
tweet this snippet Tweet
this
script

xml attribute

Published 2 months ago by nmrao with tags attribute
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def xml = """<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor entityID="https://scspr0269974001.c4.com/saml/metadata" ID="https___scspr0269974001.c2_saml_metadata" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
  <md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" WantAssertionsSigned="true" AuthnRequestsSigned="true">
    <md:SingleLogoutService Location="https://scspr0269974001.company2.com/saml/SingleLogout" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
       <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat>
       <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</md:NameIDFormat>
       <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
       <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>
       <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</md:NameIDFormat>
       <md:AssertionConsumerService Location="https://scspr0269974001.company1.com/saml/SSO" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" isDefault="true" index="0"/>
    <md:AssertionConsumerService Location="https://scspr0269974001.company2.com/saml/SSO" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" index="1"/>
  </md:SPSSODescriptor>
</md:EntityDescriptor>"""
def pxml = new XmlSlurper().parseText(xml)
println pxml.'**'.find{it.name() == 'SingleLogoutService'}.@Location.text()
println pxml.SPSSODescriptor.SingleLogoutService.@Location.text()