jwagenleitner / groovy-wslite

Lightweight SOAP and REST webservice clients for Groovy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XML declaration encoding broken when

Trinition opened this issue · comments

When the XML declaration includes an encoding, followed by other attributes, the SOAPClient complains that it doesn't understand the encoding because it's greedily extracting the encoding from the declaration. For example, consider this xml:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

The exception complains that utf-8" standalone="no is not a valid encoding (and I agree).

The problem stems from getCharacterEncodingFromXmlDeclaration() which uses a greedy regular expression to extract the encoding from the declaration. Using a non-greedy wildcard or limiting it to non-quote's would fix it.