Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to remove all namespaces #6

Open
mingfang opened this issue Sep 2, 2015 · 2 comments
Open

Unable to remove all namespaces #6

mingfang opened this issue Sep 2, 2015 · 2 comments

Comments

@mingfang
Copy link

mingfang commented Sep 2, 2015

I'm using this parser to parse a SAML AuthResponse am unable to remove all the namespaces.
Here is a short script to demonstrate the problem.

local xml = require("xml")

local data = xml.load [[
<samlp:Response ID='_cefdb557d60e0ba08b37' IssueInstant='2015-09-02T05:45:46Z' Destination='http://rebelsoft.com:81/saml/acs' xmlns:samlp='urn:oasis:names:tc:SAML:2.0:protocol' Version='2.0'>
  <saml:Issuer xmlns:saml='urn:oasis:names:tc:SAML:2.0:assertion'>http://rebelsoft.com:81</saml:Issuer>
</samlp:Response>
]]

xml.removeNamespace(data, 'urn:oasis:names:tc:SAML:2.0:protocol')
xml.removeNamespace(data, 'urn:oasis:names:tc:SAML:2.0:assertion')

print(xml.dump(data))

In this demo, the first removeNamespace() works, but not the second one.

@mingfang
Copy link
Author

mingfang commented Sep 2, 2015

I think the problem is in https://github.com/lubyk/xml/blob/master/xml/init.lua
After line 237 we need this

if type(v) == "table" then
   lib.removeNamespace(v, key)
end 

@gaspard
Copy link
Member

gaspard commented Nov 22, 2016

@mingfang Could you create a test and a pull request ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants