groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Wagenleitner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7808) XmlSlurper unprefixed attributes should not be in the default namespace
Date Mon, 04 Apr 2016 21:43:25 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15225115#comment-15225115
] 

John Wagenleitner commented on GROOVY-7808:
-------------------------------------------

Fix for this is included in fix for GROOVY-7781 in [GitHub PR 302|https://github.com/apache/groovy/pull/302].

> XmlSlurper unprefixed attributes should not be in the default namespace
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-7808
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7808
>             Project: Groovy
>          Issue Type: Bug
>          Components: XML Processing
>    Affects Versions: 2.4.6
>            Reporter: John Wagenleitner
>            Priority: Minor
>
> According to https://www.w3.org/TR/xml-names/#defaulting the namespace name for an unprefixed
attribute name always has no value.  Currently when using XmlSlurper unprefixed attributes
have the default namespace.
> {code}
> def xml = '''
> <root xmlns="urn:test">
>     <foo id="7">bar</foo>
> </root>
> '''
> def root = new XmlSlurper(false, true).parseText(xml).declareNamespace(ns: 'urn:test')
> assert root.foo[0].namespaceURI() == 'urn:test'
> assert root.'ns:foo'.text() == 'bar'
> assert root.foo.@id == '7'
> assert root.foo.'@ns:id' == '' // fails returns 7
> assert root.foo.@id[0].namespaceURI() == '' // fails returns 'urn:test'
> {code}
> Based on the specs I believe the following asserts in the [XmlSlurperTest|https://github.com/apache/groovy/blob/c04e4df42ca3ed25570acc730d87807012c39887/subprojects/groovy-xml/src/test/groovy/groovy/util/XmlSlurperTest.groovy#L142-L143]
are incorrect.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message