The present invention relates to a document processing technique, and particularly to a document processing method and a document processing apparatus for processing a document described in a markup language.
The XML format has been attracting attention as a format that allows the user to share data with other users via a network. This promotes the development of applications for creating, displaying, and editing XML documents (see Patent document 1, for example). The XML documents are created based upon a vocabulary (tag set) defined according to a document format definition.
[Patent Document 1]
Japanese Patent Application Laid-open No. 2001-290804
An arrangement for inputting data such as a character string or the like into an XML document preferably allows the user to input the data in a simple manner giving consideration to the ease-of-use for the user. The present invention has been made in view of the aforementioned problems. Accordingly, it is an object thereof to provide a document processing method and a document processing apparatus which allow the user to insert data into a document described in a markup language with the improved ease-of-use for the user.
In order to solve the aforementioned problems, a document processing apparatus according to an aspect of the present invention comprises: a selection unit for selecting a part of a document described in a markup language; a reception unit for receiving the properties of the markup language used for describing the document; a creating unit for creating at least one tag in the markup language, which is to be added to the part of the document thus selected by the selection unit, based upon the properties received by the reception unit; and an output unit for creating several duplicates of the selected part of the document according to the number of tags thus created by the creating unit, adding at least one tag thus created to each duplicate of the selected part of the document thus reproduced, and outputting each version of the selected part of the document with added tags to memory.
The “markup language” may be a kind of XML, e.g., XHTML, SVG, MathML, etc. Also, examples of the markup languages include SGML, HTML, etc. The term “properties of the markup language” as used here represents an item for identifying the markup language used for describing a document. Examples of the properties of the markup language include the kind of markup language, and the rules of the elements included in the markup language.
According to this aspect, at least one tag is created and added to a selected part of a document described in a markup language. Such an arrangement allows a part of a document to be output in the form of the data described in the markup language without the need for the user to describe new tags.
The property of the markup language used for describing the document thus received by the reception unit may be a tag structure. Furthermore, the creating unit may create at least one tag in the markup language, which is to be added to the part of the document thus selected by the selection unit, such that adding the tag maintains the integrity of the tag structure included in the document. Also, the document which is to be a target for the selection made by the selection unit may have a hierarchical structure. Furthermore, the creating unit may extract tags in the layer in which the selected part of the document has been disposed, and tags in upper layers above the tags, from the hierarchical structure of the document. Furthermore, the creating unit may employ the tags thus extracted as the tags to be added to the part of the document thus selected by the selection unit. With such an arrangement, the tags are created giving consideration to the tag structure included in the document, thereby maintaining the integrity of the tag structure included in the document.
The document processing apparatus may further comprising an insertion unit having a function of selecting one from among at least one version of the selected part of the document which has been output from the output unit, and which includes a added tag set, and a function of inserting the selected one version of the selected part of the document into a document described in a markup language. Such an arrangement allows a selected part of a document to be inserted at various positions in the document.
Another aspect of the present invention relates to a document processing method. The document processing method comprises: selection of a part of a document described in a markup language; creation of at least one tag in the markup language, which is to be added to the part of the document thus selected, based upon the properties of the markup language used for describing the document; creation of several duplicates of the selected part of the document according to the number of tags thus created; addition of at least one tag thus created to each duplicate of the selected part of the document thus created; and output of the several versions of the selected part of the document with the added tags to memory.
Note that any combination of the aforementioned components or any manifestation of the present invention realized by replacement of a method, a device, a system, and so forth, is effective as an embodiment of the present invention.
The present invention provides a function of inserting data into a document described in a markup language with the improved ease-of-use for the user.
Description will be made below regarding the background technique for the present invention before detailed description of the present embodiment.
The main control unit 22 provides for the loading of a plug-in or a framework for executing a command. The editing unit 24 provides a framework for editing XML documents. Display and editing functions for a document in the document processing apparatus 20 are realized by plug-ins, and the necessary plug-ins are loaded by the main control unit 22 or the editing unit 24 according to the type of document under consideration. The main control unit 22 or the editing unit 24 determines which vocabulary or vocabularies describes the content of an XML document to be processed, by referring to a name space of the document to be processed, and loads a plug-in for display or editing corresponding to the thus determined vocabulary so as to execute the display or the editing. For instance, an HTML unit 50, which displays and edits HTML documents, and an SVG unit 60, which displays and edits SVG documents, are implemented in the document processing apparatus 20. That is, a display system and an editing system are implemented as plug-ins for each vocabulary (tag set), so that when an HTML document and an SVG document are edited, the HTML unit 50 and the SVG unit 60 are loaded, respectively. As will be described later, when compound documents, which contain both the HTML and SVG components, are to be processed, both the HTML unit 50 and the SVG unit 60 are loaded.
By implementing the above structure, a user can select so as to install only necessary functions, and can add or delete a function or functions at a later stage, as appropriate. Thus, the storage area of a recording medium, such as a hard disk, can be effectively utilized, and the wasteful use of memory can be prevented at the time of executing programs. Furthermore, since the capability of this structure is highly expandable, a developer can deal with new vocabularies in the form of plug-ins, and thus the development process can be readily facilitated. As a result, the user can also add a function or functions easily at low cost by adding a plug-in or plug-ins.
The editing unit 24 receives an event, which is an editing instruction, from the user via the user interface. Upon reception of such an event, the editing unit 24 notifies a suitable plug-in or the like of this event, and controls the processing such as redoing this event, canceling (undoing) this event, etc.
The DOM unit 30 includes a DOM provider 32, a DOM builder 34 and a DOM writer 36. The DOM unit 30 realizes functions in compliance with a document object model (DOM), which is defined to provide an access method used for handling data in the form of an XML document. The DOM provider 32 is an implementation of a DOM that satisfies an interface defined by the editing unit 24. The DOM builder 34 generates DOM trees from XML documents. As will be described later, when an XML document to be processed is mapped to another vocabulary by the VC unit 80, a source tree, which corresponds to the XML document in a mapping source, and a destination tree, which corresponds to the XML document in a mapping destination, are generated. At the end of editing, for example, the DOM writer 36 outputs a DOM tree as an XML document.
The CSS unit 40, which provides a display function conforming to CSS, includes a CSS parser 42, a CSS provider 44 and a rendering unit 46. The CSS parser 42 has a parsing function for analyzing the CSS syntax. The CSS provider 44 is an implementation of a CSS object and performs CSS cascade processing on the DOM tree. The rendering unit 46 is a CSS rendering engine and is used to display documents, described in a vocabulary such as HTML, which are laid out using CSS.
The HTML unit 50 displays or edits documents described in HTML. The SVG unit 60 displays or edits documents described in SVG. These display/editing systems are realized in the form of plug-ins, and each system is comprised of a display unit (also designated herein as a “canvas”) 56 and 66, which displays documents, a control unit (also designated herein as an “editlet”) 52 and 62, which transmits and receives events containing editing commands, and an edit unit (also designated herein as a “zone”) 54 and 64, which edits the DOM according to the editing commands. Upon the control unit 52 or 62 receiving a DOM tree editing command from an external source, the edit unit 54 or 64 modifies the DOM tree and the display unit 56 or 66 updates the display. These units have a structure similar to the framework of the so-called MVC (Model-View-Controller). With such a structure, in general, the display units 56 and 66 correspond to “View”. On the other hand, the control units 52 and 62 correspond to “Controller”, and the edit units 54 and 64 and DOM instance corresponds to “Model”. The document processing apparatus 20 according to the background technique allows an XML document to be edited according to each given vocabulary, as well as providing a function of editing the HTML document in the form of tree display. The HTML unit 50 provides a user interface for editing an HTML document in a manner similar to a word processor, for example. On the other hand, the SVG unit 60 provides a user interface for editing an SVG document in a manner similar to an image drawing tool.
The VC unit 80 includes a mapping unit 82, a definition file acquiring unit 84 and a definition file generator 86. The VC unit 80 performs mapping of a document, which has been described in a particular vocabulary, to another given vocabulary, thereby providing a framework that allows a document to be displayed and edited by a display/editing plug-in corresponding to the vocabulary to which the document is mapped. In the background technique, this function is called a vocabulary connection (VC). In the VC unit 80, the definition file acquiring unit 84 acquires a script file in which the mapping definition is described. Here, the definition file specifies the correspondence (connection) between the nodes for each node. Furthermore, the definition file may specify whether or not editing of the element values or attribute values is permitted. Furthermore, the definition file may include operation expressions using the element values or attribute values for the node. Detailed description will be made later regarding these functions. The mapping unit 82 instructs the DOM builder 34 to generate a destination tree with reference to the script file acquired by the definition file acquiring unit 84. This manages the correspondence between the source tree and the destination tree. The definition file generator 86 offers a graphical user interface which allows the user to generate a definition file.
The VC unit 80 monitors the connection between the source tree and the destination tree. Upon reception of an editing instruction from the user via a user interface provided by a plug-in that handles a display function, the VC unit 80 first modifies a relevant node of the source tree. As a result, the DOM unit 30 issues a mutation event indicating that the source tree has been modified. Upon reception of the mutation event thus issued, the VC unit 80 modifies a node of the destination tree corresponding to the modified node, thereby updating the destination tree in a manner that synchronizes with the modification of the source tree. Upon reception of a mutation event that indicates that the destination tree has been modified, a plug-in having functions of displaying/editing the destination tree, e.g., the HTML unit 50, updates a display with reference to the destination tree thus modified. Such a structure allows a document described in any vocabulary, even a minor vocabulary used in a minor user segment, to be converted into a document described in another major vocabulary. This enables such a document described in a minor vocabulary to be displayed, and provides an editing environment for such a document.
An operation in which the document processing apparatus 20 displays and/or edits documents will be described herein below. When the document processing apparatus 20 loads a document to be processed, the DOM builder 34 generates a DOM tree from the XML document. The main control unit 22 or the editing unit 24 determines which vocabulary describes the XML document by referring to a name space of the XML document to be processed. If the plug-in corresponding to the vocabulary is installed in the document processing apparatus 20, the plug-in is loaded so as to display/edit the document. If, on the other hand, the plug-in is not installed in the document processing apparatus 20, a check shall be made to see whether a mapping definition file exists or not. And if the definition file exits, the definition file acquiring unit 84 acquires the definition file and generates a destination tree according to the definition, so that the document is displayed/edited by the plug-in corresponding to the vocabulary which is to be used for mapping. If the document is a compound document containing a plurality of vocabularies, relevant portions of the document are displayed/edited by plug-ins corresponding to the respective vocabularies, as will be described later. If the definition file does not exist, a source or tree structure of a document is displayed and the editing is carried out on the display screen.
Here, the document processing apparatus 20 according to the background technique does not have a plug-in which conforms to or handles the display/editing of marks managing vocabularies. Accordingly, before displaying such a document in a manner other than the source display manner or the tree display manner, the above-described VC function is used. That is, there is a need to prepare a definition file for mapping the document, which has been described in the marks managing vocabulary, to another vocabulary, which is supported by a corresponding plug-in, e.g., HTML or SVG. Note that description will be made later regarding a user interface that allows the user to create the user's own definition file. Now, description will be made below regarding a case in which a definition file has already been prepared.
On the screen as shown in
Viewers or editors which can handle major vocabularies such as XHTML, MathML and SVG have already been developed. However, it does not serve any practical purpose to develop dedicated viewers or editors for such documents described in the original vocabularies as shown in
For example, when the source display and tree-view display are implemented by dedicated plug-ins, the source-display plug-in and the tree-display plug-in execute their respective displays by directly referring to the source tree without involving the destination tree. In this case, when the editing is done in any area of the screen, the source-display plug-in and the tree-display plug-in update the screen by referring to the modified source tree. Also, the HTML unit 50 in charge of displaying the area 96 updates the screen by referring to the destination tree, which has been modified following the modification of the source tree.
The source display and the tree-view display can also be realized by utilizing the VC function. That is to say, an arrangement may be made in which the source and the tree structure are laid out in HTML, an XML document is mapped to the HTML structure thus laid out, and the HTML unit 50 displays the XML document thus mapped. In such an arrangement, three destination trees in the source format, the tree format and the table format are generated. If the editing is carried out in any of the three areas on the screen, the VC unit 80 modifies the source tree and, thereafter, modifies the three destination trees in the source format, the tree format and the table format. Then, the HTML unit 50 updates the three areas of the screen by referring to the three destination trees.
In this manner, a document is displayed on a single screen in a plurality of display formats, thus improving a user's convenience. For example, the user can display and edit a document in a visually easy-to-understand format using the table 90 or the like while understanding the hierarchical structure of the document by the source display or the tree display. In the above example, a single screen is partitioned into a plurality of display formats, and they are displayed simultaneously. Also, a single display format may be displayed on a single screen so that the display format can be switched according to the user's instructions. In this case, the main control unit 22 receives from the user a request for switching the display format and then instructs the respective plug-ins to switch the display.
The displayed menu may be switched corresponding to the position of the cursor (carriage) during the editing of a document. That is, when the cursor lies in an area where an SVG document is displayed, the menu provided by the SVG unit 60, or a command set which is defined in the definition file for mapping the SVG document, is displayed. On the other hand, when the cursor lies in an area where the XHTML document is displayed, the menu provided by the HTML unit 50, or a command set which is defined in the definition file for mapping the HTML document, is displayed. Thus, an appropriate user interface can be presented according to the editing position.
In a case that there is neither a plug-in nor a mapping definition file suitable for any one of the vocabularies according to which the compound document has been described, a portion described in this vocabulary may be displayed in source or in tree format. In the conventional practice, when a compound document is to be opened where another document is embedded in a particular document, their contents cannot be displayed without the installation of an application to display the embedded document. According to the background technique, however, the XML documents, which are composed of text data, may be displayed in source or in tree format so that the contents of the documents can be ascertained. This is a characteristic of the text-based XML documents or the like.
Another advantageous aspect of the data being described in a text-based language, for example, is that, in a single compound document, a part of the compound document described in a given vocabulary can be used as reference data for another part of the same compound document described in a different vocabulary. Furthermore, when a search is made within the document, a string of characters embedded in a drawing, such as SVG, may also be search candidates.
In a document described in a particular vocabulary, tags belonging to other vocabularies may be used. Though such an XML document is generally not valid, it can be processed as a valid XML document as long as it is well-formed. In such a case, the tags thus inserted that belong to other vocabularies may be mapped using a definition file. For instance, tags such as “Important” and “Most Important” may be used so as to display a portion surrounding these tags in an emphasized manner, or may be sorted out in the order of importance.
When the user edits a document on an edit screen as shown in
Depending on the contents of the editing, modification of the display by the HTML unit 50 may change the overall layout. In such a case, the layout is updated by a screen layout management mechanism, e.g., the plug-in that handles the display of the highest node, in increments of display regions which are displayed according to the respective plug-ins. For example, in a case of expanding a display region managed by the HTML unit 50, first, the HTML unit 50 renders a part managed by the HTML unit 50 itself, and determines the size of the display region. Then, the size of the display area is notified to the component that manages the screen layout so as to request the updating of the layout. Upon receipt of this notice, the component that manages the screen layout rebuilds the layout of the display area for each plug-in. Accordingly, the display of the edited portion is appropriately updated and the overall screen layout is updated.
The embodiment 1 of the present invention relates to a data insertion device providing: a function of translating a document described in XML and languages other than XHTML (which will be referred to as the “processing target document” hereafter) into a document described in XHTML (which will be referred to as the “XHTML document” hereafter); a function of displaying the document thus translated on a screen; a function of receiving data such as character strings, symbols, etc., which are to be inserted into the XHTML document, from the user; and a function of inserting the data thus received into the processing target document. The data insertion device according to the present embodiment provides an input function, copy-and-paste function, etc., which allows character strings with XML tags and character strings having an XML hierarchical structure (which will be referred to as “fragments” hereafter) to be inserted into the processing target document, as well as allowing character strings in simple text format to be inserted into the said processing target document, while maintaining the integrity of the hierarchical structure of the processing target document. The data insertion device stores the rules of the vocabulary used for creating the processing target document (which will be referred to as the “processing target vocabulary” hereafter) and the rules of the elements included in the processing target document. Specifically, the data insertion device stores the schema (which will be referred to as the “processing target schema” hereafter). With such an arrangement, the data insertion device translates the data which is to be inserted, based upon the processing target vocabulary at the position where the data is to be inserted and the processing target schema. Then, the data insertion device inserts the data thus translated into the processing target document.
The user interface unit 302 receives instructions from the user. With such an arrangement, an unshown screen displays a translated processing target document in the form of an XHTML document. (The meaning of the basic term “document” as used here includes the XHTML document and the processing target document. Also, the term “document” is also used in this specification to refer to a document in the general sense without further qualification.) The user interface unit 302 allows the user to input predetermined instructions with respect to the document thus displayed. Examples of the predetermined instructions include: an instruction to input data such as character strings, symbols, etc., to the document; an instruction to perform an operation to copy a character string at a given position in the document and to paste the character string at another position in the document. Note that the predetermined instructions may include a cut-and-paste instruction or a drag-and-drop instruction, instead of the copy-and-paste instruction. That is to say, the predetermined instructions may include an instruction for performing any processing for the document.
The data acquisition unit 308 receives data which is to be inserted into the document, via the user interface unit 302. Examples of the data which is to be inserted include character strings input as described above, and character strings pasted by the copy-and-paste function.
The dictionary storage unit 306 stores a dictionary beforehand for translating the data input via the data acquisition unit 308. The dictionary storage unit 306 stores dictionaries for handling MathML, SVG, etc., as well as a dictionary used for translating a string of characters in the Japanese hiragana syllabary into a string of characters in Japanese kanji ideograms or the like (which will be referred to as the “general dictionary” hereafter). The translation candidate acquisition unit 310 translates the data received via the data acquisition unit 308 based upon the dictionaries stored in the dictionary storage unit 306. For example, let us consider a case in which the data received via the data acquisition unit 308 is the phrase “root 2” in the hiragana syllabary and a numeral. In this case, the translation candidate acquisition unit 310 translates this character string into “root 2” in the katakana syllabary and a numeral in a text format using the general dictionary. Furthermore, the translation candidate acquisition unit 310 translates this character string into “root 2” with added MathML tags using the MathML dictionary. Specifically, the translation candidate acquisition unit 310 translates this character string into <msqrt><mrow>2</mrow></msqrt>. On the other hand, let us consider a case in which the data received via the data acquisition unit 308 is the word “circle” in the hiragana syllabary. In this case, the translation candidate acquisition unit 310 translates this character string into “circle” in kanji ideograms. Furthermore, the translation candidate acquisition unit 310 translates this character string into a “circle” in an SVG format using the SVG dictionary. Moreover, the translation candidate acquisition unit 310 displays on the screen the data sets which have been obtained as a result of the translation using the multiple dictionaries.
The property acquisition unit 314 receives the properties of the markup language that describe the position in the processing target document where the data is to be inserted. Examples of such properties include the processing target vocabularies and the processing target schema. In a case that the processing target document is described in a single processing target vocabulary, the property acquisition unit 314 acquires the processing target vocabulary as it is. On the other hand, in a case that the processing target document is described in multiple processing target vocabularies, the property acquisition unit 314 acquires the processing target vocabulary at the position where the data is to be inserted. Note that, in order to acquire the processing target vocabulary, a namespace declaration included in the processing target document is used. Also, in order to acquire the processing target schema, a specification attached to the processing target document is used, for example.
The translation unit 312 receives an instruction from the user to select one of the multiple kinds of data sets displayed on the screen by the translation candidate acquisition unit 310. Furthermore, the translation unit 312 determines whether or not the data thus selected by the user can be inserted into the processing target document based upon the processing target vocabulary and the processing target schema received by the property acquisition unit 314. In a case that the insertion can be made, the translation unit 312 determines the insertion. That is to say, the translation candidate acquisition unit 310 and the translation unit 312 translate the data received by the data acquisition unit 308. For example, let us consider a case in which the processing target vocabulary received by the property acquisition unit 314 matches MathML. In this case, in the event that the user has selected “root 2” with the added MathML tags, the translation unit 312 employs “root 2” with the added MathML tags in order to conform to MathML. Also, “root 2” in text format may be employed.
On the other hand, let us consider a case in which the processing target schema received by the property acquisition unit 314 does not permit insertion of MathML <msqrt> tags. In this case, the translation unit 312 employs “root 2” in text format. Furthermore, the translation unit 312 attaches tags to the selected data corresponding to the processing target document. Specific description will be made later regarding an example of the tags to be attached. On the other hand, let us consider a case in which the data thus selected by the user cannot be employed according to the processing target vocabulary and the processing target schema received by the property acquisition unit 314. For example, let us consider a case in which the processing target vocabulary is MathML, but the user has selected a “circle” in SVG format. In this case, the translation unit 312 may perform no processing. In this case, the data insertion device 300 notifies the user to that effect via the screen.
Note that an arrangement may be made in which instead of the translation candidate acquisition unit 310, the translation unit 312 determines the order of precedence of the multiple kinds of data sets translated by the translation candidate acquisition unit 310 based upon the processing target vocabularies and the processing target schema received by the property acquisition unit 314, and displays the multiple kinds of data sets thus translated via an unshown screen according to the order of precedence thus determined. For example, an arrangement may be made as follows. That is to say, at first, the translation unit 312 displays the data set that conforms to the processing target vocabularies or the processing target schema. Next, the translation unit 312 displays the data set that is compatible with the processing target vocabularies or the processing target schema. Lastly, the translation unit 312 displays the data set that is incompatible with both the processing target vocabularies and the processing target schema.
The insertion unit 316 inserts the data selected via the translation unit 312 into an unshown processing target document. Note that, while the processing unit 304 requires predetermined functions provided by the document processing apparatus 100 for executing the above-described processing, description thereof will be omitted. For example, the processing unit 304 requires the functions of the CSS unit 140, the HTML unit 150, and the SVG unit 160 included in the document processing apparatus 100.
The data acquisition unit 308 receives the data which includes the added tags, and which is to be inserted into the document (S40). The property acquisition unit 314 identifies the insertion position in the processing target document at which the data is to be inserted (S42). Furthermore, the property acquisition unit 314 acquires the processing target schema (S44). In a case that the translation unit 312 has identified that the data is an XML fragment (in a case of “YES” in S46), and in a case that the insertion unit 316 can insert the data into the document in the form of an XML fragment (in a case of “YES” in S48), the insertion unit 316 inserts the data into the document in the form of an XML fragment (S50). On the other hand, in a case that the translation unit 312 has identified that the data is not an XML fragment (in a case of “NO” in S46), or in a case that the insertion unit 316 cannot insert the data into the document in the form of an XML fragment (in a case of “NO” in S48), the insertion unit 316 inserts the data into the document in the form of text (S52).
The data acquisition unit 308 receives data which includes added tags and which is to be inserted into a document (S60). The property acquisition unit 314 identifies the insertion position in the processing target document at which the data is to be inserted (S62). Furthermore, the property acquisition unit 314 acquires the processing target vocabulary (S64). The translation unit 312 acquires the processing target schema based upon the tags added to the data and the processing target vocabulary (S66). In a case that the data conforms to the processing target schema (in a case of “YES” in S68), the insertion unit 316 inserts the data into the processing target document after the data translation performed by the translation unit 312 (S70). On the other hand, in a case that the data does not conform to the processing target vocabulary or the processing target schema (in a case of “NO” in S68), the insertion unit 316 inserts the data into the processing target document in the form of text (S72).
The position determination unit 320 receives a VCD from the VC unit 180 shown in
The vocabulary acquisition unit 322 acquires four kinds of translation candidates for the word “cell”. The four kinds of translation candidates thus acquired include: a fragment including added <td> tags; a fragment including added <tr> tags and added <td> tags; a fragment including added <table> tags, added <tr> tags, and added <td> tags; and a fragment including added <body> tags, added <table> tags, added <tr> tags, and added <td> tags. The translation unit 312 determines that, according to the tag structure, the latter two candidates should be eliminated from the aforementioned four kinds of translation candidates, before the execution of translation. The reason is that XHTML does not permit data enclosed in a <table> tag set to be further enclosed in another <table> tag set. Accordingly, such an arrangement allows the user to select either one of the former two translation candidates, which are possible candidates from among the aforementioned four kinds of translation candidates.
With the embodiment according to the present invention, the data is inserted into the processing target document after the data has been translated giving consideration to the processing target vocabulary or the processing target schema. Such an arrangement allows the user to insert data correctly without being concerned about the processing target vocabulary or the processing target schema. With such an arrangement, the data is inserted into the processing target document after the tags added to the data have been modified corresponding to the processing target vocabulary. This allows the user to perform data insertion correctly without being concerned about the processing target vocabulary. Also, with such an arrangement, the data is inserted into the processing target document after the tags added to the data have been modified corresponding to the processing target schema. This allows the user to perform data insertion correctly without being concerned about the processing target schema. Such an arrangement allows the user to perform data insertion without being concerned about the processing target vocabulary and the processing target schema, thereby improving the ease-of-use for the user. Such an arrangement provides a function of identifying the processing target vocabulary based upon the relation between the kind of markup language used for displaying the processing target document and the processing target vocabulary. With such an arrangement, the processing target schema is identified based upon the processing target vocabulary and the tags added to the data. This enables the data to be correctly inserted into the processing target document without receiving the processing target schema. Also, such an arrangement provides a function of data insertion while maintaining the integrity of the hierarchical structure of the processing target document.
The embodiment 2 of the present invention relates to a data insertion device providing: a function of displaying the processing target document as an XHTML document on a screen or the like after the processing target document has been translated into an XHTML document; a function of permitting the user to select a part of the XHTML document and receiving the part thus selected; and a function of inserting the part thus received into another portion of the XHTML document. The data insertion device according to the present invention provides a function of cut processing, as well as providing a function of copy processing. The character string or the like selected in the copy processing is stored in a clipboard. The data insertion device extracts the tags disposed in the layer in which the character string thus selected has been disposed, and the tags for the upper layers above these tags. The data insertion device creates a combination of multiple kinds of character strings by modifying the combination.
The data acquisition unit 308 receives an instruction to select a part of the processing target document from the user via the user interface unit 302. Here, the processing target document has a hierarchical structure in the same way as with the embodiment 1. On the other hand, the “selection” is performed before the copy processing or the cut processing for a part of the processing target document. The property acquisition unit 314 receives the tag structure included in the document as a property of the processing target document.
The tag creating unit 330 creates at least one tag to be added to a part of the processing target document thus selected by the data acquisition unit 308, based upon the tag structure received by the property acquisition unit 314. That is to say, the tag creating unit 330 creates at least one tag which is defined in the markup language and which is to be added to a part of the processing target document thus selected by the data acquisition unit 308 while maintaining the integrity of the hierarchical structure of the processing target document. Specifically, the tag creating unit 330 extracts the tags disposed in the layer in which the selected part of the document has been disposed, and the tags disposed in the upper layers above these tags. The term “tags in the upper layers” represents tags which have been disposed in upper layers above the layer in which a selected part of a document has been disposed, and which are below the root element. Note that detailed description will be made later with reference to specific examples. Furthermore, various combinations are created using the tags thus extracted in descending order of layers. Accordingly, multiple kinds of tag combinations are created by changing the number of tags that form a combination.
The tag adding unit 332 reproduces duplicates of the part of the processing target document thus selected corresponding to the number of tag combinations created by the tag creating unit 330. Furthermore, the tag adding unit 332 adds each of the multiple kinds of tag combinations to the respective duplicate of the selected part of the document thus created. That is to say, duplicates of the selected part of the document are created, each of which has the same contents. Then, the multiple kinds of tag combinations are added to the duplicates thus created in such a manner that the combination of tags differs from one duplicate to another, thereby creating multiple versions of “part of the document”. This means that multiple fragments are created. The memory 334 stores the multiple versions of the selected part of the document output from the tag adding unit 332.
Upon reception of an instruction from the user via the user interface unit 302 to paste the selected part of the document stored in the memory 334, the translation unit 312 reads out the multiple versions of the selected part of the document stored in the memory 334. Furthermore, the translation unit 312 selects one from among the multiple versions of the selected part of the document according to an instruction from the user. The insertion unit 316 inserts the one part of the document thus selected such that the tags added to the one part of the document thus selected maintain the integrity of the tag structure of the processing target document. Note that the processing unit 304 executes the aforementioned processing using predetermined functions provided by the document processing apparatus 100 in the same way as that shown in
The portion thus selected corresponds to the <section> layer in the hierarchical structure of the processing target document. Accordingly, the tag creating unit 330 also extracts the <paragraph> tag which corresponds to an upper layer and which is not the root element tag. Then, various combinations of tags are created, each of which is to be inserted so as to enclose a selected part of the document. The tag combinations thus created in the final stage are: a <section> . . . </section> combination; and a <paragraph><section> . . . </section></paragraph> combination. Then, the tag adding unit 332 creates two duplicates of the selected part. Furthermore, the tag adding unit 332 adds each of the two kinds of tag combinations to the respective duplicate of the selected part.
With the embodiment of the present invention, tags are created for a selected part of a processing target document, and the tags thus created are added to the selected part. Such an arrangement allows a selected part of a processing target document to be inserted in the form of data described in a markup language without the need for the user to describe new tags. This does not require the user to describe tags, thereby improving the ease-of-use for the user. Furthermore, such an arrangement creates tags giving consideration to the tag structure of the processing target document, thereby maintaining the integrity of the hierarchical structure of the processing target document. Also, with such an arrangement, a limited number of kinds of tags are created. Accordingly, an arrangement may be made in which the operation for selecting one from the multiple kinds of tags is eliminated. Also, with such an arrangement, the part thus selected can be inserted into various portions in the processing target document.
Description has been made regarding the present invention with reference to the embodiments. The above-described embodiments have been described for exemplary purposes only, and are by no means intended to be interpreted restrictively. Rather, it can be readily conceived by those skilled in this art that various modifications may be made by making various combinations of the aforementioned components or processes, which are also encompassed in the technical scope of the present invention.
Description has been made in the background technique regarding an arrangement for processing an XML document. Also, the document processing apparatus 100 has a function of processing other markup languages, e.g., SGML, HTML, etc.
Description has been made in the embodiment 1 regarding an arrangement in which, in a case that the data to be copied and pasted is a character string, and in a case that the character string does not conform to the processing target vocabulary at the insertion position, the translation unit 312 determines that the insertion of this character string is not to be performed. The present invention is not restricted to such an arrangement. Also, an arrangement may be made in which, in a case that the data to be copied and pasted is a predetermined kind of graphic data, the translation unit 312 converts the graphic data into SVG data, i.e., adds a tag set supported by SVG to the graphic data, and inserts the SVG data into the processing target document. Also, an arrangement may be made in which, in a case that no vocabulary has been defined to support the data to be inserted, the translation unit 312 defines the vocabulary by declaring the definition of the vocabulary that supports the data to be inserted in the namespace. The modification according to the present embodiment also provides a function of inserting graphic data or the like into the processing target document. That is to say, an arrangement may be made which provides a function of the insertion of any data while maintaining the integrity of the hierarchical structure of the processing target document.
Description has been made in the embodiment 2 regarding an arrangement in which the property acquisition unit 314 acquires the tag structure of the processing target document as a property of the processing target document. The present invention is not restricted to such an arrangement. Also, the processing target vocabulary or the processing target schema may be acquired as the property of the processing target document, for example. The modifications according to the present embodiment may have a function of handling various rules defined for the processing target document. That is to say, any rule defined for the processing target document may be used as a property of the processing target document.
The present invention can be applied to a document processing apparatus for processing a document described in a markup language.
Number | Date | Country | Kind |
---|---|---|---|
2004-186128 | Jun 2004 | JP | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP05/11668 | 6/24/2005 | WO | 12/22/2006 |