JP2004258773A - Document compressing device and document reconstructing device - Google Patents

Document compressing device and document reconstructing device Download PDF

Info

Publication number
JP2004258773A
JP2004258773A JP2003046217A JP2003046217A JP2004258773A JP 2004258773 A JP2004258773 A JP 2004258773A JP 2003046217 A JP2003046217 A JP 2003046217A JP 2003046217 A JP2003046217 A JP 2003046217A JP 2004258773 A JP2004258773 A JP 2004258773A
Authority
JP
Japan
Prior art keywords
document
xml document
compression
unit
attribute
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2003046217A
Other languages
Japanese (ja)
Inventor
Hironori Yamashita
洋徳 山下
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2003046217A priority Critical patent/JP2004258773A/en
Publication of JP2004258773A publication Critical patent/JP2004258773A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a document compressing device which can compress an XML document in such a manner that the XML document can be easily reconstructed without a dedicated application. <P>SOLUTION: The document compressing device is configured to compress an element specified by an XML document analyzing part 12, provide an XML document compressing part 13 which creates a correspondence list indicating the correspondence relationship between before and after compression of the element, and create an XSLT 4 for reconstruction for reference when the compressed element is reconstructed based on the correspondence list created by an XML document compressing part 13. <P>COPYRIGHT: (C)2004,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
この発明は、例えば、XML文書などの構造化文書を圧縮する文書圧縮装置と、その圧縮された構造化文書を復元する文書復元装置とに関するものである。
【0002】
【従来の技術】
近年、インターネットの普及に伴って、様々な電子データをインターネットを介してやり取りする機会が増加している。その際、データ交換方式として、XMLが採用される機会が多くなってきている。
XMLは、開始タグと終了タグによって、データである「要素」を挟む形式の文書であり、その要素の内容として、別要素を持つことができるため、入れ子になった階層的な構造を実現することができる。また、要素は「属性」を有することができる。
<要素名>要素の内容</要素名>
<要素名 属性名=“属性値”>要素の内容</要素名>
【0003】
しかし、要素名や属性名に長い名前が指定された場合、データの冗長度が高くなり、データ容量が大きくなる。
そこで、XML文書を圧縮する文書圧縮装置が以下の特許文献1に開示されているが、従来の文書圧縮装置がXML文書を圧縮した場合、専用のアプリケーションがなければ、そのXML文書を復元することができない。
【0004】
【特許文献1】
特開2001−67348公報(段落番号[0050]から[0065]、図1)
【0005】
【発明が解決しようとする課題】
従来の文書圧縮装置は以上のように構成されているので、XML文書を圧縮してデータ容量を小さくすることができるが、専用のアプリケーションがなければ、そのXML文書を復元することができず、インターネットなどを利用したXML文書の交換に適さないなどの課題があった。
【0006】
この発明は上記のような課題を解決するためになされたもので、XML文書を圧縮する際、専用のアプリケーションがなくても、簡単にXML文書を復元することができるような形式で圧縮することができる文書圧縮装置を得ることを目的とする。
また、この発明は、専用のアプリケーションがなくても、簡単にXML文書を復元することができる文書復元装置を得ることを目的とする。
【0007】
【課題を解決するための手段】
この発明に係る文書圧縮装置は、要素特定手段により特定された要素を圧縮するとともに、その要素の圧縮前後の対応関係を示す対応表を作成する要素圧縮手段を設け、その要素圧縮手段により作成された対応表に基づいて圧縮後の要素を復元する際に参照するテンプレートを生成するようにしたものである。
【0008】
【発明の実施の形態】
以下、この発明の実施の一形態を説明する。
実施の形態1.
図1はこの発明の実施の形態1による文書圧縮装置及び文書復元装置が適用されるシステムを示すシステム構成図であり、図において、文書圧縮装置2はXML文書の原文1を入力して、その原文1を圧縮するとともに、圧縮後のXML文書3を復元する際に参照する復元用XSLT4を生成する。
文書復元装置6は文書圧縮装置2からネットワーク5を介して圧縮後のXML文書3と復元用XSLT4を受信すると、その復元用XSLT4を参照してXML文書の原文1を復元する。
【0009】
図2はこの発明の実施の形態1による文書圧縮装置2を示す構成図であり、図において、XML文書入力部11は構造化文書であるXML文書を入力する。XML文書解析部12はXML文書入力部11により入力されたXML文書の構造を解析して、圧縮対象の要素を特定する。なお、XML文書解析部12は要素特定手段を構成している。
XML文書圧縮部13はXML文書解析部12により特定された要素を圧縮するとともに、その要素の圧縮前後の対応関係を示す対応表を作成する。なお、XML文書圧縮部13は要素圧縮手段を構成している。XSLT生成部14はXML文書圧縮部13により作成された対応表に基づいて圧縮後の要素を復元する際に参照する復元用XSLT4を生成する。なお、XSLT生成部14はテンプレート生成手段を構成している。
XML文書送信部15は圧縮後のXML文書3をネットワーク5を介して文書復元装置6に送信し、XSLT送信部16はXSLT生成部14により生成された復元用XSLT4をネットワーク5を介して文書復元装置6に送信する。
【0010】
図3はこの発明の実施の形態1による文書復元装置6を示す構成図であり、図において、XML文書受信部21は文書圧縮装置2から送信された圧縮後のXML文書3を受信し、XSLT受信部22は文書圧縮装置2から送信された復元用XSLT4を受信する。なお、XML文書受信部21及びXSLT受信部22から入力手段が構成されている。
XML文書復元部23はXSLT受信部22により受信された復元用XSLT4を参照して、XML文書受信部21により受信された圧縮後のXML文書3を復元する。なお、XML文書復元部23は要素復元手段を構成している。
XML文書出力部24はXML文書復元部23により復元されたXML文書を出力する。
図4はXML文書解析部12及びXML文書圧縮部13の処理内容を示すフローチャートであり、図9はXSLT生成部14の処理内容を示すフローチャートである。
【0011】
次に動作について説明する。
まず、文書圧縮装置2のXML文書入力部11がXML文書の原文1を入力すると、XML文書解析部12がXML文書入力部11により入力されたXML文書の構造を解析して、圧縮対象の要素を特定する。
XML文書圧縮部13は、XML文書解析部12により特定された要素を圧縮するとともに、その要素の圧縮前後の対応関係を示す対応表を作成する。
【0012】
具体的には、下記の通りである。
まず、XML文書の構造情報と内容をメモリ上に展開してDOMツリーを生成し(ステップST1)、処理対象を指し示すポインタをXML文書のルート要素に指定する(ステップST2)。
例えば、XML文書入力部11により図5(a)のようなXML文書が入力された場合、処理対象ポインタをルート要素である<products>に指定する。
【0013】
次に、XML文書解析部12は、そのルート要素<products>が未処理の子要素を有しているか否かを確認し(ステップST3)、そのルート要素<products>が未処理の子要素を有している場合には、処理対象ポインタをルート要素<products>から子要素に移行する(ステップST4)。
この例では、ルート要素<products>は、未処理の子要素として<product id=“0001”>を有しているので、図5(b)に示すように、処理対象ポインタを<product id=“0001”>に移行する。
【0014】
さらに、XML文書解析部12は、移行後の要素<product id=“0001”>が未処理の子要素を有しているか否かを確認し(ステップST3)、移行後の要素<product id=“0001”>が未処理の子要素を有している場合には、処理対象ポインタを要素<product id=“0001”>から子要素に移行する(ステップST4)。
この例では、要素<product id=“0001”>は、未処理の子要素として<name>を有しているので、図5(c)に示すように、処理対象ポインタを<name>に移行する。
【0015】
次に、XML文書解析部12は、移行後の要素<name>は、未処理の子要素を有していないので、要素<name>が未処理の属性を有しているか否かを確認する(ステップST5)。
この例では、要素<name>は、未処理の属性を有していないので、図5(d)に示すように、XML文書圧縮部13が要素<name>の要素名を短くする(ステップST6)。要素名を“name”→“a”のように短くしている。
XML文書圧縮部13は、このように要素名を短くすると、図6に示すように、短縮前後の要素名の対応関係を示す対応表を作成する。
【0016】
次に、XML文書解析部12は、要素<name>が親要素を有しているか否かを確認し(ステップST7)、即ち、要素<name>がルート要素であるか否かを確認し、要素<name>がルート要素ではないので、要素<name>が属性又は子要素を有しているか否かを確認する(ステップST8)。
この例では、要素<name>は、属性も子要素も有していないので、その親要素である<product id=“0001”>が内容を有しているか否かを確認する(ステップST9)。
この例では、その親要素である<product id=“0001”>は内容を有していないので、XML文書圧縮部13が図5(e)に示すように、要素<name>の開始タグと終了タグを削除して、その要素の内容“ABC”を親要素の属性として付加する(ステップST10)。即ち、要素<name>を削除して、親要素を<product id=“0001”a=“ABC”>のように変更する。
【0017】
上記のようにしてXML文書圧縮部13が要素の圧縮処理を実施して、対応表を更新すると(ステップST11またはST12)、XML文書解析部12が処理対象ポインタを親要素に移行し(ステップST13)、ステップST3の処理に戻ることにより、上記と同様の処理を繰り返し実行する。
これにより、この例では、要素<price>の要素名が“price”→“b”のように短くされたのち、要素<price>の開始タグと終了タグが削除されて、要素<price>の要素の内容“1000”が親要素の属性として付加される。
その結果、親要素が子要素を有しないようになるので、図5(f)に示すように、その親要素の終了タグ</product>を空要素タグ“/”に変更する。即ち、<product id=“0001”a=“ABC”b=“1000”/>のように変更される。
【0018】
その後、親要素<product id=“0001”a=“ABC”b=“1000”/>に処理対象ポインタが移行すると(ステップST13)、親要素<product id=“0001”a=“ABC”b=“1000”/>が未処理の子要素を有していないので(ステップST3)、XML文書解析部12が未処理の属性を有しているか否かを確認する(ステップST5)。
XML文書圧縮部13は、親要素<product id=“0001”a=“ABC”b=“1000”/>が未処理の属性“id”を有しているので、図5(g)に示すように、その属性名を短くする(ステップST14)。属性名を“id”→“c”のように短くしている。
XML文書圧縮部13は、このように属性名を短くすると、図7に示すように、短縮前後の属性名の対応関係を示す対応表を作成する。
【0019】
XML文書圧縮部13は、その後、要素<product c=“0001”a=“ABC”b=“1000”/>が未処理の属性を有しなくなると、図5(h)に示すように、要素<product c=“0001”a=“ABC”b=“1000”/>の要素名を短くする(ステップST6)。要素名を“product”→“d”のように短くしている。
XML文書圧縮部13は、このように要素名を短くすると、図8に示すように、短縮前後の要素名の対応関係を示す対応表を作成する。
【0020】
その後、ルート要素<products>に処理対象ポインタが移行すると(ステップST13)、XML文書圧縮部13は、図5(i)に示すように、ルート要素<products>の要素名を短くする。要素名を“products”→“e”のように短くしている。
XML文書圧縮部13は、このように要素名を短くすると、図8に示すように、短縮前後の要素名の対応関係を示す対応表を作成する(ステップST16)。
【0021】
XSLT生成部14は、上記のようにして、XML文書圧縮部13がXML文書の圧縮処理を終了すると、その際に作成された図6〜図8の対応表に基づいて圧縮後の要素を復元する際に参照する復元用XSLT4を生成する(ステップST17)。
即ち、属性として変換された葉要素(属性や子要素を有しない要素)や属性は、XSLTのテンプレートとして記述し、親要素となる要素は、子要素へのテンプレート適用を記述したテンプレートとして記述する。具体的には次の通りである。
【0022】
まず、XSLT生成部14は、図6の対応表の各要素をXSLTのテンプレートにする(ステップST21)。
次に、XSLT生成部14は、図7の対応表の各属性をXSLTのテンプレートにする(ステップST22)。
次に、XSLT生成部14は、図8の対応表の各要素をXSLTのテンプレートにする(ステップST23)。
【0023】
次に、XSLT生成部14は、図7の対応表から該当する要素に属する属性を探して、テンプレートを適用する(ステップST24)。
次に、XSLT生成部14は、図6の対応表から該当する要素に属する葉要素を探し、テンプレートを適用する(ステップST25)。
XSLT生成部14は、図8の対応表における全ての要素について、テンプレートを作成するまで、ステップST24,ST25の処理を繰り返し実行する(ステップST26)。
図10はXSLT生成部14により生成された復元用XSLT4の一例を示している。
【0024】
XML文書送信部15は、圧縮後のXML文書3をネットワーク5を介して文書復元装置6に送信し、XSLT送信部16はXSLT生成部14により生成された復元用XSLT4をネットワーク5を介して文書復元装置6に送信する。
【0025】
一方、文書復元装置6のXML文書復元部23は、XML文書受信部21が文書圧縮装置2から送信された圧縮後のXML文書3を受信し、XSLT受信部22が文書圧縮装置2から送信された復元用XSLT4を受信すると、その復元用XSLT4を参照して、圧縮後のXML文書3を復元する。
即ち、復元処理は、XML文書形式で記述されている復元用XSLT4の記述内容を順次実行することにより、圧縮後のXML文書3を復元する。図11は復元処理の処理内容を示しており、図11(k)が復元されたXML文書に相当する。
【0026】
以上で明らかなように、この実施の形態1によれば、XML文書解析部12により特定された要素を圧縮するとともに、その要素の圧縮前後の対応関係を示す対応表を作成するXML文書圧縮部13を設け、そのXML文書圧縮部13により作成された対応表に基づいて圧縮後の要素を復元する際に参照する復元用XSLT4を生成するように構成したので、XML文書を圧縮する際、専用のアプリケーションがなくても、簡単にXML文書を復元することができるような形式で圧縮することができる効果を奏する。
また、この実施の形態1によれば、文書圧縮装置により生成された復元用XSLT4を参照して、文書圧縮装置により圧縮されたXML文書の要素を復元するように構成したので、専用のアプリケーションがなくても、簡単にXML文書を復元することができる効果を奏する。
【0027】
この実施の形態1によれば、XML文書解析部12により特定された要素が属性及び子要素を有しない場合、その要素の開始タグと終了タグを削除し、その要素の内容を親要素の属性として付加するように構成したので、XML文書の容量を小さくすることができる効果を奏する。
また、この実施の形態1によれば、XML文書解析部12により特定された要素が子要素を有しないが属性を有する場合、その属性名を短縮化して、短縮化前後の属性名の対応関係を示す対応表を作成するように構成したので、XML文書の容量を小さくすることができるとともに、容易にXML文書を復元することができる効果を奏する。
【0028】
さらに、この実施の形態1によれば、要素の開始タグと終了タグを削除し、その要素の内容を親要素の属性として付加することにより、親要素が子要素を持たなくなると、その親要素の終了タグを空要素タグに変更するように構成したので、XML文書の容量を小さくすることができる効果を奏する。
また、この実施の形態1によれば、親要素の要素名及び属性名を短縮化して、短縮化前後の要素名及び属性名の対応関係を示す対応表を作成するように構成したので、XML文書の容量を小さくすることができるとともに、容易にXML文書を復元することができる効果を奏する。
【0029】
【発明の効果】
以上のように、この発明によれば、要素特定手段により特定された要素を圧縮するとともに、その要素の圧縮前後の対応関係を示す対応表を作成する要素圧縮手段を設け、その要素圧縮手段により作成された対応表に基づいて圧縮後の要素を復元する際に参照するテンプレートを生成するように構成したので、XML文書を圧縮する際、専用のアプリケーションがなくても、簡単にXML文書を復元することができるような形式で圧縮することができる効果がある。
【図面の簡単な説明】
【図1】この発明の実施の形態1による文書圧縮装置及び文書復元装置が適用されるシステムを示すシステム構成図である。
【図2】この発明の実施の形態1による文書圧縮装置を示す構成図である。
【図3】この発明の実施の形態1による文書復元装置を示す構成図である。
【図4】XML文書解析部及びXML文書圧縮部の処理内容を示すフローチャートである。
【図5】圧縮処理の処理内容を示す説明図である。
【図6】葉要素名と短文字列の対応表を示す説明図である。
【図7】属性名と短文字列の対応表を示す説明図である。
【図8】要素名と短文字列の対応表を示す説明図である。
【図9】XSLT生成部の処理内容を示すフローチャートである。
【図10】復元用XSLTを示す説明図である。
【図11】復元処理の処理内容を示す説明図である。
【符号の説明】
1 XML文書の原文、2 文書圧縮装置、3 圧縮後のXML文書、4 復元用XSLT、5 ネットワーク、6 文書復元装置、11 XML文書入力部、12 XML文書解析部(要素特定手段)、13 XML文書圧縮部(要素圧縮手段)、14 XSLT生成部(テンプレート生成手段)、15 XML文書送信部、16 XSLT送信部、21 XML文書受信部(入力手段)、22 XSLT受信部(入力手段)、23 XML文書復元部(要素復元手段)、24XML文書出力部。
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a document compression apparatus for compressing a structured document such as an XML document and a document restoration apparatus for restoring the compressed structured document.
[0002]
[Prior art]
In recent years, with the spread of the Internet, opportunities for exchanging various electronic data via the Internet have increased. At that time, XML is increasingly used as a data exchange method.
XML is a document in a format in which data "elements" are sandwiched between a start tag and an end tag. Since the content of the element can have another element, a nested hierarchical structure is realized. be able to. Elements can also have “attributes”.
<Element name> Element content </ Element name>
<Element name attribute name = "attribute value"> element content </ element name>
[0003]
However, when a long name is specified for an element name or an attribute name, data redundancy increases and data capacity increases.
Therefore, a document compression apparatus for compressing an XML document is disclosed in Patent Document 1 below. However, when a conventional document compression apparatus compresses an XML document, if there is no dedicated application, the XML document is restored. Can not.
[0004]
[Patent Document 1]
JP 2001-67348 A (paragraph numbers [0050] to [0065], FIG. 1)
[0005]
[Problems to be solved by the invention]
Since the conventional document compression apparatus is configured as described above, the data volume can be reduced by compressing the XML document. However, without a dedicated application, the XML document cannot be restored. There is a problem that it is not suitable for exchanging XML documents using the Internet or the like.
[0006]
SUMMARY OF THE INVENTION The present invention has been made to solve the above-described problem. When an XML document is compressed, the compression is performed in such a format that the XML document can be easily restored without a dedicated application. It is an object of the present invention to obtain a document compression apparatus capable of performing the above.
Another object of the present invention is to provide a document restoring apparatus capable of easily restoring an XML document without a dedicated application.
[0007]
[Means for Solving the Problems]
The document compression apparatus according to the present invention includes an element compression unit that compresses the element specified by the element specification unit and creates a correspondence table indicating a correspondence relationship between the element before and after the compression. Based on the correspondence table, a template to be referred to when the compressed element is restored is generated.
[0008]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an embodiment of the present invention will be described.
Embodiment 1 FIG.
FIG. 1 is a system configuration diagram showing a system to which a document compression apparatus and a document decompression apparatus according to Embodiment 1 of the present invention are applied. In FIG. 1, a document compression apparatus 2 inputs an original 1 of an XML document and The original document 1 is compressed, and a restoring XSLT 4 to be referred to when the compressed XML document 3 is restored is generated.
Upon receiving the compressed XML document 3 and the restoring XSLT 4 from the document compression device 2 via the network 5, the document restoring device 6 refers to the restoring XSLT 4 to restore the original document 1 of the XML document.
[0009]
FIG. 2 is a configuration diagram showing the document compression apparatus 2 according to the first embodiment of the present invention. In the figure, an XML document input unit 11 inputs an XML document that is a structured document. The XML document analysis unit 12 analyzes the structure of the XML document input by the XML document input unit 11 and specifies an element to be compressed. Note that the XML document analysis unit 12 constitutes an element specifying unit.
The XML document compression unit 13 compresses the element specified by the XML document analysis unit 12 and creates a correspondence table indicating the correspondence of the element before and after compression. Note that the XML document compression unit 13 constitutes element compression means. The XSLT generating unit 14 generates a restoring XSLT 4 that is referred to when restoring the compressed element based on the correspondence table created by the XML document compressing unit 13. Note that the XSLT generation unit 14 forms a template generation unit.
The XML document transmitting unit 15 transmits the compressed XML document 3 to the document restoring device 6 via the network 5, and the XSLT transmitting unit 16 restores the restoring XSLT 4 generated by the XSLT generating unit 14 via the network 5. Transmit to the device 6.
[0010]
FIG. 3 is a block diagram showing a document restoring device 6 according to the first embodiment of the present invention. In FIG. 3, an XML document receiving unit 21 receives a compressed XML document 3 transmitted from the document compressing device 2 and performs XSLT The receiving unit 22 receives the decompressing XSLT 4 transmitted from the document compression device 2. The XML document receiving unit 21 and the XSLT receiving unit 22 constitute an input unit.
The XML document restoring unit 23 refers to the restoring XSLT 4 received by the XSLT receiving unit 22 and restores the compressed XML document 3 received by the XML document receiving unit 21. Note that the XML document restoring unit 23 constitutes an element restoring unit.
The XML document output unit 24 outputs the XML document restored by the XML document restoration unit 23.
FIG. 4 is a flowchart showing the processing contents of the XML document analysis unit 12 and the XML document compression unit 13, and FIG. 9 is a flowchart showing the processing contents of the XSLT generation unit 14.
[0011]
Next, the operation will be described.
First, when the XML document input unit 11 of the document compression apparatus 2 inputs the original document 1 of the XML document, the XML document analysis unit 12 analyzes the structure of the XML document input by the XML document input unit 11 and generates a compression target element. To identify.
The XML document compression unit 13 compresses the element specified by the XML document analysis unit 12 and creates a correspondence table indicating the correspondence of the element before and after compression.
[0012]
Specifically, it is as follows.
First, the structure information and the contents of the XML document are expanded on the memory to generate a DOM tree (step ST1), and a pointer indicating a processing target is designated as a root element of the XML document (step ST2).
For example, when an XML document as shown in FIG. 5A is input by the XML document input unit 11, the processing target pointer is designated as a root element <products>.
[0013]
Next, the XML document analysis unit 12 checks whether or not the root element <products> has an unprocessed child element (step ST3), and determines whether the root element <products> has an unprocessed child element. If so, the processing target pointer is shifted from the root element <products> to the child element (step ST4).
In this example, since the root element <products> has <product id = "0001"> as an unprocessed child element, as shown in FIG. 5B, the processing target pointer is set to <product id = <0001 >>.
[0014]
Further, the XML document analysis unit 12 checks whether or not the migrated element <product id = "0001"> has an unprocessed child element (step ST3), and the migrated element <product id = If “0001”> has an unprocessed child element, the processing target pointer is shifted from the element <product id = “0001”> to the child element (step ST4).
In this example, since the element <product id = "0001"> has <name> as an unprocessed child element, the processing target pointer is shifted to <name> as shown in FIG. I do.
[0015]
Next, since the element <name> after the migration does not have an unprocessed child element, the XML document analysis unit 12 checks whether the element <name> has an unprocessed attribute. (Step ST5).
In this example, since the element <name> has no unprocessed attribute, the XML document compression unit 13 shortens the element name of the element <name> as shown in FIG. 5D (step ST6). ). The element name is shortened as "name" → "a".
When the element names are shortened in this way, the XML document compression unit 13 creates a correspondence table indicating the correspondence between the element names before and after the shortening, as shown in FIG.
[0016]
Next, the XML document analysis unit 12 checks whether the element <name> has a parent element (step ST7), that is, checks whether the element <name> is a root element. Since the element <name> is not the root element, it is checked whether the element <name> has an attribute or a child element (step ST8).
In this example, since the element <name> has neither an attribute nor a child element, it is confirmed whether or not the parent element <product id = "0001"> has the content (step ST9). .
In this example, since the parent element <product id = “0001”> has no content, the XML document compression unit 13 sets the start tag of the element <name> as shown in FIG. The end tag is deleted, and the content "ABC" of the element is added as an attribute of the parent element (step ST10). That is, the element <name> is deleted, and the parent element is changed to <product id = “0001” a = “ABC”>.
[0017]
When the XML document compression unit 13 performs the element compression process and updates the correspondence table as described above (step ST11 or ST12), the XML document analysis unit 12 shifts the processing target pointer to the parent element (step ST13). ), By returning to the processing of step ST3, the same processing as described above is repeatedly executed.
Thus, in this example, after the element name of the element <price> is shortened from “price” to “b”, the start tag and the end tag of the element <price> are deleted, and the element <price> is deleted. The element content "1000" is added as an attribute of the parent element.
As a result, the parent element has no child element, so that the end tag </ product> of the parent element is changed to an empty element tag “/” as shown in FIG. That is, it is changed as <product id = “0001” a = “ABC” b = “1000” />.
[0018]
Thereafter, when the processing target pointer moves to the parent element <product id = “0001” a = “ABC” b = “1000” /> (step ST13), the parent element <product id = “0001” a = “ABC” b Since “=“ 1000 ”/> has no unprocessed child element (step ST3), it is checked whether the XML document analysis unit 12 has an unprocessed attribute (step ST5).
Since the parent element <product id = “0001” a = “ABC” b = “1000” /> has an unprocessed attribute “id”, the XML document compression unit 13 shown in FIG. Thus, the attribute name is shortened (step ST14). The attribute names are shortened, such as "id" → "c".
When the attribute names are shortened in this way, the XML document compression unit 13 creates a correspondence table indicating the correspondence between the attribute names before and after the shortening, as shown in FIG.
[0019]
After that, when the element <product c = “0001” a = “ABC” b = “1000” /> has no unprocessed attribute, the XML document compressing unit 13 performs the following processing as shown in FIG. The element name of the element <product c = “0001” a = “ABC” b = “1000” /> is shortened (step ST6). The element name is shortened, such as "product" → "d".
When the element names are shortened in this way, the XML document compression unit 13 creates a correspondence table indicating the correspondence between the element names before and after the shortening, as shown in FIG.
[0020]
Thereafter, when the processing target pointer moves to the root element <products> (step ST13), the XML document compression unit 13 shortens the element name of the root element <products> as shown in FIG. 5 (i). The element names are shortened, such as "products" → "e".
When the element names are shortened in this way, the XML document compression unit 13 creates a correspondence table indicating the correspondence between the element names before and after the shortening as shown in FIG. 8 (step ST16).
[0021]
When the XML document compression unit 13 completes the compression processing of the XML document as described above, the XSLT generation unit 14 restores the compressed elements based on the correspondence tables created at that time in FIGS. Then, a restoring XSLT 4 to be referred to when performing the process is generated (step ST17).
That is, leaf elements (elements having no attribute or child element) and attributes converted as attributes are described as an XSLT template, and an element serving as a parent element is described as a template that describes application of a template to a child element. . Specifically, it is as follows.
[0022]
First, the XSLT generation unit 14 uses each element of the correspondence table in FIG. 6 as an XSLT template (step ST21).
Next, the XSLT generation unit 14 uses each attribute of the correspondence table of FIG. 7 as an XSLT template (step ST22).
Next, the XSLT generation unit 14 uses each element of the correspondence table in FIG. 8 as an XSLT template (step ST23).
[0023]
Next, the XSLT generation unit 14 searches for the attribute belonging to the corresponding element from the correspondence table in FIG. 7, and applies the template (step ST24).
Next, the XSLT generation unit 14 searches for a leaf element belonging to the corresponding element from the correspondence table in FIG. 6, and applies the template (step ST25).
The XSLT generation unit 14 repeatedly executes the processing of steps ST24 and ST25 until a template is created for all elements in the correspondence table of FIG. 8 (step ST26).
FIG. 10 shows an example of the restoration XSLT 4 generated by the XSLT generation unit 14.
[0024]
The XML document transmitting unit 15 transmits the compressed XML document 3 to the document restoring device 6 via the network 5, and the XSLT transmitting unit 16 transmits the restoring XSLT 4 generated by the XSLT generating unit 14 to the document via the network 5. The data is transmitted to the restoration device 6.
[0025]
On the other hand, the XML document restoring unit 23 of the document restoring device 6 receives the compressed XML document 3 transmitted from the document compressing device 2 by the XML document receiving unit 21, and transmits the XML document 3 transmitted from the document compressing device 2 by the XSLT receiving unit 22. When the restored XSLT 4 is received, the compressed XML document 3 is restored with reference to the restored XSLT 4.
That is, in the decompression process, the compressed XML document 3 is decompressed by sequentially executing the description contents of the decompression XSLT 4 described in the XML document format. FIG. 11 shows the contents of the restoration processing, and FIG. 11 (k) corresponds to the restored XML document.
[0026]
As is clear from the above, according to the first embodiment, the XML document compression unit that compresses the element specified by the XML document analysis unit 12 and creates a correspondence table indicating the correspondence between the element before and after the compression. 13 is configured to generate the restoring XSLT 4 that is referred to when restoring the compressed element based on the correspondence table created by the XML document compressing unit 13. Thus, it is possible to compress the XML document in a format that can easily restore the XML document without the application.
Further, according to the first embodiment, the configuration is such that the elements of the XML document compressed by the document compression device are restored with reference to the decompression XSLT 4 generated by the document compression device. Even if there is no XML document, it is possible to easily restore the XML document.
[0027]
According to the first embodiment, when the element specified by the XML document analysis unit 12 has no attribute and no child element, the start tag and the end tag of the element are deleted, and the content of the element is changed to the attribute of the parent element. Since the configuration is such that the XML document is added, the capacity of the XML document can be reduced.
According to the first embodiment, when the element specified by the XML document analysis unit 12 does not have a child element but has an attribute, the attribute name is shortened, and the correspondence between the attribute names before and after the shortening is reduced. Is generated so that the capacity of the XML document can be reduced and the XML document can be easily restored.
[0028]
Further, according to the first embodiment, by deleting the start tag and end tag of an element and adding the content of the element as an attribute of the parent element, when the parent element has no child element, Is changed to an empty element tag, so that the capacity of the XML document can be reduced.
According to the first embodiment, the element name and the attribute name of the parent element are shortened, and the correspondence table indicating the correspondence between the element name and the attribute name before and after the shortening is created. It is possible to reduce the size of the document and to easily restore the XML document.
[0029]
【The invention's effect】
As described above, according to the present invention, the element specified by the element specifying means is compressed, and the element compression means for creating a correspondence table indicating a correspondence relationship between before and after the compression of the element is provided. Since the template to be referred to when restoring the compressed element is generated based on the created correspondence table, when the XML document is compressed, the XML document can be easily restored even if there is no dedicated application. There is an effect that compression can be performed in a format that can be performed.
[Brief description of the drawings]
FIG. 1 is a system configuration diagram showing a system to which a document compression device and a document decompression device according to a first embodiment of the present invention are applied;
FIG. 2 is a configuration diagram showing a document compression apparatus according to Embodiment 1 of the present invention.
FIG. 3 is a configuration diagram showing a document restoration device according to the first embodiment of the present invention.
FIG. 4 is a flowchart showing processing contents of an XML document analysis unit and an XML document compression unit.
FIG. 5 is an explanatory diagram showing processing contents of a compression processing.
FIG. 6 is an explanatory diagram showing a correspondence table between leaf element names and short character strings.
FIG. 7 is an explanatory diagram showing a correspondence table between attribute names and short character strings.
FIG. 8 is an explanatory diagram showing a correspondence table between element names and short character strings.
FIG. 9 is a flowchart illustrating processing performed by an XSLT generation unit;
FIG. 10 is an explanatory diagram showing a restoring XSLT.
FIG. 11 is an explanatory diagram illustrating processing contents of a restoration processing;
[Explanation of symbols]
1 original document of XML document, 2 document compression device, 3 compressed XML document, 4 restoration XSLT, 5 network, 6 document restoration device, 11 XML document input unit, 12 XML document analysis unit (element specifying means), 13 XML Document compression unit (element compression unit), 14 XSLT generation unit (template generation unit), 15 XML document transmission unit, 16 XSLT transmission unit, 21 XML document reception unit (input unit), 22 XSLT reception unit (input unit), 23 An XML document restoring unit (element restoring unit) and a 24 XML document outputting unit;

Claims (6)

構造化文書の構造を解析して、圧縮対象の要素を特定する要素特定手段と、上記要素特定手段により特定された要素を圧縮するとともに、その要素の圧縮前後の対応関係を示す対応表を作成する要素圧縮手段と、上記要素圧縮手段により作成された対応表に基づいて圧縮後の要素を復元する際に参照するテンプレートを生成するテンプレート生成手段とを備えた文書圧縮装置。Analyzes the structure of the structured document and creates an element identification unit that identifies the element to be compressed, and a correspondence table that compresses the element identified by the element identification unit and shows the correspondence of the element before and after compression A document compression apparatus comprising: an element compression unit that performs compression; and a template generation unit that generates a template to be referred to when restoring the compressed element based on the correspondence table created by the element compression unit. 要素圧縮手段は、要素特定手段により特定された要素が属性及び子要素を有しない場合、その要素の開始タグと終了タグを削除し、その要素の内容を親要素の属性として付加することを特徴とする請求項1記載の文書圧縮装置。When the element specified by the element specifying means has no attribute and no child element, the element compressing means deletes a start tag and an end tag of the element and adds the content of the element as an attribute of the parent element. 2. The document compression apparatus according to claim 1, wherein: 要素圧縮手段は、要素特定手段により特定された要素が子要素を有しないが属性を有する場合、その属性名を短縮化して、短縮化前後の属性名の対応関係を示す対応表を作成することを特徴とする請求項1記載の文書圧縮装置。When the element specified by the element specifying means does not have a child element but has an attribute, the element compressing means shortens the attribute name and creates a correspondence table indicating a correspondence relationship between the attribute names before and after the shortening. The document compression apparatus according to claim 1, wherein: 要素圧縮手段は、要素の開始タグと終了タグを削除し、その要素の内容を親要素の属性として付加することにより、親要素が子要素を持たなくなると、その親要素の終了タグを空要素タグに変更することを特徴とする請求項2記載の文書圧縮装置。The element compression means deletes the start tag and the end tag of the element and adds the content of the element as an attribute of the parent element. When the parent element has no child element, the end tag of the parent element is set to an empty element. 3. The document compression apparatus according to claim 2, wherein the apparatus is changed to a tag. 要素圧縮手段は、親要素の要素名及び属性名を短縮化して、短縮化前後の要素名及び属性名の対応関係を示す対応表を作成することを特徴とする請求項2記載の文書圧縮装置。3. The document compression apparatus according to claim 2, wherein the element compression unit shortens the element names and the attribute names of the parent element and creates a correspondence table indicating the correspondence between the element names and the attribute names before and after the shortening. . 文書圧縮装置により要素が圧縮された構造化文書と上記文書圧縮装置により生成されたテンプレートとを入力する入力手段と、上記入力手段により入力されたテンプレートを参照して、その圧縮された要素を復元する要素復元手段とを備えた文書復元装置。Input means for inputting a structured document whose elements have been compressed by the document compression apparatus and a template generated by the document compression apparatus; and decompressing the compressed elements by referring to the template input by the input means. Document restoring device, comprising:
JP2003046217A 2003-02-24 2003-02-24 Document compressing device and document reconstructing device Pending JP2004258773A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003046217A JP2004258773A (en) 2003-02-24 2003-02-24 Document compressing device and document reconstructing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003046217A JP2004258773A (en) 2003-02-24 2003-02-24 Document compressing device and document reconstructing device

Publications (1)

Publication Number Publication Date
JP2004258773A true JP2004258773A (en) 2004-09-16

Family

ID=33112818

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003046217A Pending JP2004258773A (en) 2003-02-24 2003-02-24 Document compressing device and document reconstructing device

Country Status (1)

Country Link
JP (1) JP2004258773A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100354862C (en) * 2004-11-19 2007-12-12 北京九州软件有限公司 Storage and analytic method for computer document
JP2008219264A (en) * 2007-03-01 2008-09-18 Ntt Communications Kk Data compression and transfer device, data compression and transfer system, data compressing and transferring method, and data compression and transfer program
JP2010267034A (en) * 2009-05-13 2010-11-25 Canon Inc Information processing apparatus and information processing method
US9110874B2 (en) 2007-09-03 2015-08-18 Canon Kabushiki Kaisha Document conversion apparatus and document conversion method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100354862C (en) * 2004-11-19 2007-12-12 北京九州软件有限公司 Storage and analytic method for computer document
JP2008219264A (en) * 2007-03-01 2008-09-18 Ntt Communications Kk Data compression and transfer device, data compression and transfer system, data compressing and transferring method, and data compression and transfer program
US9110874B2 (en) 2007-09-03 2015-08-18 Canon Kabushiki Kaisha Document conversion apparatus and document conversion method
JP2010267034A (en) * 2009-05-13 2010-11-25 Canon Inc Information processing apparatus and information processing method

Similar Documents

Publication Publication Date Title
KR101247075B1 (en) Encoding of markup-language data
JP3832807B2 (en) Data processing method and encoder, decoder and XML parser using the method
Girardot et al. Millau: an encoding format for efficient representation and exchange of XML over the Web
US6020972A (en) System for performing collective symbol-based compression of a corpus of document images
JP3973557B2 (en) Method for compressing / decompressing structured documents
JP4373721B2 (en) Method and system for encoding markup language documents
US7924183B2 (en) Method and system for reducing required storage during decompression of a compressed file
US7320003B2 (en) Method and system for storing and retrieving document data using a markup language string and a serialized string
US20030098877A1 (en) Method and system for appending information to graphical files stored in specific graphical file formats
JP2015529874A (en) System and method for viewing medical images
US9338258B2 (en) Methods and network devices for communicating data packets
US6850948B1 (en) Method and apparatus for compressing textual documents
US20060218161A1 (en) Systems and methods for efficiently compressing and decompressing markup language
JP2000076118A (en) Distributed file processor and distributed file processing method
JP2006323821A (en) Method and system for sequentially accessing compiled schema
JP2004302799A (en) Computer system, computer program, communication method between computers, encoding method of structured document, and decoding method of encoded structured document
JP4776389B2 (en) Encoded document decoding method and system
JP2004258773A (en) Document compressing device and document reconstructing device
JP2013008395A (en) Display system and method for acceptance state
JP2010282587A (en) Mash up program, mash up device, and mash up method
US20070300147A1 (en) Compression of mark-up language data
US20120084635A1 (en) Parameterized template compression for binary xml
JP4241920B2 (en) Data communication method
CN109783160B (en) Webpage file loading system and method for rapid transmission and rendering
JP3974606B2 (en) Structured document conversion apparatus, structured document conversion method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060120

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070601

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070605

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070717

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070821