资 源 简 介
Re-write of XmlFormat of the http://code.google.com/p/protobuf-java-format/ project using Dom4j XML toolkit. Unlike XmlFormat, which uses string concatenation to construct XML, Dom4j will correctly escape special characters and follow other XML standards.
Usage:
Compact XML:
String xml = ProtobufToXml.printToString(sampleProto, false);
Pretty XML:
String xml = ProtobufToXml.printToString(sampleProto, true);
Dom4J DOM:
Document doc = ProtobufToXml.print(sampleProto);