{"@attributes":{"version":"2.0"},"channel":{"title":"Documentation \u2013 Aspose.Words Document Object Model (DOM)","link":"https:\/\/docs.aspose.com\/words\/java\/aspose-words-document-object-model\/","description":"Recent content in Aspose.Words Document Object Model (DOM) on Documentation","generator":"Hugo -- gohugo.io","language":"en","item":{"title":"Java: Logical Levels of Nodes in a Document in Java","link":"https:\/\/docs.aspose.com\/words\/java\/logical-levels-of-nodes-in-a-document\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/docs.aspose.com\/words\/java\/logical-levels-of-nodes-in-a-document\/","description":"\n        \n        \n        <p>This documentation sometimes refers to a group of node classes as belonging to a &ldquo;level&rdquo; in a document, such as &ldquo;block-level&rdquo;, &ldquo;inline-level&rdquo; (also known as &ldquo;inline&rdquo;), or \u201crow-level\u201d nodes. These levels in a document are differentiated purely logically and are not explicitly expressed by inheritance or other Aspose.Words DOM means. The node level is used to describe the place in the document tree where the node would typically occur.<\/p>\n<p>In the previous article, we already talked about the relationship between nodes and the fact that not all nodes are allowed to be a child of any nodes. For example, Cell can only be a Row child, and a Row can only be a Table child, and so on. These relationships are also applicable for the logical division of nodes into levels in the document.<\/p>\n<p>The following sections describe the logical levels of nodes in Aspose.Words and the classes that belong to each level.<\/p>\n<h2 id=\"document-and-section-logical-level\">Document and Section Logical Level<\/h2>\n<p>A Word document consists of one or more sections, represented by the <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/section\/\">Section<\/a> class and separated by section breaks. A section can define its own page size, margins, orientation, number of text columns, and headers and footers.<\/p>\n<p><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/document\/\">Document<\/a> and <a href=\"https:\/\/www.aspose.com\/api\/words\/java\/com.aspose.words\/section\">Section<\/a> level nodes have the structure as shown in the following diagram.<\/p>\n<img src=\"document-and-section-level.png\" alt=\"document-and-section-level-aspose-words-java\" style=\"width:700px\"\/>\n<p>A section contains the main text, as well as headers and footers for the first, even, and odd pages. These different \u201cflows\u201d of text are called <em>stories<\/em>.<\/p>\n<p>In Aspose.Words, the <strong>Section<\/strong> node contains the <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/body\/\">Body<\/a> and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/headerfooter\/\">HeaderFooter<\/a> story nodes. The <strong>Body<\/strong> object stores the main text. The <strong>HeaderFooter<\/strong> objects store the text for each header and footer. The text of any story consists of paragraphs and tables, respectively represented by the <strong>Paragraph<\/strong> and <strong>Table<\/strong> objects of the Block-level.<\/p>\n<p>Additionally, each Word document can contain a glossary, which is represented by the <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/glossarydocument\/\">GlossaryDocument<\/a> node in Aspose.Words. A glossary document contains <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/buildingblock\/\">BuildingBlocks<\/a>, <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/buildingblocktype\/#AUTO-TEXT\">AutoText<\/a>, and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/buildingblocktype\/#AUTO-CORRECT\">AutoCorrect<\/a> entries.<\/p>\n<p><strong>GlossaryDocument<\/strong> includes <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/buildingblock\/\">BuildingBlock<\/a> nodes representing different types of glossary document entries. Each <strong>BuildingBlock<\/strong> contains sections that can be inserted, removed, and copied into documents.<\/p>\n<h2 id=\"block-logical-level\">Block Logical Level<\/h2>\n<p>Block-level nodes represent containers for content and content controls, and can occur in the document tree child nodes in the following nodes:<\/p>\n<ul>\n<li>Body<\/li>\n<li>Header<\/li>\n<li>Footer<\/li>\n<li>Footnote<\/li>\n<li>Comment<\/li>\n<li>Shape<\/li>\n<li>GroupShape<\/li>\n<li>Cell<\/li>\n<li>StructuredDocumentTag<\/li>\n<\/ul>\n<p>Block-level nodes are represented by the following classes:<\/p>\n<ul>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/table\/\">Tables<\/a> and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/paragraph\/\">Paragraphs<\/a>, which are the most important block-level nodes<\/li>\n<li>Bookmarks, which occurs both at the block-level and at the inline-level<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/structureddocumenttag\/\">StructuredDocumentTag<\/a>, which represent custom markup and can contain both content and content controls<\/li>\n<\/ul>\n<p>The following diagram shows the block-level elements.<\/p>\n<img src=\"block-level.png\" alt=\"block-level-aspose-words-java\" style=\"width:550px\"\/>\n<h2 id=\"inline-logical-level\">Inline Logical Level<\/h2>\n<p>Inline-level nodes represent the actual content of the document and can be contained in the following containers:<\/p>\n<ul>\n<li>Paragraph \u2013 the most common container<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/smarttag\/\">SmartTag<\/a><\/li>\n<li>StructuredDocumentTag<\/li>\n<\/ul>\n<p>Inline-level elements are represented by the following classes:<\/p>\n<ul>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/run\/\">Run<\/a> \u2013 runs of text formatted differently<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/bookmarkstart\/\">BookmarkStart<\/a> and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/bookmarkend\/\">BookmarkEnd<\/a> represent bookmarks<\/li>\n<li>[CommentRangeStart]https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/comment\/RangeStart), <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/commentrangeend\/\">CommentRangeEnd<\/a>, <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/comment\/\">Comment<\/a> and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/footnote\/\">Footnote<\/a> represent annotations<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/fieldstart\/\">FieldStart<\/a>, <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/fieldchar\/\">FieldChar<\/a>, <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/fieldseparator\/\">FieldSeparator<\/a> and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/fieldend\/\">FieldEnd<\/a> that represent field characters, and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/formfield\/\">FormField<\/a> represent Word fields<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/specialchar\/\">SpecialChar<\/a> represents special characters in the document<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/shape\/\">Shape<\/a> and <a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/groupshape\/\">GroupShape<\/a> represent shapes, drawings, images, etc.<\/li>\n<li>SmartTag and StructuredDocumentTag represent custom markup<\/li>\n<\/ul>\n<p>The following diagram shows the inline-level nodes structure.<\/p>\n<img src=\"inline-level.png\" alt=\"inline-level-aspose-words-java\" style=\"width:785px\"\/>\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\n<p>Shapes in Microsoft Word include Office Art AutoShapes, text boxes, images, OLE objects, and ActiveX controls, all of which are represented using the <code>Shape<\/code> class. Some shapes can also contain text, so Shape nodes in Aspose.Words can contain block-level nodes.<\/p>\n<p>Shapes can be grouped inside each other using GroupShape nodes.<\/p>\n\n<\/div>\n\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\nFootnotes and comments can contain text, therefore Footnote and Comment nodes in Aspose.Words can contain block-level nodes.\n<\/div>\n\n<h2 id=\"table-row-and-cell-node-level\">Table, Row, and Cell Node Level<\/h2>\n<p>The table consists of nodes of rows and cells. Table elements are represented by the following classes:<\/p>\n<ul>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/row\/\">Row<\/a> represents a table row<\/li>\n<li><a href=\"https:\/\/reference.aspose.com\/words\/java\/com.aspose.words\/cell\/\">Cell<\/a> represents a table cell<\/li>\n<li>StructuredDocumentTag represent custom markup<\/li>\n<\/ul>\n<p>The following diagram shows the node structures of the Table, Row, and Cell levels.<\/p>\n<img src=\"table-row-cell.png\" alt=\"table-row-cell-aspose-words-java\" style=\"width:910px\"\/>\n\n      "}}}