开发者

Converting xml attribute double quotes to single quotes (utility needed, pref java)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜