groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Cargal (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-7874) XmlSlurper is dropping root node attributes
Date Fri, 24 Jun 2016 19:24:16 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mike Cargal updated GROOVY-7874:
--------------------------------
    Summary: XmlSlurper is dropping root node attributes  (was: XmlSlurper is dropping root
noe attributes)

> XmlSlurper is dropping root node attributes
> -------------------------------------------
>
>                 Key: GROOVY-7874
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7874
>             Project: Groovy
>          Issue Type: Bug
>          Components: XML Processing
>    Affects Versions: 2.4.3, 2.4.6, 2.4.7
>         Environment: MAC OS X, and Windows
>            Reporter: Mike Cargal
>            Priority: Minor
>
> When parsing an XML document with XmlSlurper, some attributes are being dropped.
> Script: ==============
> import groovy.xml.*
> scSrc = '''<?xml version="1.0" encoding="UTF8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:cargal.net/myNS"
xmlns="urn:cargal.net/myNS">
>     <xsd:element name="test" type="xsd:string"/>
> </xsd:schema>
> '''
> schema = new XmlSlurper().parseText(scSrc)
> println "schema.@attributeFormDefault=${schema.@attributeFormDefault}"
> println "schema.@xmlns=${schema.@xmlns}"
> println new XmlUtil().serialize(schema)
> ===============================
> results: =========================
> schema.@attributeFormDefault=unqualified
> schema.@xmlns=
> <?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:cargal.net/myNS">
>   <xsd:element name="test" type="xsd:string"/>
> </xsd:schema>
> =================================



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

Mime
View raw message