XML`
XML`

ToCompactXML

ToCompactXML[expr]

generates an equivalent SymbolicXML expression that suppresses all the redundant namespace information for elements and attributes in expr.

ToCompactXML[expr,patt]

suppresses only namespaces that match patt.

Details and Options

  • To use ToCompactXML, you first need to load the XML Package using Needs["XML`"].
  • The following option can be given:
  • "AttributesDefaultNameSpace""NullNameSpace"controls how attribute namespaces are abbreviated

Examples

Basic Examples  (1)

XML with explicit namespace information:

ToCompactXML suppresses redundant namespace information for elements. Attributes in the null namespace always get compacted, regardless of the setting of "AttributesDefaultNameSpace":

Attributes in the same default namespace as the element only get compacted when "AttributesDefaultNameSpace" is "ElementNameSpace":

Attributes in other namespaces do not get compacted:

If the namespace of a tag is explicit but different from the default, attributes will not be compacted:

The default namespace may be inherited from containing tags: