Article ID: 296560 - Last Review: March 22, 2006 - Revision: 3.1 How to use XML Notepad to create an XML documentThis article was previously published under Q296560 Microsoft XML Notepad is an application that allows you to
create and edit XML documents quickly and easily. With this tool, the structure
of your XML data is displayed graphically in a tree structure. The interface
presents two panes: one for the structure, and one for the values. You may add
elements, attributes, comments, and text to the XML document by creating the
tree structure in the left pane and entering values in the right pane's
corresponding text boxes. To create a well-formed XML document with XML Notepad,
follow these steps:
- To open XML Notepad, click Start, point to Programs, point to Microsoft XML Notepad, and then click Microsoft XML Notepad. The interface shows two panes. The Structure pane on the left
presents the beginning of an XML tree structure, with a Root_Element and
Child_Element already created. Empty text boxes in the Values pane accept
corresponding values.
- Change Root_Element to Catalog and Child_Element to Book,
and add an attribute and three child elements to the Book child element.NOTE: When you insert the following values, do not include
apostrophes. XML Notepad inserts them for you as your XML document requires.
- To insert an attribute for Book, right-click Book, point to Insert, and click Attribute. Next to the cube icon, type ID. To insert
a value for this attribute, highlight ID and type Bk101 in the corresponding text
box in the Values pane.
- To insert a child element for Book, right-click the
folder icon next to Book, point to Insert, and click Child Element. A leaf icon appears. Type Author next to this icon, and then type Gambardella,
Matthew in the corresponding text box in the Values
pane.
- Add two more child elements: Title and Genre. Type XML Developer's Guide and
Computer in the corresponding text boxes in the Values
pane.
- To add another Book child element to the Root node,
right-click an existing Book element and click Duplicate. Fill in the values as needed.
- To add text to existing elements, highlight the node for
which you would like to add a text node. On the Insert menu, click Text.
- To add comments to existing elements, highlight the node
after which or in which you want to insert the comment. On the Insert menu, click Comment. If the highlighted node is expanded, the comment is inserted
within the highlighted node. If the highlighted node is collapsed, the comment
is inserted after the highlighted node.
- To change a node's type, highlight the node that you want
to change. On the Tools menu, point to Change To and click the appropriate type.
NOTE: You cannot change the type of the root node or of nodes with
children. - To view the XML source of the document, on the View menu, click Source. The sample output resembles the following:
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
text1
</book>
<!--Comment1-->
<book id="bk102">
<!--Comment2-->
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
</book>
</catalog>
Note the following message at the bottom of the View window:
The current XML definition is well formed.
Also, note that the XML declaration or processing instructions
must be added with an external editor, such as Notepad.
- To save the XML document, on the File menu, click Save. To exit XML Notepad, on the File menu, click Exit.
For more information, see the following Web sites:
APPLIES TO- Microsoft XML Parser 2.5
- Microsoft XML Parser 2.6
- Microsoft XML Parser 3.0
- Microsoft XML Parser 3.0 Service Pack 1
- Microsoft XML Core Services 4.0
| |