ToCompactXML


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


suppresses only namespaces that match patt.

Details and OptionsDetails and Options

  • To use , 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

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

In[1]:=
Click for copyable input

XML with explicit namespace information:

In[2]:=
Click for copyable input

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

In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=

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

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=

Attributes in other namespaces do not get compacted:

In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

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

In[9]:=
Click for copyable input
Out[9]=

The default namespace may be inherited from containing tags:

In[10]:=
Click for copyable input
Out[10]=