XML to Avro Converter

Transform XML data into Apache Avro schema format with automatic type detection and sample data generation

XML Input

Avro Schema Output

About Apache Avro

Apache Avro is a data serialization system that provides rich data structures, a compact binary format, and schema evolution capabilities. This tool converts XML data into Avro schema definitions with automatic type detection.

Features

  • Automatic Type Detection: Detects int, long, double, boolean, and string types
  • Nullable Fields: Option to make all fields nullable with union types
  • Custom Schema Names: Specify custom record name and namespace
  • Sample Data: Optionally include sample JSON data for testing
  • Field Sanitization: Ensures field names are valid Avro identifiers

Supported Data Types

int: 32-bit signed integers
long: 64-bit signed integers
double: Double precision floating point
boolean: True/false values
string: Unicode text strings
null: Null values (when nullable)

Example

Input XML:

<products>
  <product>
    <id>1</id>
    <name>Laptop</name>
    <price>999.99</price>
  </product>
</products>

Output Avro Schema:

{
  "type": "record",
  "name": "Record",
  "namespace": "com.example",
  "fields": [
    {
      "name": "id",
      "type": [
        "null",
        "int"
      ],
      "default": null
    },
    {
      "name": "name",
      "type": [
        "null",
        "string"
      ],
      "default": null
    },
    {
      "name": "price",
      "type": [
        "null",
        "double"
      ],
      "default": null
    }
  ]
}

Use Cases

  • Apache Kafka message schemas
  • Hadoop data serialization
  • Apache Spark data processing
  • Data lake storage formats
  • Schema registry integration
  • Cross-language data exchange