The XMLSerializer fails for attributes with namespace prefixes on them
Brought to you by:
aalmiray
The XMLSerializer fails for attributes with namespace prefixes on them. The fix is in the processJSONObject method. Make the block that process attributes look like this:
}else if( name.startsWith( "@" ) ){
int colon=name.indexOf(':');
if(colon==-1)
root.addAttribute( new Attribute( name.substring( 1 ), String.valueOf( value ) ) );
else {
root.addAttribute( new Attribute( name.substring( colon+1 ), root.getNamespaceURI(name.substring(0, colon)), String.valueOf( value ) ) );
}
}else if( name.equals( "#text" ) ){
Development of this library has been moved to GitHub since 2010, please report any issues you may find at https://github.com/kordamp/json-lib/issues