I have a seriously annoying problem. My company uses castor to marshall and unmarshall xml. I'm working on integrating with another company and it looks like their xml parser requires attributes to be single-quoted. Castor is hardcoded to use double quotes. Whoops!
Does anyone know of a utility (preferrably a java library) which can safely convert these quotes?
Si开发者_如何学Gomple regexps are not a preferred solution because it will become extremely complicated and buggy when trying to fix escaped double quotes and unescaped single quotes inside the attribute values themselves. Plus I'd rather not spend the time writing and debugging such a util if one already exists.
Thanks Alastair
I don't think you're going to find an off-the-shelf serializer that does this. My suggestion (if you can't persuade your business partner to adopt XML standards) would be to find an open-source serializer (e.g. the Saxon one) and customize it.
精彩评论