Layout method

Information

  • Patent Application
  • 20070180364
  • Publication Number
    20070180364
  • Date Filed
    January 29, 2007
    17 years ago
  • Date Published
    August 02, 2007
    16 years ago
Abstract
In a layout method, a document that is structured using a markup language into a tree having a plurality of elements is input. The structure of the document is analyzed from the beginning of the document to generate a document-object-model node for each of the elements in an order of appearance of the plurality of elements, and the generated document-object-model nodes are stored. Each time an element that is a leaf of the tree of the document is detected from the elements and a document-object-model node corresponding to the element is generated, a layout position of the element is calculated on the basis of information obtained from a document-object-model subtree, the document-object-model subtree being a tree having the document-object-model nodes that have already been stored. Each time the layout position of the element for the document-object-model subtree is calculated, at least one of the stored document-object-model nodes that is of a lower level than a bottom-level document-object-model node among document-object-model nodes each corresponding to a parent element having a child element whose corresponding document-object-model node has not yet been generated is deleted.
Description

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be described with reference to the accompanying drawings, wherein like numbers reference like elements.



FIG. 1 is a flowchart showing a layout method according to an embodiment of the invention.



FIG. 2 is a block diagram of a layout apparatus according to an embodiment of the invention.



FIG. 3 is a block diagram showing the software configuration of the layout apparatus according to the embodiment of the invention.



FIG. 4 is a schematic diagram showing the structure of a document according to an embodiment of the invention.



FIG. 5 is a schematic diagram showing the DOM nodes according to the embodiment of the invention.



FIGS. 6A and 6B are schematic diagrams showing DOM nodes and layout nodes according to the embodiment of the invention.



FIGS. 7A and 7B are schematic diagrams showing the DOM nodes and the layout nodes according to the embodiment of the invention.



FIGS. 8A and 8B are schematic diagrams showing the DOM nodes and the layout nodes according to the embodiment of the invention.



FIGS. 9A and 9B are schematic diagrams showing the DOM nodes and the layout nodes according to the embodiment of the invention.



FIGS. 10A and 10B are schematic diagrams showing the DOM nodes and the layout nodes according to the embodiment of the invention.



FIG. 11 is a schematic diagram showing the layout nodes according to the embodiment of the invention.



FIGS. 12A and 12B are schematic diagrams showing the DOM nodes and the layout nodes according to the embodiment of the invention.



FIG. 13 is a schematic diagram showing a DOM tree for the overall document according to the embodiment of the invention.


Claims
  • 1. A layout method comprising: inputting a document that is structured using a markup language into a tree having a plurality of elements;analyzing the structure of the document from the beginning of the document to generate a document-object-model node for each of the elements in an order of appearance of the plurality of elements, and storing the generated document-object-model nodes;calculating a layout position of the element on the basis of information obtained from a document-object-model subtree, the document-object-model subtree being a tree having the document-object-model nodes that have already been stored, the calculating step being performed each time an element that is a leaf of the tree of the document is detected from the elements and a document-object-model node corresponding to the element is generated; anddeleting at least one of the stored document-object-model nodes that is of a lower level than a bottom-level document-object-model node among document-object-model nodes each corresponding to a parent element having a child element whose corresponding document-object-model node has not yet been generated, the deleting step being performed each time the layout position of the element for the document-object-model subtree is calculated.
  • 2. The layout method according to claim 1, wherein: each time one of the document-object-model nodes is generated, a layout node having information necessary for calculation of the layout position is generated on the basis of the generated document-object-model node and is stored;each time an element that is a leaf of the tree of the document is detected from the elements and a layout node corresponding to the element is generated, the layout position is calculated on the basis of a tree having the layout nodes that have already been stored; andeach time the layout positions are calculated for a given page of the document, the stored layout nodes that are not needed for calculating the layout positions for a subsequent page are deleted.
  • 3. The layout method according to claim 1, wherein: each time an element that is a leaf of the tree of the document is detected from the elements and a document-object-model node corresponding to the element is generated, the generation of the document-object-model nodes is interrupted; andeach time the layout position of the element for the document-object-model subtree is calculated, the generation of the document-object-model nodes is resumed.
  • 4. A layout apparatus comprising: an input section that inputs a document that is structured using a markup language into a tree having a plurality of elements;an analyzing section that analyzes the structure of the document from the beginning of the document to generate a document-object-model node for each of the elements in an order of appearance of the plurality of elements, and that stores the generated document-object-model nodes;a layout section that each time an element that is a leaf of the tree of the document is detected from the elements and a document-object-model node corresponding to the element is generated, calculates a layout position of the element on the basis of information obtained from a document-object-model subtree, the document-object-model subtree being a tree having the document-object-model nodes that have already been stored; anda deletion section that each time the layout position of the element for the document-object-model subtree is calculated, deletes at least one of the stored document-object-model nodes that is of a lower level than a bottom-level document-object-model node among document-object-model nodes each corresponding to a parent element having a child element whose corresponding document-object-model node has not yet been generated.
  • 5. A printer comprising: an input section that inputs a document that is structured using a markup language into a tree having a plurality of elements;an analyzing section that analyzes the structure of the document from the beginning of the document to generate a document-object-model node for each of the elements in an order of appearance of the plurality of elements, and that stores the generated document-object-model nodes;a layout section that each time an element that is a leaf of the tree of the document is detected from the elements and a document-object-model node corresponding to the element is generated, calculates a layout position of the element on the basis of information obtained from a document-object-model subtree, the document-object-model subtree being a tree having the document-object-model nodes that have already been stored;a deleting section that each time the layout position of the element for the document-object-model subtree is calculated, deletes at least one of the stored document-object-model nodes that is of a lower level than a bottom-level document-object-model node among document-object-model nodes each corresponding to a parent element having a child element whose corresponding document-object-model node has not yet been generated;a rendering section that renders the elements at the layout positions to form an image; anda printing section that prints the image.
Priority Claims (1)
Number Date Country Kind
2006-018861 Jan 2006 JP national