public static String addTypeInformation( @Nonnull String type, @Nonnull Version version, @Nonnull byte[] xmlBytes ) throws Exception {
JsonNode tree = new ObjectMapper().readTree( new String( xmlBytes, Charsets.UTF_8 ) );
Map<String, JsonNode> newProps = new LinkedHashMap<String, JsonNode>();
newProps.put( "@type", new TextNode( type ) );
newProps.put( "@version", new TextNode( version.format() ) );
Iterator<Map.Entry<String, JsonNode>> nodeIterator = tree.fields();
while ( nodeIterator.hasNext() ) {
Map.Entry<String, JsonNode> jsonNode = nodeIterator.next();
newProps.put( jsonNode.getKey(), jsonNode.getValue() );