xml-navigator

Output formats: readable vs normalized

XmlExtractKit exposes two main output styles.

prettyPrint(): readable output

Best when you want to move XML data into ordinary application code quickly.

Good for

Shape

[
    'offer' => [
        '@attributes' => [
            'id' => '206111',
            'available' => 'true',
        ],
        'name' => 'USB-C Dock',
        'price' => [
            '@value' => '129.90',
            '@attributes' => [
                'currency' => 'USD',
            ],
        ],
        'picture' => [
            'https://cdn.example.test/1.jpg',
            'https://cdn.example.test/2.jpg',
        ],
    ],
]

Rules of thumb

convert(): normalized hierarchy

Best when you want a predictable structure for traversal, wrappers, or internal adapters.

Good for

Shape

[
    'n' => 'feed',
    'a' => [
        'generated_at' => '2026-03-28T09:00:00Z',
    ],
    's' => [
        [
            'n' => 'offer',
            'a' => [
                'id' => '206111',
                'available' => 'true',
            ],
            's' => [
                [
                    'n' => 'name',
                    'v' => 'USB-C Dock',
                ],
                [
                    'n' => 'price',
                    'v' => '129.90',
                    'a' => [
                        'currency' => 'USD',
                    ],
                ],
            ],
        ],
    ],
]

Rules of thumb