This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Add-ons & Links / XML Capabilities / Working with NotebookML /

Importing NotebookML

NotebookML files can be imported through the kernel using Import. The first argument of Import is the filename of the file you are importing. If the file carries the .xml or .nbml extension and is in NotebookML format, then Import will automatically convert the file into a notebook expression. Here is an example.


You can also specify the import format explicitly, by using "SymbolicXML" or "NotebookML" as the second argument to Import. This is useful when the file you are importing does not have a .xml or .nbml extension to indicate the nature of its contents.

The import process is much faster, especially for large files, if you specify "NotebookML" as the import format. However, you should only use this form if you are sure that the file is a NotebookML document.

Import["test.xml", "NotebookML"];

You can also import the file as SymbolicXML using the following command.

Import["test.xml", "SymbolicXML"];

You can control the various details of the import process, such as how to treat whitespace or whether to recognize entities, by specifying conversion options to the Import function. For more information, see XML Import Conversion Options.