Closed cksachdev closed 7 years ago
Not at the moment. I can look into it, though.
@eerohele Thanks, looking forward to it. In the meantime, do you know any such tools which can help me canonicalize the xml in osx.
Something like this should work:
$ brew install libxml2
$ xmllint --c14n11 myfile.xml
Provided that you have Homebrew installed.
I've released version 0.3.0, which adds support for canonicalizing XML.
It might take a while for it to appear in Package Control, but when it does, can you please give it a go and let me know whether it works for you?
You can canonicalize a well-formed XML document by selecting "Exalt: Canonicalize Document" from the Sublime Text command palette.
Thanks, It works for me, there is an issue that it removes the CDATA. Here is a test xml
<?xml version="1.0"?>
<theme>
<controller type="data" name="dictionary" id="dictionary" ><![CDATA[{}]]></controller>
</theme>
After canonical run
<theme>
<controller id="dictionary" name="dictionary" type="data">{}</controller>
</theme>
Please check why CDATA is removed, it should just arrange the properties in sorted order and should preserve the content as it is.
It seems that the W3C specification for canonical XML dictates that "CDATA sections are replaced with their character content", so the current behavior is correct.
Anyway, it's libxml2 that does the actual canonicalization, so there's little I can do to modify the behavior.
Is it possible to Canonicalize xml using Exalt? I have seen that lxml is a dependency. I can't find any option to canonicalize xml.