The present invention relates to a document processing technique, and particularly to a document processing apparatus and a document processing method for processing a document described in a markup language.
The XML format attracts attention as a format that allows the user to share data with other users via a network. This Promotes 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 type definition.
Japanese Patent Application Laid-open No. 2001-290804
Let us consider a case in which a document created using a certain application includes embedded data or an embedded document created using another application. Conventionally, in this case, such embedded data is handled as so-called black-box data which cannot be used as reference data. In order to effectively utilize the data in the document, there is a demand for a technique that allows the user to utilize any data included in the document as reference data.
The present invention has been made in view of the aforementioned problems. Accordingly, it is an object thereof to provide a technique that allows the user to effectively utilize the data included in a document described in a markup language.
An aspect of the present invention relates to a document processing apparatus. The document processing apparatus comprises: a processing system having a function of displaying a document described in a markup language, and a function of allowing the user to edit the document; and a calculation unit having a function whereby, in a case that the element value or the attribute value of a component included in the document is described in a calculation expression using another data set as a reference, the reference data is acquired in order to execute the calculation expression, and the calculation results are substituted for the element value or the attribute value.
The markup language employed in the present invention may be a form of XML. Examples of such forms of XML include XHTML, SVG, MathML, etc. Also, examples of the markup languages include SGML, HTML, etc. Such an arrangement enables a document to be described by a calculation expression using another data set as reference data. This allows data to be more effectively utilized, thereby improving the ease-of-use for the user. The aforementioned reference data may be described in another markup language that differs from that used in the aforementioned component that refers to the reference data.
The calculation expression may be described in a markup language for describing the calculation expression. With such an arrangement, the calculation unit may be provided in the form of a plug-in having a function of interpreting and processing a dedicated markup language for describing calculation expressions. The calculation expression may be described in a definition file which is an external reference file used by the document.
Also, an arrangement may be made in which, upon modification of the reference data, the calculation unit executes calculation again according to the calculation expression, and substitutes the calculation results for the element value or the attribute value. Also, an arrangement may be made in which, upon substitution of new calculation results, the processing system updates the display. Such an arrangement allows the reference data to be appropriately updated, thereby updating the display in real time according to the modification of the reference data.
The document processing apparatus may further include a creating unit for creating data in a format based upon a document object model determined for providing an access method for handling a document in the form of data, with the creating unit creating document object model data corresponding to the document, and with the processing system displaying the document with reference to the document object model data. Also, an arrangement may be made in which the calculation unit identifies and acquires the reference data from among the document object model data sets. Even in a case of processing a document described in multiple different markup languages, such an arrangement enables every part of the document to be accessed by converting the relevant parts of the document into predetermined object model data. This allows the calculation unit to easily identify and acquire the reference data.
Another aspect of the present invention relates to a document processing method. The document processing method comprises: a step in which, before a document described in a markup language is displayed on a display device, determination is made whether or not the element value or the attribute value of a component included in the document is described in a calculation expression using another data set as reference data; and a step in which, in a case that the element value or the attribute value is described in the calculation expression, the reference data is acquired in order to execute calculation according to the calculation expression, and the calculation results are substituted for the element value or the attribute value.
Note that any combination of the aforementioned components or any manifestation of the present invention realized by modification of a method, device, system, and so forth, is effective as an embodiment of the present invention.
The present invention provides a technique for effectively utilizing data included in a document described in a markup language.
100 document processing apparatus
110 main control unit
120 editing unit
130 DOM unit
132 DOM provider
134 DOM builder
136 DOM writer
140 CSS unit
150 HTML unit
160 SVG unit
180 VC unit
182 mapping unit
184 VC definition file acquiring unit
186 VC definition file generator
190 calculation unit
192 calculation definition file acquiring unit
194 execution unit
The main control unit 110 provides for the loading of a plug-in or a framework for executing a command. The editing unit 120 provides a framework for editing XML documents. Display and editing functions for a document in the document processing apparatus 100 are realized by plug-ins, and the necessary plug-ins are loaded by the main control unit 110 or the editing unit 120 according to the type of document under consideration. The main control unit 110 or the editing unit 120 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 150, which displays and edits HTML documents, and an SVG unit 160, which displays and edits SVG documents, are implemented in the document processing apparatus 100. 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 150 and the SVG unit 160 are loaded, respectively. As will be described later, when compound documents, which contain both the HTML and SVG elements, are to be processed, both the HTML unit 150 and the SVG unit 160 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 120 receives an event, which is an editing instruction, from the user via the user interface. Upon reception of such an event, the editing unit 120 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 130 includes a DOM provider 132, a DOM builder 134 and a DOM writer 136. The DOM unit 130 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 132 is an implementation of a DOM that satisfies an interface defined by the editing unit 120. The DOM builder 134 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 180, 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 136 outputs a DOM tree as an XML document.
The CSS unit 140, which provides a display function conforming to CSS, includes a CSS parser 142, a CSS provider 144 and a rendering unit 146. The CSS parser 142 has a parsing function for analyzing the CSS syntax. The CSS provider 144 is an implementation of a CSS object and performs CSS cascade processing on the DOM tree. The rendering unit 146 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 150 displays or edits documents described in HTML. The SVG unit 160 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”) 156 and 166, which displays documents, a control unit (also designated herein as an “editlet”) 152 and 162, which transmits and receives events containing editing commands, and an edit unit (also designated herein as a “zone”) 154 and 164, which edits the DOM according to the editing commands. Upon the control unit 152 or 162 receiving a DOM tree editing command from an external source, the edit unit 154 or 164 modifies the DOM tree and the display unit 156 or 166 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 unit 156 and 166 correspond to “View”. On the other hand, the control units 152 and 162 correspond to “Controller”, and the DOM instance corresponds to “Model”. The document processing apparatus 100 according to the present embodiment allows an HTML 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 150 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 160 provides a user interface for editing an SVG document in a manner similar to an image drawing tool.
The VC unit 180 includes a mapping unit 182, a VC definition file acquiring unit 184 and a VC definition file generator 186. The VC unit 180 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 present embodiment, this function is called a vocabulary connection (VC). In the VC unit 180, the VC definition file acquiring unit 184 acquires a script file in which the mapping definition is described Here, the VC definition file specifies the correspondence (connection) between the nodes for each node. Furthermore, the VC definition file may specify whether or not editing of the element values or attribute values is permitted. Furthermore, the VC 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 182 instructs the DOM builder 134 to generate a destination tree with reference to the script file acquired by the VC definition file acquiring unit 184. This manages the correspondence between the source tree and the destination tree. The VC definition file generator 186 offers a graphical user interface which allows the user to generate a VC definition file.
The VC unit 180 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 180 first modifies a relevant node of the source tree. As a result, the DOM unit 130 issues a mutation event indicating that the source tree has been modified. Upon reception of the mutation event thus issued, the VC unit 180 receives the mutation event and 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 150, 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 100 displays and/or edits documents will be described herein below. When the document processing apparatus 100 loads a document to be processed, the DOM builder 134 generates a DOM tree from the XML document. The main control unit 110 or the editing unit 120 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 100, 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 100, a check shall be made to see whether a mapping VC definition file exists or not. And if the VC definition file exits, the VC definition file acquiring unit 184 acquires the VC 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 VC 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 100 according to the present exemplary embodiment 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 VC 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 VC definition file. Now, description will be made below regarding a case in which a VC 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 150 in charge of displaying the area 214 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 150 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 180 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 150 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 200 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 110 receives from the user a request for switching the display format and then instructs the respective plug-ins to switch the display.
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 150 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 by the respective plug-ins. For example, in a case of expanding a display region managed by the HTML unit 150, first, the HTML unit 150 renders a part managed by the HTML unit 150 itself, and determines the size of the display region. Then, the size of the display area is notified to the element that manages the screen layout so as to request the updating of the layout. Upon receipt of this notice, the element 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 displayed menu may be switched corresponding to the position of the cursor (carriage return) 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 160, or a command set which is defined in the VC 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 150, or a command set which is defined in the VC 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 VC 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 present embodiment, 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.
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, and may be processed by the VC unit 180. 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.
Another advantageous aspect of the data being described in a text-based language, for example, is that a section described in a vocabulary within a compound document can be processed with reference to another section described in another vocabulary within the same compound document. For example, such an arrangement allows a calculation expression and so forth to be processed with reference to the data of a section described in another vocabulary. Also, such an arrangement allows the user to search an HTML document using a text string embedded in an SVG picture and so forth as a search key. With conventional techniques, an application handles a document including an embedded document or embedded data created by another application without identifying the format of the embedded data. That is to say, such a conventional application cannot properly interpret such embedded data. Accordingly, the embedded data is handled as so-called black-box data which cannot be referred to by the application. Now, let us consider a new application for handling such a compound document, having a function of identifying the format of the embedded data, and a function of appropriately interpreting the contents of the data. Such an arrangement allows the application to handle a section in a document with reference to embedded data included in another section in the document. XML documents are text-based documents. Accordingly, such an arrangement having such a function is appropriate for being applied to the XML documents. Description will be made below regarding the document processing apparatus 100 according to a second embodiment.
The calculation unit 190 includes: a calculation definition file acquiring unit 192 for acquiring a calculation definition file described in a calculation vocabulary; and an execution unit 194 for executing calculation according to a calculation expression described in the calculation definition file. Let us consider a case in which the document read out specifies that processing should be performed with an external calculation definition file as reference data. In this case, the calculation definition file acquiring unit 192 acquires the calculation definition file, and the execution unit 194 executes calculation according to the calculation expression described in the calculation definition file. The calculation results are substituted for the element values or the attribute values. On the other hand, in a case that the reference data used for the calculation expression has been updated, the execution unit 194 receives a mutation event which is a notification that the node including the reference data has been updated, and executes calculation again according to the calculation expression. The calculation results are substituted for the data which is to be processed using the reference data. Upon the update of the data which is to be processed using the reference data, the dedicated plug-in for displaying the node updates a display, thereby updating a display according to the calculation results.
In this document, the top node consists of the element “ryohiseisan”, which is an element of the “ryohi” vocabulary. The top node includes sub-elements “person” and “persondb”, which are elements of the “office” vocabulary, and the sub-elements “period”, “place”, “business”, “items”, and “total-price”, which are elements of the “ryohi” vocabulary. The element “person” stores the data of the travel expenses applicant, and has sub-elements. The sub-elements of the element “person” include: “department-code”, which is a sub-element for storing the code for the department to which the applicant belongs; “department-name”, which is a sub-element for storing the name of the department to which the applicant belongs; “rank”, which is a sub-element for storing the rank of the applicant; and “tel”, which is a sub-element for storing the telephone number of the applicant. On the other hand, the element “persondb” stores the staff data, and has multiple sub-elements “record”. Each sub-element “record” has attribute values, i.e., the staff number “number”, the name “name”, and the telephone number “tel”. The element “period” stores the travel period. The attribute values of the “period” include: the attribute value “start” for storing the start date; and the attribute value “end” for storing the completion date. The element “place” stores the travel destination. The element “business” stores the business purpose of the travel. The element “items” stores the details of the travel expenses, and has multiple sub-elements “item”. Each sub-element “item” has multiple attribute values, i.e., the date attribute value “datetime”, the starting point attribute value “route-start”, the travel type attribute value “type”, and the price attribute value “price”. The element “total-price” stores the total of the travel expenses. The total of the travel expenses is calculated according to a calculation expression described in a calculation definition file as described later.
In this document, the top node consists of the element “sample”, which is an element of the “sample” vocabulary. The top node includes the sub-element “value”, the sub-element “value-total-abs”, and the sub-element “value-total-ref”. The element “value” stores the reference value used for the calculation expression. The elements “value-total-abs” and “value-total-ref” each store the sum of the elements “value”. The elements “value-total-abs” and “value-total-ref” each include the attribute value “calc:expression”. The attribute value “calc:expression” specifies a calculation expression for calculating the sum of the elements “value”, whereby the calculation results are stored as an element value. The attribute value “calc:expression” of the element “value-total-abs” specifies the reference node in the form of an absolute path. On the other hand, the attribute value “calc:expression” of the element “value-total-ref” specifies the reference node in the form of a relative path. In either case, the same node “sample:value” is used as a reference, and accordingly, the same sum is calculated.
The attribute “calc:expression” is specified as a global attribute with a name space prefix. The global attribute can be specified as an attribute having the same meaning for any element of any vocabulary. Specifically, the attribute “calc:expression” provides a function as the attribute “expression” that represents a calculation expression defined in the vocabulary “calculation” for any element of an arbitrary vocabulary. Thus, the calculation unit 190 calculates the value of the calculation expression described as an attribute value, and the calculation results are substituted for the element value of the corresponding element.
As described above, the document processing apparatus 100 according to the present embodiment enables a calculation expression, which is described in a calculation definition file, and a calculation expression, which is described in an element of an XML document in the form of a global attribute, to utilize another data set as reference data. This allows the data within a document to be effectively utilized. Note that the calculation expression may be in any desired form. Examples of such calculation expressions which can be employed in the present embodiment include: a calculation expression for substituting the same data for multiple elements, which is used for synchronizing data between the multiple elements; arithmetic expressions; and character string processing.
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, which are also encompassed in the technical scope of the present invention.
Description has been made in the aforementioned embodiment regarding an arrangement in which an XML document is processed. Also, the document processing apparatus 100 according to the present embodiment provides a function of processing a document described in other markup languages such as SGML, HTML, etc., in the same way.
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-114707 | Apr 2004 | JP | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP05/06798 | 4/6/2005 | WO | 10/10/2006 |