Sometimes it is required to manage xml namespaces, sort or order a xml by element names in alphabetical order, sort xml repeating element by value in alphabetical order, add SOAP 1.1 and 1.2 envelopes to a xml, prettify a xml, convert xml to json, remove nil or nillable or null elements of a xml and remove all the annotations from a xsd.
All the actions are listed below. Paste xml in below textarea and perform appropriate action.
Click here to try
XML may contain one or more namespaces and each element may belong to one namespace. The namespace can be declared at element level or at root element level. If declared at root element leven the each namespace is assigned with a prefix ex., xmlns:ns1="https://myxml.in/" and all elements belonging to that namespace are prefixed with the prefix value (ns1:name).
Sometimes these namespaces become a problem to handle and need to be removed, both declaration at element level or at root level along with prefixes if used.
XML namespace prefixes
XML with namespace removed
Click here to try Remove namespaces from XML option
Each SOAP 1.1 document has Envelope and Body elements. The SOAP 1.1 Envelope and Body elements are declared under http://schemas.xmlsoap.org/soap/envelope/ namespace. The actual XML content is embedded inside the SOAP 1.1 Envelope. The Envelope is same for all SOAP documents but the body content changes.
Add the SOAP 1.1 Envelope for any XML content with click of a button.
Click here to try Adding SOAP 1.1 Envelope to XML option
Each SOAP 1.2 document has Envelope and Body elements. The SOAP 1.2 Envelope and Body elements are declared under http://www.w3.org/2001/06/soap-envelope namespace. The actual XML content is embedded inside the SOAP 1.2 Envelope. The Envelope is same for all SOAP 1.2 documents but the body content changes.
Add the SOAP 1.2 Envelope for any XML content with click of a button.
Click here to try Adding SOAP 1.2 Envelope option
Each XML document may contain one or more namespaces. Each element may belong to one namespace and in such a scenarion some elements may belong to no namespace. The optimal way of declaring namespaces is declare them in the root element and assign a unique prefix for each one of the namespace. The prefix has to be prefixed to each element accordingly with : as separator. It makes the XML valid if same namespace is declared with multiple prefixes and use them at different places and some of elements having the same namespace declared locally again.
Each of the below XML is valid and are the different represention of same XML
XML with default namespace
XML with multiple namespace prefixes
XML with optimized namespace prefixes
Click here to try Optimize namespaces option
A default namespace is a namespace declared in any element without having a prefix. If no declaration is present in any element and also without a prefix then the element belongs to parent's namespace.
XML with multiple namespace prefixes
XML with default namespace prefixes
Click here to try Format XML with default namespace option
Annotation is an element inside any element or attribute declaration of a XSD to store the documentation or human readable description of the element. Any XSD with detailed descriptions increases the size of the xsd. The size is reduced if the annotations are removed.
Click here to try Remove annotations from XSD option
Sorting all elements and attributes of a XML alphabetically makes it easy to find the required information.
The actual XML below
The XML with sorted elements below
Click here to try Sort XML elements and attributes option
It is always better to compare 2 xml files with repeating elements after the repeating elements sorted on a value.
Four values have to be provided while using this option above. properties,property,name,element are the four values to sort below example.
properties - the parent element of the repeating element
property - the repeating element which is to be sorted
name - the child element of the repeating element to be used for sorting purpose
element - indicates if the child is an element or an attribute. Possible values are element or attribute
XML repeating property element
XML repeating property element sorted on name elements value
Click here to try Sorting repeating element of a XML option
Any non string XML element should have xsi:nil="true" to avoid validation errors against XSD if element is declared as nillable in XSD. Removing these elements altogether to reduce the size of the xml. This may make the XML invalid with respect to XSD but facilitates small string for quicker analysis.
XML with xsi:nil elements
XML with xsi:nil elements removed
Click here to try Removing xsi:nil elements from XML option
Pretifying a XML string for more readability. Prettifying means to indent the elements properly as per the hierarchy.
Actual XML String
Prettified XML String
Click here to try Prettify XML option
Converting any XML to its corresponding JSON Structure.
XML String
Corresponding JSON String
Click here to try Convert XML to JSON option