alek-sys / sublimetext_indentxml

Plugin for Sublime Text editor for reindenting XML and JSON files
MIT License
534 stars 136 forks source link

Not indenting the following XML correctly #80

Closed amit4got closed 8 years ago

amit4got commented 8 years ago

Thanks for this plugin! Really helpful right now for me. Unfortunately I don't have time to look into it now, as my knowledge of Python is quite limited, but the following XML does not indent correctly. Nothing major!

What the plugin returns:

<Transaction>
    <SequenceNumber>155</SequenceNumber>
    <BeginDateTime>2012-09-11T15:15:48.8233175+01:00</BeginDateTime>
    <RetailTransaction>
        <LineItem>
            <SequenceNumber>1</SequenceNumber>
            <Sale>

                <ItemID>2</ItemID>
                <Quantity UnitOfMeasureCode="Kg" Units="0.25">1</Quantity></Sale>
        </LineItem>
    </RetailTransaction>
</Transaction>

What the plugin should return:

<Transaction>
    <SequenceNumber>1</SequenceNumber>
    <BeginDateTime>2015-09-30T11:15:48.8233175+01:00</BeginDateTime>
    <RetailTransaction>
        <LineItem>
            <SequenceNumber>1</SequenceNumber>
            <Sale>
                <ItemID>1</ItemID>
                <Quantity UnitOfMeasureCode="Kg" Units="0.25">1</Quantity>
            </Sale>
        </LineItem>
    </RetailTransaction>
</Transaction>

:)

alek-sys commented 8 years ago

There is a weird non-visible symbol after , that is the reason. So your source XML is not well-formed. Exclude this symbol and formatting will work.

image