JP2004287978A - Method and program for dividing structured document - Google Patents
Method and program for dividing structured document Download PDFInfo
- Publication number
- JP2004287978A JP2004287978A JP2003080747A JP2003080747A JP2004287978A JP 2004287978 A JP2004287978 A JP 2004287978A JP 2003080747 A JP2003080747 A JP 2003080747A JP 2003080747 A JP2003080747 A JP 2003080747A JP 2004287978 A JP2004287978 A JP 2004287978A
- Authority
- JP
- Japan
- Prior art keywords
- tag
- document
- xml document
- structured document
- buffer
- 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.)
- Granted
Links
Images
Landscapes
- Document Processing Apparatus (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、タグを用いて論理的に木構造で表現される入れ子構造を持つ構造化文書を処理するのに好適な、構造化文書の分割方法及びプログラムに関する。
【0002】
【従来の技術】
現在、あらゆるデータを記述する手段として、XML(Extensible Markup Language)が広く利用されている。このXMLを用いて記述された文書(データ)はXML文書(XMLデータ)と呼ばれる。XML文書は、タグを用いて論理的に木構造で表現される構造化文書として知られており、以下のような特徴を持つ。第1の特徴は、XML文書が階層構造で表現され、無制限の入れ子構造を許す点にある。第2の特徴は、XML文書が繰り返し構造を持ち、無制限の不定繰り返しを許す点にある(例えば、非特許文献1参照)。
【0003】
XML文書は、その記述形式から、インターネット上でのデータ可搬性に優れている。このためXML文書は、特に異なるアプリケーション間或いは異なるシステム間のデータ交換に広く利用されるようになってきている。XML文書はインターネット上のHTTP(Hyper Text Transfer Protocol)プロトコル、或いはHTTPプロトコル上のSOAP(Simple Object Access Protocol)プロトコルに従って転送されることが多い。このプロトコルでは、XML文書を構成するデータ(XMLデータ)は、単純に当該データが読み込まれた順番に転送される。
【0004】
転送されたXML文書はアプリケーションにより処理される。現在XMLを処理する技術として以下の2種類が広く使われている。第1はSAX(Simple API for XML)と呼ばれる技術である。SAXでは、XML文書が逐次的に処理されるため、階層構造を扱えない。但し、SAXでは、必要とするメモリ容量が少なくて済む。第2はDOM(Document Object Model)と呼ばれる技術である。DOMでは、XML文書全体の要素を解析してから処理されるため、階層構造を扱いやすい。しかし、必要とするメモリ容量が大きい
【0005】
【非特許文献1】
中山幹敏、奥井康弘著,「改訂版 標準XML 完全解説(上)/(下)」,初版,技術評論社,平成13年4月25日
【0006】
【発明が解決しようとする課題】
上記したように従来技術においては、XML文書(タグを用いて論理的に木構造で表現される構造化文書)を構成するデータは、単純に当該データが読み込まれた順番に転送される。つまり従来技術においては、XML文書を転送するのに、当該XML文書をXML構造として分割する手段を有していない。このため、例えばアプリケーションに転送されたXML文書を、当該アプリケーションが上記DOM技術或いはSAX技術を利用して処理するには、まずXML文書全体の転送が完了している必要がある。したがって、XML文書をアプリケーションに転送して処理を行う場合、当該XML文書の転送が完了するまでアプリケーション側での処理が待たされ、処理の開始が遅れる。つまり従来技術にあっては、XML文書の転送開始から転送されたXML文書を処理し終えるまでの全体の処理時間が長くなるという問題がある。また従来技術にあっては、XML文書全体を読み込んでから当該文書が処理されるため、必要となるメモリ容量が増加するという問題もある。
【0007】
本発明は上記事情を考慮してなされたものでその目的は、入れ子構造を持つ構造化文書を分割して、入れ子構造を持つ複数の構造化文書に整形することにより、構造化文書を受け取って処理するのに必要となるメモリ容量を少なくすると共に処理時間を短縮できる、構造化文書の分割方法及びプログラムを提供することにある。
【0008】
【課題を解決するための手段】
本発明の1つの観点によれば、タグを用いて論理的に木構造で表現される入れ子構造を持つ構造化文書をコンピュータにより分割する構造化文書の分割方法が提供される。この方法は、分割の対象となる構造化文書のデータを先頭から順にバッファに読み込むステップと、上記バッファに読み込まれたデータを順に処理することにより、上記分割の対象となる構造化文書(原構造化文書)を複数の新たな構造化文書に分割・整形するステップと、原構造化文書から新たな構造化文書が分割・整形される都度、当該新たな構造化文書を文書処理手段に渡すステップとを備えている。
【0009】
このような構成においては、原構造化文書の分割された文書部分が、構造化された新たな構造化文書に整形されるため、入れ子構造を持つ構造化文書としての特徴を保持している。このため、構造化文書を処理する処理手段は、長大な構造化文書を扱うに当たって、従来技術とは異なって、全体を受け取るまで待たなくても、分割・整形された新たな構造化文書が生成される毎に、その新たな構造化文書を受け取って処理することができる。その結果、構造化文書を処理するのに必要とされるメモリ容量の減少、処理手段を利用する利用者への応答性能向上を図ることができる。
【0010】
ここで、原構造化文書から新たな構造化文書を分割・整形するのに、上記分割・整形ステップに、以下のステップ、即ち、読み込まれたデータが開始タグの場合に、当該開始タグに対応する終了タグをバッファ上で強制的に挿入するステップと、原構造化文書からのデータの読み込みの途中のために構造が特定できない部分に対応し、構造化文書の分割の途中地点であることを示す区切りタグを上記バッファ上で挿入するステップとを含めるとよい。この区切りタグを含む新たな構造化文書を処理手段が処理する場合、当該区切りタグを検出するまでは当該新たな構造化文書の先頭から処理を行い、当該区切りタグを検出した段階で処理を中断して、次の新たな構造化文書を受け取った際に、上記区切りタグを当該次の新たな構造化文書に置き換えて処理を再開すればよい。
【0011】
ここで、上記区切りタグを挿入するステップでは、バッファに開始タグが格納されていない状態で当該バッファに開始タグが読み込まれた場合、上記区切りタグが当該開始タグの後に挿入され、上記終了タグを挿入するステップでは、開始タグの後に挿入された区切りタグの後に、当該開始タグに対応する終了タグが挿入される構成とするとよい。
【0012】
また、原構造化文書から新たな構造化文書を分割・整形するために、区切りタグが挿入された後に新たに開始タグがバッファに読み込まれた場合には、当該新たに読み込まれた開始タグをバッファ上で上記区切りタグの前に移動し、この区切りタグの後に上記新たに読み込まれた開始タグに対応する終了タグを挿入するとよい。同様に原構造化文書から新たな構造化文書を分割・整形するために、テキストが読み込まれた場合には、当該テキストをバッファ上で区切りタグの前に移動するとよい。同様に、読み込まれたデータが終了タグで、且つ当該終了タグと同一の終了タグが強制的に挿入された構造化文書が既に処理手段に渡されている場合には、読み込まれた終了タグを、終了タグが存在することを処理手段に通知するためのダミー終了タグに置き換えるとよい。このダミー終了タグを含む構造化文書で区切りタグが置き換えられた構造化文書を処理手段が処理する場合、そのダミー終了タグを削除し、その位置に、当該ダミー終了タグの数に一致する数の、当該区切りタグが置き換えられた構造化文書の最後尾側の終了タグを移動すればよい。
【0013】
【発明の実施の形態】
以下、本発明の実施の形態につき図面を参照して説明する。図1は本発明の一実施形態に係るコンピュータシステムの構成を示すブロック図である。図1のシステムは、物理的に異なる2つのコンピュータ11及び12と、当該コンピュータ11及び12を接続するネットワーク通信路13とから構成される。
【0014】
コンピュータ11は、磁気ディスク装置に代表される記憶装置111と当該コンピュータ11上で動作するXML文書分割送信装置112と文書バッファ113とを備えている。記憶装置111には、XML文書(XMLドキュメント)114が格納されている。XML文書114は、タグを用いて論理的に木構造で表現される入れ子構造を持つ構造化文書である。つまりXML文書114は、タグにより構造化された性質を持つ構造化文書である。記憶装置111にはまた、コンピュータ11内のCPU(図示せず)によって実行されるプログラム(構造化文書の分割送信用プログラム)115が格納されている。
【0015】
XML文書分割送信装置112は、コンピュータ11内のCPUがプログラム115を実行することにより実現される機能ブロックである。XML文書分割送信装置112は、XML文書読み取り部112aと、XML文書分割部112bと、XML文書送信部112cとを有する。XML文書読み取り部112aは、記憶装置111に格納されているXML文書114をコンピュータ12に転送する必要がある場合、当該XML文書114のデータを先頭から順に読み取る機能を有する。XML文書分割部112bは、XML文書読み取り部112aによるXML文書114の読み取りと並行して、当該XML文書読み取り部112aにより読み取られたXML文書114を順次分割する機能を有する。XML文書分割部112bはまた、分割されたXML文書114の部分を、XMLとしての構造を持つ1つの新たなXML文書に整形する機能を有する。XML文書送信部112cは、XML文書分割部112bにより分割されてXML文書に整形される毎に、そのXML文書をネットワーク通信路13を介してコンピュータ12に送信する機能を有する。文書バッファ113は、XML文書読み取り部112a、XML文書分割部112b及びXML文書送信部112cにより処理されるデータを一時格納するのに用いられる。
【0016】
コンピュータ12は、受信装置121と、アプリケーション(アプリケーションプログラム)122とを備えている。受信装置121は、コンピュータ11からネットワーク通信路13経由で送信されたXML文書を受信するXML文書受信部121aと、当該XML文書受信部121aにより受信されたXML文書をアプリケーション122に渡すアプリケーションプログラムインタフェース(以下、APIと称する)121bとを有する。アプリケーション122は、API121bから渡されたXML文書を処理するための処理ルーチンを含む。
【0017】
次に、図1のシステムにおいて、コンピュータ11側でXML文書を分割・整形してコンピュータ12に転送し、その分割・整形されたXML文書をコンピュータ12側で処理する動作の概要について、図2の動作説明図を参照して説明する。
【0018】
コンピュータ11において、XML文書分割送信装置112内のXML文書読み取り部112aは、記憶装置111にアクセスして、コンピュータ12に転送すべきXML文書114のデータを先頭から順に読み取る(ステップS1)。XML文書分割送信装置112内のXML文書分割部112bは、XML文書読み取り部112aによるXML文書114の読み取りと並行して動作する。そしてXML文書分割部112bは、XML文書読み取り部112aにより読み取られたXML文書114のデータを順に処理することにより、当該XML文書114を、XMLとしての構造を持つ複数の新たなXML文書114−i(i=1,2…)に分割・整形する(ステップS2)。このXML文書分割部112bによる分割・整形処理は文書バッファ113上で行われる。XML文書分割送信装置112内のXML文書送信部112cは、XML文書114から1つのXML文書114−iが分割・整形される都度、当該XML文書114−iをネットワーク通信路13経由でコンピュータ12に転送(送信)する(ステップS3)。このようにしてコンピュータ11からコンピュータ12へは、XML文書114に対応する複数のXML文書114−iが順次転送される。
【0019】
コンピュータ11のXML文書送信部112cからネットワーク通信路13経由で転送されたXML文書114−iは、コンピュータ12のXML文書受信部121aで受信される。XML文書受信部121aで受信されたXML文書114−iはAPI121bによりアプリケーション122に渡される(ステップS4,S5)。アプリケーション122は、API121bから渡されたXML文書114−iがXMLとしての構造を持っていることから、本来処理すべきXML文書114−iの全体が転送完了するのを待つことなく、且つXML構造の利点を備えたままで当該XML文書114−iを処理(利用)する。但し、アプリケーション122でXML文書114−iを処理するには、当該XML文書114−iが、元のXML文書(原XML文書)114を後述する手順で分割・整形することにより取得されたものであることを、当該アプリケーション122が認識する必要がある。
【0020】
最近、XML構造を用いて各種データを保存するシステムの利用の広がりが目覚しい。そこで今後を展望すると、XML文書のデータ構造の複雑さ或いはサイズは増大していくことが想定される。また、利用されるコンピュータ機器も大規模なものからコンパクトでメモリ等の資源の少ないものまで幅広くなることが考えられる。そのため、データ構造の複雑さ或いはサイズの増大したXML文書を対象にその構造を生かした処理を行おうとする場合、必要となるメモリ容量が増大する可能性がある。したがって本実施形態で適用される、XML文書を分割・整形し、複数の小規模のXML文書として順次アプリケーション122側に渡す構成は、近い将来考えられるサイズの大きいXML文書をメモリ等資源の少ないコンピュータ機器で処理する利用形態に最適である。
【0021】
次に、コンピュータ11側でXML文書を分割・整形してコンピュータ12に転送し、その分割・整形されたXML文書をコンピュータ12側で処理する動作の詳細について、(1)XML文書の特徴、(2)XML文書の分割・整形・送信、(3)XML文書の処理の順で説明する。
【0022】
(1)XML文書の特徴
従来技術でも述べたように、XML文書は、XML文書が階層構造で表現され、無制限の入れ子構造を許す点と、XML文書が繰り返し構造を持ち、無制限の不定繰り返しを許す点とに特徴がある。このXML文書の階層構造は、<TAG>及び</TAG>に代表される、いわゆる開始タグ及び終了タグを用いて記述される。ここで、XML文書中の一部の開始タグと終了タグとで囲われた範囲は、XML文書全体に対する部分ではあるが、この部分もまたXMLとしての構造を持つことに着目する。
【0023】
図3は、この「XML文書の一部もXML文書としての構造を持つ」ことの一例を示す。図3において、XML文書114の開始タグ<title>から終了タグ</title>までの部分301はXML文書としての構造を持ち、したがってXML文書といえる。同様に、開始タグ<abstract>から終了タグ</abstract>までの部分302も、XML文書といえる。
【0024】
またXML文書では、開始タグ<TAG>が当該文書の中に現れた際には、必ずいずれは終了タグ</TAG>が現れることが保証される。図2のXML文書114の例では、まず開始タグ<document>が現れる。この<document>が読み込まれた時点ではいつ終了タグ</document>が現れるかは分からないが、最終的には当該</document>が必ず現れることは分かる。
【0025】
(2)XML文書の分割・整形・送信
次に、XML文書の分割・整形・送信の手順、即ち上述したXML文書の特徴を利用して、当該XML文書を複数の新たなXML文書に分割・整形し、その新たなXML文書を送信する手順について説明する。ここで、分割・整形されたXML文書の送信を分割送信と呼ぶ。
【0026】
まず、上記手順の概要について述べる。本実施形態において、記憶装置111に格納されているXML文書114のデータは、XML文書読み取り部112aにより先頭から順に読み取られる。この読み取りと並行して、読み取られたXML文書114のデータがXML文書分割部112bにより順次処理される。このXML文書分割部112bの処理の特徴は、次の通りである。
【0027】
(2a)XML文書(原XML文書)を分割する単位(分割単位)が初期設定される。
(2b)開始タグが現れた時点で終了タグが強制的に挿入される。
(2c)“分割途中地点”であることを示す区切りタグ<x/>が定義され、読み込みが完了していない状態では、構造がわからない部分が区切りタグ<x/>で置き換えられる。
(2d)XML文書の分割は分割単位(ここでは文字数であり、例えば64文字)を上限に行われる。本実施形態において、分割単位にカウントされる文字は、開始タグを構成する文字とテキストを構成する文字のみである。また、タグの途中での分割は禁止される。これに対し、テキストの途中での分割は許される。但し、テキスト途中で分割した場合に、次に分割送信される残りのテキスト部分がテキスト分割の印であるテキスト分割開始タグ<y>及びテキスト分割終了タグ</y>で囲まれるようにする。これにより、テキスト途中で分割しても、XML整形式のXML文書に整形でき、タグ以外で始まる文書、つまりXML整形式でない文書が分割送信されるのを防止できる。
(2e)開始タグが現れた時点で終了タグが強制的に挿入されて分割送信されると、その終了タグが本来含まれているXML文書の部分は、XMLの整形式でなくなってしまう。そこで、「終了タグ」が実際に現れた際に、「終了タグ」が存在することを意味するダミー終了タグ<z/>を適用することで、分割送信において「本来の終了タグが現れた」ことが受信側に通知されるようにする。
次に、XML文書の分割・整形・送信の手順の詳細について、図3に示すXML文書114を分割して送信する場合を例に、図4乃至図7のフローチャート並びに図8乃至図10のXML文書分割・整形状態遷移図を参照して説明する。
【0028】
まず、コンピュータ11内のXML文書分割部112bはXML文書の分割・整形のための初期設定を行う(ステップS1)。ここでは、XML文書の分割単位=64文字、区切りタグ=<x/>、テキスト分割開始タグ=<y>、テキスト分割終了タグ=</y>、及びダミー終了タグ=<z/>が初期設定される。また2種のフラグF1及びF2が、例えばF1=0,F2=1に初期設定される。フラグF1はF1=1のとき、分割されたテキストの残りの部分を処理すべきことを示す。フラグF2はF2=1のとき、次に現れる開始タグは新たなXML文書の先頭の開始タグとなることを示す。
【0029】
以上の初期化処理が行われると、コンピュータ11内のXML文書読み取り部112aは、XML文書(原XML文書)114のデータを、先頭から順に最後まで、タグについてはタグ単位に、テキストについてはテキスト単位に読み込む(ステップS12〜S14)。XML文書読み取り部112aにより読み込まれたデータは、読み込まれた順番に文書バッファ113に格納される。図3のXML文書114の例では、まず、先頭の開始タグ<document id=”doc01”>が読み込まれて文書バッファ113に格納される。つまり、開始タグ<document id=”doc01”>が文書バッファ113に読み込まれる。この例のように、開始タグが文書バッファ113に読み込まれ、且つフラグF2が1の場合(ステップS15,S16)、コンピュータ11内のXML文書分割部112bは、文書バッファ113内の当該読み込まれた開始フラグ(即ち<document id=”doc01”>)の後に、図8(a)に示すように区切りタグ<x/>を挿入する(ステップS17)。次にXML文書分割部112bは、図8(b)に示すように、文書バッファ113に格納されている区切りタグ<x/>の後に、開始タグ<document id=”doc01”>に対応する終了タグ</document>を強制的に挿入する(ステップS18)。そしてXML文書分割部112bは、この例のようにフラグF2が1の場合、当該フラグF2を0にした後(ステップS19,S20)、XML文書読み取り部112aに制御を渡す。
【0030】
するとXML文書読み取り部112aは、フラグF1が1であるかを判定する(ステップS12)。この例のようにF1=1でない場合、XML文書読み取り部112aはXML文書114の最後まで読み取りが行われたか(つまりXML文書114の全データを処理し終えたか)を判定する(ステップS13)。この例では、XML文書114の最後までは読み取りが行われていない。この場合、XML文書読み取り部112aはXML文書114中の次のデータ(タグまたはテキスト)を文書バッファ113に読み込む(ステップS14)。ここでは、開始タグ<document id=”doc01”>の次の開始タグ<title>が文書バッファ113に読み込まれる。
【0031】
このように開始タグが読み込まれ、且つフラグF2が0の場合(ステップS15,S16)、XML文書分割部112bは、その際に文書バッファ113に格納されている、当該開始タグを含む未送信のデータ(但し、強制的に挿入されるタグを除く)が分割単位(64文字)を超えているかを判定する(ステップS21)。この例のように分割単位を超えていない場合、XML文書分割部112bは、文書バッファ113に読み込まれた開始タグ<title>を、図8(c)に示すように区切りタグ<x/>の前に移動する(ステップS22)。
【0032】
次にXML文書分割部112bは、図8(d)に示すように、区切りタグ<x/>の後に、開始タグ<title>に対応する終了タグ</title>を強制的に挿入する(ステップS18)。そしてXML文書分割部112bは、この例のようにフラグF2が0の場合、そのままXML文書読み取り部112aに制御を渡す。
【0033】
これを受けてXML文書読み取り部112aは、XML文書114中の次のデータ、即ちテキスト「Sample Document」を文書バッファ113に読み込む(ステップS12〜S14)。このようにテキストが読み込まれた場合(ステップS15)、XML文書分割部112bは、その際に文書バッファ113に格納されている、当該テキストを含む未送信のデータが分割単位を超えているかを判定する(ステップS23)。この例のように、分割単位を超えていない場合、XML文書分割部112bは、文書バッファ113に読み込まれたテキスト「Sample Document」を、図8(e)に示すように区切りタグ<x/>の前に移動する(ステップS24)。そしてXML文書分割部112bは、XML文書読み取り部112aに制御を渡す。
【0034】
するとXML文書読み取り部112aは、XML文書114中の次のデータ、即ち終了タグ</title>を文書バッファ113に読み込む(ステップS12〜S14)。このように終了タグが文書バッファ113に読み込まれた場合(ステップS15)、XML文書分割部112bは、当該終了タグが既に強制的に挿入されて送信済みであるかを判定する(ステップS25)。この例のように、終了タグ</title>が送信済みでない場合、即ち今回読み込まれた終了タグ</title>とは別の、強制的に挿入された終了タグ</title>が文書バッファ113内に存在する場合、XML文書分割部112bは今回読み込まれた終了タグ</title>を削除すると共に、図8(f)に示すように、区切りタグ<x/>を既に強制的に挿入されている終了タグ</title>の後に移動する(ステップS26)。そしてXML文書分割部112bは、XML文書読み取り部112aに制御を渡す。
【0035】
以下、同様にして、XML文書読み取り部112aにより、開始タグ<author>、テキスト「Taro Suzuki」、終了タグ</author>、開始タグ<date>及びテキスト「20030101」が順に読み込まれたものとする。このときの文書バッファ113の内容を図9(a)に示す。さて、テキスト「20030101」が文書バッファ113に読み込まれた場合(ステップS14,S15)、XML文書分割部112bは、当該テキストを含む文書バッファ113内の未送信のデータが分割単位を超えているかを判定する(ステップS23)。ここでは、テキスト「20030101」中の「101」の部分が分割単位を超えている。この場合、XML文書分割部112bは、文書バッファ113に読み込まれたテキスト「20030101」のうち先頭から分割単位を超えない範囲で最大長のテキスト部分「20030」を当該文書バッファ113に残して、そのテキスト部分「20030」を、図9(b)に示すように、区切りタグ<x/>の前に移動する(ステップS27)このステップS27において、XML文書分割部112bは残りのテキスト部分「101」を保持する。そしてXML文書分割部112bは、フラグF1を1に設定して、既に読み込まれている未処理のテキスト部分が残っていることを示した後(ステップS28)、XML文書読み取り部112a及びXML文書送信部112cに制御を渡す。
【0036】
これによりXML文書送信部112cは、その時点において文書バッファ113に格納されている図9(b)に示す構造のデータを、XML文書114から分割されて整形された新たなXML文書114−i(=114−1)としてネットワーク通信路13経由でコンピュータ12に送信する(ステップS29)。一方、XML文書読み取り部112aは、フラグF1が1であることから(ステップS12)、XML文書分割部112bには既に読み込まれている未処理のテキスト部分が残されていると判断し、そのままXML文書分割部112bに制御を戻す。
【0037】
これを受けてXML文書分割部112bは、自身が保持している残りのテキスト部分「101」を文書バッファ113に格納すると共に、図10(a)に示すように、当該テキスト部分「101」の前と後に、それぞれ、テキスト分割開始タグ<y>とテキスト分割終了タグ</y>とを強制的に挿入する(ステップS30)。即ちXML文書分割部112bは、テキスト部分「101」をテキスト分割開始タグ<y>とテキスト分割終了タグ</y>とで囲む。そしてXML文書分割部112bは、XML文書読み取り部112aに制御を渡す。
【0038】
するとXML文書読み取り部112aは、XML文書114中の次のデータ、即ちテキスト「20030101」に後続する終了タグ</date>を、図10(a)に示すように文書バッファ113に読み込む(ステップS12〜S14)。この場合、XML文書分割部112bは、終了タグ</date>が既に強制的に挿入されて送信済みであるかを判定する(ステップS25)。この例のように、終了タグ</date>が送信済みである場合、XML文書分割部112bは、分割送信において「本来の終了タグが現れた」ことをコンピュータ12に通知するために、文書バッファ113に読み込まれた終了タグ</date>を、図10(c)に示すようにダミー終了タグ<z/>に置き換えて(ステップS31)、XML文書読み取り部112aに制御を渡す。
【0039】
以下、同様にして、XML文書分割部112bによるXML文書114を対象とする分割・整形が続けられ、図11(a)に示す、図9(b)に相当するXML文書114−1の送信(1回目の送信)に続き、図11(b)乃至図11(d)、図12(a)乃至図12(d)に示すXML文書114−2乃至114−8の送信(2回目乃至8回目の送信)が行われる。ここで、図11(c)は、開始タグ<section id=”sec01”>が文書バッファ113に読み込まれたために分割単位を超えた場合に送信されるXML文書114−3を示している。この開始タグの読み込みにより分割単位を超えた場合の動作について説明する。
【0040】
今、フラグF2が0の状態で、XML文書読み取り部112aにより開始タグ<section id=”sec01”>が文書バッファ113に読み込まれ、当該開始タグを含む文書バッファ113内の未送信のデータが分割単位を超えたものとする(ステップS15,S16,S21)。この場合、XML文書分割部112bは、XML文書分割送信装置112の状態を開始タグ読み込み前の状態に戻し、次に処理される開始タグが新たなXML文書の先頭の開始タグとなることを示すためにフラグF2を1に設定する(ステップS32,S33)。そしてXML文書分割部112bは、XML文書読み取り部112a及びXML文書送信部112cに制御を渡す。
【0041】
これによりXML文書送信部112cは、その時点において文書バッファ113に格納されている図11(c)に示すデータを新たなXML文書114−i(=114−3)としてコンピュータ12に送信する(ステップS29)。一方、XML文書読み取り部112aは、再度開始タグ<section id=”sec01”>をSPM13に読み込む(ステップS12〜S14)。なお、XML文書分割部112bにて開始タグ<section id=”sec01”>を保持し、ステップS32,S33を行わずに、XML文書送信部112cによるXML文書の送信を行わせ、しかる後に当該開始タグ<section id=”sec01”>を処理するためにステップS17に分岐する構成としてもよい。また、分割単位のカウント対象をテキストだけとしても構わない。
【0042】
次に、XML文書114の全データを処理し終えた場合の動作を説明する。XML文書読み取り部112aは、XML文書114の全データを処理し終えた場合(ステップS13)、その旨をXML文書分割部112bに通知する。するとXML文書分割部112bは、文書バッファ113から区切りタグ<x/>を削除してXML文書送信部112cに制御を渡す(ステップS34)。これを受けてXML文書送信部112cは、その時点において文書バッファ113に格納されているデータを新たなXML文書114−iとしてコンピュータ12に送信する(ステップS35)。ここでは、図12(d)に示すXML文書114−8が送信され、コンピュータ11内のXML文書分割送信装置112による一連の分割・整形・送信処理が終了する。
【0043】
以上のXML文書114を対象とするXML文書分割送信装置112による分割送信と木構造(階層構造)との関係を図13に示す。図13において、逆L字の記号131−1〜131−7は、それぞれXML文書114−1〜114−7の送信(1回目乃至7回目の送信)を表す。また、記号131−1,131−5〜131−7のように、記号131−iが木構造中のノードを表す文字列の後に位置する場合、そのノードに対応する構造のデータの送信がi回目の分割送信で完了したことを示す。一方、記号131−2〜131−4のように、記号131−iが木構造中のノードを表す文字列の途中に位置する場合、i回目の分割送信は、そのノードに対応する構造のデータの送信途中であることを示す。
【0044】
(3)分割送信されたXML文書の処理
次に、コンピュータ11からコンピュータ12に分割送信されたXML文書114−i(図11及び図12の例ではi=1〜8)の処理の概要について説明する。前記したように、コンピュータ11(内のXML文書送信部112c)によりネットワーク通信路13を経由して送信されたXML文書114−iはコンピュータ12内のXML文書受信部121aで受信される。このXML文書受信部121aで受信されたXML文書114−iはAPI121bを介してアプリケーション122に渡され、当該アプリケーション122により処理される。ここで、図3に示されるXML文書114が分割された部分を整形して得られる、図11(a)乃至図11(d)及び図12(a)乃至図12(d)に示すXML文書114−1乃至114−8もXMLとしての構造を持つ。したがって、アプリケーション122は、XML文書114−1乃至114−8を少ないメモリ容量で従来技術を用いて処理できる。なお、XML文書114−i(i=1〜8)は、実際には、コンピュータ12内のCPU(図示せず)が当該アプリケーション122を実行することにより処理されるが、説明の簡略化のためにアプリケーション122により処理されるものとする。
【0045】
次に、分割送信されたXML文書114−iの処理の詳細について、図14のフローチャートを参照して説明する。アプリケーション122は、XML文書受信部121aで受信されたXML文書114−iをAPI121bから受け取ると、本来処理すべきXML文書114の全体が転送完了するのを待つことなく、当該XML文書114−iの処理を開始する。これにより、コンピュータ12においてXML文書を処理するのに必要となるメモリ容量を低減できると共に、処理時間を短縮できる。
【0046】
アプリケーション122は、XML文書114−iの処理で区切りタグ<x/>を検出した場合(ステップS41)、次のXML文書114−(i+1)を受け取るまで処理を中断する(ステップS42)。アプリケーション122は、次のXML文書114−(i+1)を受け取ると(ステップS42)、処理を中断していた先行するXML文書114−i中の区切りタグ<x/>を、当該次のXML文書114−(i+1)に置き換える(ステップS43)。そしてアプリケーション122は、中断していたXML文書114−iの処理を再開する(ステップS44)。但し、ここで処理されるXML文書114−iは、中断前のXML文書114−iとは異なり、区切りタグ<x/>がXML文書114−(i+1)に置き換えられた構造となっている。そこで以下の説明では、区切りタグ<x/>がXML文書114−(i+1)に置き換えられたXML文書114−iをXML文書114−i’と表現する。
【0047】
図11の例では、アプリケーション122がXML文書114−2を受け取った段階で、XML文書114−1中の区切りタグ<x/>がXML文書114−2に置き換えられる。これによりアプリケーション122は、XML文書114−2を含む新たなXML文書114−1(即ちXML文書114−1’)中の新たな区切りタグ<x/>を検出するまで(ステップS41)、処理を継続することができる(ステップS44)。
【0048】
さて、区切りタグ<x/>に置き換えられたXML文書114−(i+1)に別の区切りタグ<x/>が含まれているならば、再開後の処理で当該別の区切りタグ<x/>が検出された段階で、当該別の区切りタグ<x/>が更に次のXML文書114−(i+2)に置き換えられる。つまりアプリケーション122では、区切りタグ<x/>を分割送信されるXML文書に置き換える動作が繰り返される。
【0049】
またアプリケーション122は、XML文書114−i’の処理でテキスト分割開始タグ<y>を検出した場合(ステップS45)、当該テキスト分割開始タグ<y>及びテキスト分割終了タグ</y>の対をXML文書114−i’から削除する(ステップS46)。次にアプリケーション122は、削除したタグ</y>に続くダミー終了タグ<z/>の数jをカウントする(ステップS47)。XML文書114−i’から削除されたタグ</y>に続くダミー終了タグ<z/>の数がjの場合、当該XML文書114−i’には、その最後尾側にj個の終了タグが含まれている。そこで、アプリケーション122は、XML文書114−i’から削除されたタグ</y>に続くj個のダミー終了タグ<z/>を削除し、その位置に、当該XML文書114−i’の最後尾側のj個の終了タグを移動する(ステップS48)。そしてアプリケーション122は、終了タグ移動後のXML文書114−i’の処理を継続し(ステップS44)、最後まで処理できた段階で(ステップS49)、全ての処理を終了する。
【0050】
上記実施形態では、コンピュータ11内のXML文書分割送信装置112による分割・整形の対象となるXML文書114が、当該コンピュータ11の記憶装置111に格納されていることを前提としている。しかし、この記憶装置111が、ネットワークを介して接続された別のコンピュータの記憶装置である場合にも、当該記憶装置111に格納されているXML文書114を対象に、コンピュータ11内のXML文書分割送信装置112にて上記実施形態と同様に分割・整形することが可能である。
【0051】
また、上記実施形態では、XML文書114の分割と分割された文書部分の整形とが全て送信側で行われることを前提としている。しかし、送信側ではXML文書114を先頭から例えば一定サイズに単純に分割してその分割された文書部分(つまりXMLの構造を持たない文書部分)を順次送信し、受信側で図4乃至図7のフローチャートに相当する処理を行ってアプリケーション122に渡すことも可能である。ここでは、分割されたXML文書114の部分を受信する毎に、その先頭から順にデータの読み込みが行われる。このことは、上記実施形態において、XML文書114のデータを先頭から順に読み込むことと等価である。
【0052】
なお、本発明は、上記実施形態に限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で種々に変形することが可能である。更に、上記実施形態には種々の段階の発明が含まれており、開示される複数の構成要件における適宜な組み合わせにより種々の発明が抽出され得る。例えば、実施形態に示される全構成要件から幾つかの構成要件が削除されても、発明が解決しようとする課題の欄で述べた課題が解決でき、発明の効果の欄で述べられている効果が得られる場合には、この構成要件が削除された構成が発明として抽出され得る。
【0053】
【発明の効果】
以上詳述したように本発明によれば、原構造化文書のデータを先頭から順にバッファに読み込み、このバッファに読み込まれたデータを順に処理することにより上記原構造化文書を複数の新たな構造化文書に分割・整形し、この新たな構造化文書が分割・整形される都度、当該新たな構造化文書が文書処理手段による処理に供される構成としたので、当該新たな構造化文書に入れ子構造を持つ構造化文書としての特徴を持たせることができる。このため本発明によれば、構造化文書を処理する処理手段側では、長大な構造化文書を扱うに当たって、全体を受け取るまで待たなくても、分割・整形された新たな構造化文書が生成される毎に、その新たな構造化文書を受け取って処理することができる。その結果、構造化文書を処理するのに必要とされるメモリ容量の減少、処理手段を利用する利用者への応答性能向上を図ることができる。
【図面の簡単な説明】
【図1】本発明の一実施形態に係るコンピュータシステムの構成を示すブロック図。
【図2】同実施形態において、コンピュータ11側でXML文書を分割・整形してコンピュータ12に転送し、その分割・整形されたXML文書をコンピュータ12側で処理する動作の概要を説明するための図。
【図3】図1中のXML文書114の具体例と、当該XML文書114の一部もXML文書としての構造を持つことを示す図。
【図4】XML文書の分割・整形・送信の手順を説明するためのフローチャートの一部を示す図。
【図5】XML文書の分割・整形・送信の手順を説明するためのフローチャートの他の一部を示す図。
【図6】XML文書の分割・整形・送信の手順を説明するためのフローチャートの更に他の一部を示す図。
【図7】XML文書の分割・整形・送信の手順を説明するためのフローチャートの残りを示す図。
【図8】図3のXML文書114を対象とするXML文書分割・整形の状態遷移図。
【図9】図3のXML文書114を対象とするXML文書分割・整形の状態遷移図。
【図10】図3のXML文書114を対象とするXML文書分割・整形の状態遷移図。
【図11】図4乃至図7のフローチャートに従って分割送信されるXML文書114−1〜114−4の具体例を示す図。
【図12】図4乃至図7のフローチャートに従って分割送信されるXML文書114−5〜114−8の具体例を示す図。
【図13】XML文書114に対応するXML文書の分割送信と木構造との関係を示す図。
【図14】分割送信されたXML文書の処理の手順を説明するためのフローチャート。
【符号の説明】
11,12…コンピュータ、13…ネットワーク通信路、111…記憶装置、112…XML文書分割送信装置、112a…XML文書読み取り部、112b…XML文書分割部、112c…XML文書送信部、114…XML文書(原XML文書)、114−1〜114−8…XML文書、121…受信装置、121a…XML文書受信部、121b…API(アプリケーションプログラムインタフェース)、122…アプリケーション(処理手段)。[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a structured document dividing method and a program suitable for processing a structured document having a nested structure logically expressed by a tree structure using tags.
[0002]
[Prior art]
Currently, XML (Extensible Markup Language) is widely used as a means for describing all kinds of data. A document (data) described using this XML is called an XML document (XML data). An XML document is known as a structured document that is logically expressed in a tree structure using tags, and has the following features. The first feature is that the XML document is expressed in a hierarchical structure, and allows an unlimited nested structure. The second feature is that the XML document has a repeating structure and allows unlimited indefinite repetition (for example, see Non-Patent Document 1).
[0003]
An XML document is excellent in data portability on the Internet due to its description format. For this reason, XML documents have been widely used especially for data exchange between different applications or different systems. XML documents are often transferred in accordance with the HTTP (Hyper Text Transfer Protocol) protocol on the Internet or the SOAP (Simple Object Access Protocol) protocol over the HTTP protocol. In this protocol, data (XML data) constituting an XML document is simply transferred in the order in which the data was read.
[0004]
The transferred XML document is processed by the application. At present, the following two types are widely used as technologies for processing XML. The first is a technique called SAX (Simple API for XML). In SAX, since the XML documents are sequentially processed, a hierarchical structure cannot be handled. However, the SAX requires less memory capacity. The second is a technique called DOM (Document Object Model). In the DOM, since the elements of the entire XML document are analyzed and then processed, the hierarchical structure is easy to handle. However, the required memory capacity is large
[0005]
[Non-patent document 1]
Mikitoshi Nakayama and Yasuhiro Okui, "Complete Explanation of Revised Standard XML (above) / (below)", First Edition, Technical Review, April 25, 2001
[0006]
[Problems to be solved by the invention]
As described above, in the related art, data constituting an XML document (structured document logically expressed in a tree structure using tags) is simply transferred in the order in which the data was read. In other words, in the prior art, there is no means for dividing the XML document into an XML structure for transferring the XML document. For this reason, for example, in order for the application to process the XML document transferred to the application by using the DOM technology or the SAX technology, the transfer of the entire XML document must first be completed. Therefore, when the XML document is transferred to the application for processing, the processing on the application side waits until the transfer of the XML document is completed, and the start of the processing is delayed. That is, in the related art, there is a problem that the entire processing time from the start of the transfer of the XML document to the end of processing the transferred XML document is long. Further, in the related art, since the document is processed after reading the entire XML document, there is also a problem that the required memory capacity increases.
[0007]
The present invention has been made in view of the above circumstances, and its purpose is to receive a structured document by dividing a structured document having a nested structure and shaping it into a plurality of structured documents having a nested structure. An object of the present invention is to provide a structured document dividing method and a program capable of reducing a memory capacity required for processing and shortening a processing time.
[0008]
[Means for Solving the Problems]
According to one aspect of the present invention, there is provided a structured document dividing method in which a structured document having a nested structure logically represented by a tree structure using tags is divided by a computer. This method includes sequentially reading data of a structured document to be divided into a buffer from the beginning, and sequentially processing the data read into the buffer, thereby forming a structured document (original structure) to be divided. Dividing and shaping the structured document) into a plurality of new structured documents, and passing the new structured document to the document processing means each time a new structured document is split and shaped from the original structured document And
[0009]
In such a configuration, since the divided document portion of the original structured document is shaped into a new structured document, the feature as a structured document having a nested structure is retained. For this reason, the processing means for processing a structured document generates a new divided / shaped document without having to wait until the entire document is received, unlike the related art, in handling a long structured document. Each time the new structured document is received and processed. As a result, the memory capacity required for processing the structured document can be reduced, and the response performance to the user using the processing means can be improved.
[0010]
Here, in order to divide and shape a new structured document from the original structured document, the following steps are performed in the above-mentioned division and shaping step, that is, when the read data is a start tag, The step of forcibly inserting an end tag in the buffer and the step of reading the data from the original structured document corresponding to the part where the structure can not be specified Inserting the indicated delimiter tag in the buffer. When the processing unit processes a new structured document including the delimiter tag, the processing is performed from the beginning of the new structured document until the delimiter tag is detected, and the process is interrupted when the delimiter tag is detected. Then, when the next new structured document is received, the processing may be restarted by replacing the delimiter tag with the next new structured document.
[0011]
Here, in the step of inserting the delimiter tag, when the start tag is read into the buffer in a state where the start tag is not stored in the buffer, the delimiter tag is inserted after the start tag, and the end tag is inserted. In the inserting step, an end tag corresponding to the start tag may be inserted after the delimiter tag inserted after the start tag.
[0012]
If a new start tag is read into the buffer after a delimiter tag is inserted in order to divide and format a new structured document from the original structured document, the newly read start tag is It is preferable to move to a position before the delimiter tag in the buffer and insert an end tag corresponding to the newly read start tag after the delimiter tag. Similarly, when text is read in order to divide and format a new structured document from the original structured document, the text may be moved to a position before the delimiter tag on the buffer. Similarly, if the read data is an end tag and the structured document in which the same end tag as the end tag has been forcibly inserted has already been passed to the processing means, the read end tag is , May be replaced with a dummy end tag for notifying the processing means that the end tag exists. When the processing unit processes the structured document in which the delimiter tag is replaced with the structured document including the dummy end tag, the dummy end tag is deleted, and the number of the dummy end tag corresponding to the number of the dummy end tag is deleted at the position. What is necessary is just to move the end tag on the last side of the structured document in which the delimiter tag is replaced.
[0013]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing a configuration of a computer system according to one embodiment of the present invention. The system in FIG. 1 includes two physically
[0014]
The
[0015]
The XML document
[0016]
The
[0017]
Next, in the system of FIG. 1, an outline of an operation of dividing and shaping an XML document on the
[0018]
In the
[0019]
The XML document 114-i transferred from the XML
[0020]
Recently, the use of a system for storing various data using the XML structure has been remarkably widespread. In view of this, it is expected that the complexity or size of the data structure of the XML document will increase. In addition, it is conceivable that computer equipment to be used will be wide-ranging from large-scale ones to compact ones with small resources such as memories. For this reason, when an XML document having a complicated data structure or an increased size is to be processed using the structure, the required memory capacity may increase. Therefore, the configuration applied to the present embodiment, in which the XML document is divided and shaped, and sequentially passed to the
[0021]
Next, the details of the operation of dividing and shaping the XML document on the
[0022]
(1) Features of XML documents
As described in the related art, the XML document is characterized in that the XML document is expressed in a hierarchical structure and allows an unlimited nested structure, and that the XML document has a repeating structure and allows unlimited indefinite repetition. . The hierarchical structure of the XML document is described using so-called start tags and end tags represented by <TAG> and </ TAG>. Here, it is noted that the range surrounded by a part of the start tag and the end tag in the XML document is a part for the entire XML document, but this part also has a structure as XML.
[0023]
FIG. 3 shows an example in which "a part of the XML document also has a structure as an XML document". In FIG. 3, a
[0024]
Further, in the XML document, when the start tag <TAG> appears in the document, it is guaranteed that the end tag </ TAG> will always appear in any case. In the example of the
[0025]
(2) Dividing, shaping, and transmitting XML documents
Next, the XML document is divided, shaped, and transmitted, that is, the XML document is divided and shaped into a plurality of new XML documents using the above-described features of the XML document, and the new XML document is transmitted. The procedure will be described. Here, transmission of the divided and shaped XML document is referred to as divided transmission.
[0026]
First, an outline of the above procedure will be described. In the present embodiment, the data of the
[0027]
(2a) A unit (division unit) for dividing an XML document (original XML document) is initialized.
(2b) When the start tag appears, the end tag is forcibly inserted.
(2c) A delimiter tag <x /> indicating “partition midway” is defined, and in a state where reading is not completed, a part whose structure is unknown is replaced with the delimiter tag <x />.
(2d) The XML document is divided into division units (here, the number of characters, for example, 64 characters). In the present embodiment, only characters constituting the start tag and characters constituting the text are counted in the division unit. Also, division in the middle of the tag is prohibited. On the other hand, division in the middle of the text is allowed. However, when the text is divided in the middle of the text, the remaining text part to be divided and transmitted next is surrounded by a text division start tag <y> and a text division end tag </ y> which are marks for text division. As a result, even if the text is divided in the middle, the XML document can be formatted into an XML well-formed XML document, and a document that starts with something other than a tag, that is, a document that is not XML well-formed can be prevented from being divided and transmitted.
(2e) If the end tag is forcibly inserted and divided and transmitted when the start tag appears, the part of the XML document that originally includes the end tag will not be in a well-formed XML format. Therefore, when the “end tag” actually appears, the dummy end tag <z />, which means that the “end tag” exists, is applied, so that “the original end tag has appeared” in the divided transmission. Is notified to the receiver.
Next, the details of the procedure for dividing, shaping, and transmitting the XML document will be described with reference to the flowcharts of FIGS. 4 to 7 and the XML of FIGS. 8 to 10 in a case where the
[0028]
First, the XML
[0029]
When the above-described initialization processing is performed, the XML
[0030]
Then, the XML
[0031]
When the start tag is read in this way and the flag F2 is 0 (steps S15 and S16), the XML
[0032]
Next, the XML
[0033]
In response, the XML
[0034]
Then, the XML
[0035]
Hereinafter, similarly, it is assumed that the start tag <author>, the text "Taro Suzuki", the end tag </ author>, the start tag <date>, and the text "20030101" are sequentially read by the XML
[0036]
As a result, the XML
[0037]
In response to this, the XML
[0038]
Then, the XML
[0039]
Thereafter, similarly, the division and shaping of the
[0040]
Now, with the flag F2 set to 0, the start tag <section id = "sec01"> is read into the
[0041]
As a result, the XML
[0042]
Next, an operation when all data of the
[0043]
FIG. 13 shows the relationship between the divided transmission by the XML document
[0044]
(3) Processing of XML document transmitted by division
Next, an outline of processing of the XML document 114-i (i = 1 to 8 in the examples of FIGS. 11 and 12) divided and transmitted from the
[0045]
Next, the details of the processing of the XML document 114-i transmitted by division will be described with reference to the flowchart of FIG. When the
[0046]
When the
[0047]
In the example of FIG. 11, when the
[0048]
Now, if another delimiter tag <x /> is included in the XML document 114- (i + 1) replaced by the delimiter tag <x />, the other delimiter tag <x /> Is detected, the another delimiter tag <x /> is further replaced with the next XML document 114- (i + 2). In other words, in the
[0049]
When the
[0050]
In the above embodiment, it is assumed that the
[0051]
In the above embodiment, it is assumed that the division of the
[0052]
Note that the present invention is not limited to the above-described embodiment, and can be variously modified in an implementation stage without departing from the gist of the invention. Further, the above embodiments include inventions at various stages, and various inventions can be extracted by appropriately combining a plurality of disclosed constituent elements. For example, even if some components are deleted from all the components shown in the embodiment, the problems described in the column of the problem to be solved by the invention can be solved, and the effects described in the column of the effect of the invention can be solved. Is obtained, a configuration from which this configuration requirement is deleted can be extracted as an invention.
[0053]
【The invention's effect】
As described in detail above, according to the present invention, the original structured document is read into a buffer in order from the beginning, and the data read into the buffer is processed in order, whereby the original structured document is converted into a plurality of new structures. Each time this new structured document is divided and shaped, the new structured document is provided for processing by the document processing means. Features can be provided as a structured document having a nested structure. Therefore, according to the present invention, when processing a long structured document, the processing means for processing the structured document generates a new divided / shaped structured document without waiting for the entire structured document to be received. Every time the new structured document is received and processed. As a result, the memory capacity required for processing the structured document can be reduced, and the response performance to the user using the processing means can be improved.
[Brief description of the drawings]
FIG. 1 is an exemplary block diagram showing the configuration of a computer system according to an embodiment of the present invention.
FIG. 2 is a view for explaining an outline of an operation of dividing and shaping an XML document on a
FIG. 3 is a view showing a specific example of an
FIG. 4 is a diagram showing a part of a flowchart for explaining a procedure of dividing, shaping, and transmitting an XML document.
FIG. 5 is a diagram showing another part of the flowchart for explaining the procedure of dividing, shaping, and transmitting the XML document.
FIG. 6 is a diagram showing still another part of the flowchart for explaining the procedure of dividing, shaping, and transmitting an XML document.
FIG. 7 is a view showing the rest of the flowchart for explaining the procedure of dividing, shaping, and transmitting an XML document.
FIG. 8 is a state transition diagram of XML document division and shaping for the
FIG. 9 is a state transition diagram of XML document division and shaping for the
FIG. 10 is a state transition diagram of XML document division and shaping for the
FIG. 11 is a view showing a specific example of XML documents 114-1 to 114-4 divided and transmitted according to the flowcharts of FIGS. 4 to 7;
FIG. 12 is a view showing a specific example of XML documents 114-5 to 114-8 divided and transmitted according to the flowcharts of FIGS. 4 to 7;
FIG. 13 is a view showing a relationship between a divided transmission of an XML document corresponding to the
FIG. 14 is a flowchart for explaining the procedure of processing an XML document that has been divided and transmitted.
[Explanation of symbols]
11, 12: Computer, 13: Network communication path, 111: Storage device, 112: XML document division transmission device, 112a: XML document reading unit, 112b: XML document division unit, 112c: XML document transmission unit, 114: XML document (Original XML document), 114-1 to 114-8: XML document, 121: receiving device, 121a: XML document receiving unit, 121b: API (application program interface), 122: application (processing means).
Claims (10)
分割の対象となる構造化文書のデータを先頭から順にバッファに読み込むステップと、
前記バッファに読み込まれたデータを順に処理することにより、前記分割の対象となる構造化文書を複数の新たな構造化文書に分割・整形するステップと、
前記分割の対象となる構造化文書から前記新たな構造化文書が分割・整形される都度、当該新たな構造化文書を文書処理手段に渡すステップと
を具備することを特徴とする構造化文書の分割方法。A structured document division method for dividing a structured document having a nested structure logically expressed by a tree structure using a tag by a computer,
Reading the data of the structured document to be divided into buffers sequentially from the beginning;
Dividing and shaping the structured document to be divided into a plurality of new structured documents by sequentially processing the data read into the buffer;
Transferring the new structured document to document processing means each time the new structured document is divided and shaped from the structured document to be divided. Split method.
前記読み込まれた開始タグ、前記区切りタグ及び前記開始タグに対応する挿入された終了タグを含む新たな構造化文書が前記バッファ上に生成される都度、当該新たな構造化文書を前記文書処理手段に渡す
ことを特徴とする請求項1記載の構造化文書の分割方法。When the read data is a start tag, the dividing / shaping step includes a step of forcibly inserting an end tag corresponding to the start tag in the buffer, and a step of reading data from the structured document. Corresponding to the part for which the structure can not be specified for, including a step of inserting a delimiter tag on the buffer indicating that it is an intermediate point in the division of the structured document,
Each time a new structured document including the read start tag, the delimiter tag, and the inserted end tag corresponding to the start tag is generated on the buffer, the new structured document is processed by the document processing unit. 2. The method of dividing a structured document according to claim 1, further comprising:
前記終了タグを挿入するステップでは、前記開始タグの後に挿入された区切りタグの後に、当該開始タグに対応する終了タグが挿入されることを特徴とする請求項2記載の構造化文書の分割方法。In the step of inserting the delimiter tag, when the start tag is read into the buffer in a state where the start tag is not stored in the buffer, the delimiter tag is inserted after the start tag,
3. The method according to claim 2, wherein in the step of inserting the end tag, an end tag corresponding to the start tag is inserted after the delimiter tag inserted after the start tag. .
前記終了タグを挿入するステップでは、前記新たに読み込まれた開始タグに対応する終了タグが前記区切りタグの後に挿入される
ことを特徴とする請求項3記載の構造化文書の分割方法。The step of dividing and shaping includes, when a new start tag is read into the buffer after the insertion of the delimiter tag, moving the newly read start tag to a position before the delimiter tag on the buffer. Including
4. The method according to claim 3, wherein in the step of inserting the end tag, an end tag corresponding to the newly read start tag is inserted after the delimiter tag.
前記読み込まれたデータがテキストで、且つ前記バッファに格納されている当該テキストを含む未処理のデータが前記分割単位を超えている場合、当該テキスト中の前記分割単位を超えない範囲のテキスト部分を前記バッファに残して当該テキスト部分を前記区切りタグの前に移動することにより、前記バッファ上に新たな構造化文書を生成するステップと、
前記バッファ上に生成された前記新たな構造化文書が前記文書処理手段に渡された場合、前記読み込まれたテキスト中の残りのテキスト部分を前記バッファに格納し、且つ当該残りのテキスト部分を、テキスト分割の印であるテキスト分割開始タグ及びテキスト分割終了タグで囲むステップと
を含むことを特徴とする請求項7記載の構造化文書の分割方法。The managing step includes:
When the read data is text and the unprocessed data including the text stored in the buffer exceeds the division unit, a text portion of the text that does not exceed the division unit is extracted. Generating a new structured document on the buffer by leaving the text portion in the buffer and moving the text portion before the delimiter tag;
When the new structured document generated on the buffer is passed to the document processing means, the remaining text part in the read text is stored in the buffer, and the remaining text part is stored in the buffer. 8. A method for dividing a structured document according to claim 7, comprising a step of enclosing a text division start tag and a text division end tag which are marks for text division.
前記コンピュータに、
分割の対象となる構造化文書のデータを先頭から順にバッファに読み込むステップと、
前記バッファに読み込まれたデータを順に処理することにより、前記分割の対象となる構造化文書を複数の新たな構造化文書に分割・整形するステップと、
前記分割の対象となる構造化文書から前記新たな構造化文書が分割・整形される都度、当該新たな構造化文書を文書処理手段に渡すステップと
を実行させるためのプログラム。A program for dividing a structured document having a nested structure logically expressed by a tree structure using tags by a computer,
To the computer,
Reading the data of the structured document to be divided into buffers sequentially from the beginning;
Dividing and shaping the structured document to be divided into a plurality of new structured documents by sequentially processing the data read into the buffer;
Transferring the new structured document to document processing means each time the new structured document is divided and shaped from the structured document to be divided.
前記読み込まれた開始タグ、前記区切りタグ及び前記開始タグに対応する挿入された終了タグを含む新たな構造化文書が前記バッファ上に生成される都度、前記新たな構造化文書を前記文書処理手段に渡すステップが前記コンピュータにより実行される
ことを特徴とする請求項9記載のプログラム。When the read data is a start tag, the dividing / shaping step includes a step of forcibly inserting an end tag corresponding to the start tag in the buffer, and a step of reading data from the structured document. Corresponding to the part for which the structure can not be specified for, including a step of inserting a delimiter tag on the buffer indicating that it is an intermediate point in the division of the structured document,
Each time a new structured document including the read start tag, the delimiter tag, and the inserted end tag corresponding to the start tag is generated on the buffer, the new structured document is processed by the document processing unit. 10. The program according to claim 9, wherein the step of passing to the computer is executed by the computer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003080747A JP3905851B2 (en) | 2003-03-24 | 2003-03-24 | Structured document segmentation method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003080747A JP3905851B2 (en) | 2003-03-24 | 2003-03-24 | Structured document segmentation method and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004287978A true JP2004287978A (en) | 2004-10-14 |
JP3905851B2 JP3905851B2 (en) | 2007-04-18 |
Family
ID=33294518
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003080747A Expired - Fee Related JP3905851B2 (en) | 2003-03-24 | 2003-03-24 | Structured document segmentation method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3905851B2 (en) |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007179492A (en) * | 2005-12-28 | 2007-07-12 | Fujitsu Ltd | Division program, connection program and information processing method |
JP2007193660A (en) * | 2006-01-20 | 2007-08-02 | Seiko Epson Corp | Information management device, information management method and program therefor |
JP2008205624A (en) * | 2007-02-16 | 2008-09-04 | Toshiba Corp | Data transmitting method |
JP2008305267A (en) * | 2007-06-08 | 2008-12-18 | Kyocera Mita Corp | File transmission apparatus, image forming apparatus, file communication program, and file communication method |
JP2008305265A (en) * | 2007-06-08 | 2008-12-18 | Kyocera Mita Corp | File transmission apparatus, image forming apparatus, file communication program, and file communication method |
JP2009515489A (en) * | 2005-11-08 | 2009-04-09 | クゥアルコム・インコーポレイテッド | Method and apparatus for fragmenting system information messages in a wireless network |
JP2012008754A (en) * | 2010-06-24 | 2012-01-12 | Internatl Business Mach Corp <Ibm> | Method, program and system for dividing tree structure of structured document |
US8171250B2 (en) | 2005-09-08 | 2012-05-01 | Qualcomm Incorporated | Method and apparatus for delivering content based on receivers characteristics |
US8528029B2 (en) | 2005-09-12 | 2013-09-03 | Qualcomm Incorporated | Apparatus and methods of open and closed package subscription |
US8571570B2 (en) | 2005-11-08 | 2013-10-29 | Qualcomm Incorporated | Methods and apparatus for delivering regional parameters |
US8600836B2 (en) | 2005-11-08 | 2013-12-03 | Qualcomm Incorporated | System for distributing packages and channels to a device |
US8893179B2 (en) | 2005-09-12 | 2014-11-18 | Qualcomm Incorporated | Apparatus and methods for providing and presenting customized channel information |
JP2016502716A (en) * | 2013-10-16 | 2016-01-28 | シャオミ・インコーポレイテッド | Electronic book document processing method, terminal, electronic device, program, and recording medium |
US9614895B2 (en) | 2012-04-25 | 2017-04-04 | Hewlett Packard Enterprise Development Lp | File transfer using XML |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07282041A (en) * | 1994-04-04 | 1995-10-27 | Fuji Xerox Co Ltd | Document conversion device |
JPH10143498A (en) * | 1996-11-08 | 1998-05-29 | Nippon Telegr & Teleph Corp <Ntt> | Page dividing communication repeater having link applying function |
JPH11175426A (en) * | 1997-12-11 | 1999-07-02 | Fuji Xerox Co Ltd | Service repeater system |
JP2001195391A (en) * | 2000-01-14 | 2001-07-19 | Nec Information Service Ltd | Format conversion and page division relay server |
WO2002103554A1 (en) * | 2001-06-14 | 2002-12-27 | Sharp Kabushiki Kaisha | Data processing method, data processing program, and data processing apparatus |
-
2003
- 2003-03-24 JP JP2003080747A patent/JP3905851B2/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07282041A (en) * | 1994-04-04 | 1995-10-27 | Fuji Xerox Co Ltd | Document conversion device |
JPH10143498A (en) * | 1996-11-08 | 1998-05-29 | Nippon Telegr & Teleph Corp <Ntt> | Page dividing communication repeater having link applying function |
JPH11175426A (en) * | 1997-12-11 | 1999-07-02 | Fuji Xerox Co Ltd | Service repeater system |
JP2001195391A (en) * | 2000-01-14 | 2001-07-19 | Nec Information Service Ltd | Format conversion and page division relay server |
WO2002103554A1 (en) * | 2001-06-14 | 2002-12-27 | Sharp Kabushiki Kaisha | Data processing method, data processing program, and data processing apparatus |
Cited By (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8171250B2 (en) | 2005-09-08 | 2012-05-01 | Qualcomm Incorporated | Method and apparatus for delivering content based on receivers characteristics |
US8893179B2 (en) | 2005-09-12 | 2014-11-18 | Qualcomm Incorporated | Apparatus and methods for providing and presenting customized channel information |
US8528029B2 (en) | 2005-09-12 | 2013-09-03 | Qualcomm Incorporated | Apparatus and methods of open and closed package subscription |
US8571570B2 (en) | 2005-11-08 | 2013-10-29 | Qualcomm Incorporated | Methods and apparatus for delivering regional parameters |
US8533358B2 (en) | 2005-11-08 | 2013-09-10 | Qualcomm Incorporated | Methods and apparatus for fragmenting system information messages in wireless networks |
JP2009515489A (en) * | 2005-11-08 | 2009-04-09 | クゥアルコム・インコーポレイテッド | Method and apparatus for fragmenting system information messages in a wireless network |
US8600836B2 (en) | 2005-11-08 | 2013-12-03 | Qualcomm Incorporated | System for distributing packages and channels to a device |
JP2007179492A (en) * | 2005-12-28 | 2007-07-12 | Fujitsu Ltd | Division program, connection program and information processing method |
US8418053B2 (en) | 2005-12-28 | 2013-04-09 | Fujitsu Limited | Division program, combination program and information processing method |
JP2007193660A (en) * | 2006-01-20 | 2007-08-02 | Seiko Epson Corp | Information management device, information management method and program therefor |
JP2008205624A (en) * | 2007-02-16 | 2008-09-04 | Toshiba Corp | Data transmitting method |
JP4728979B2 (en) * | 2007-02-16 | 2011-07-20 | 株式会社東芝 | Data transmission method and wireless terminal |
JP2008305265A (en) * | 2007-06-08 | 2008-12-18 | Kyocera Mita Corp | File transmission apparatus, image forming apparatus, file communication program, and file communication method |
JP2008305267A (en) * | 2007-06-08 | 2008-12-18 | Kyocera Mita Corp | File transmission apparatus, image forming apparatus, file communication program, and file communication method |
JP2012008754A (en) * | 2010-06-24 | 2012-01-12 | Internatl Business Mach Corp <Ibm> | Method, program and system for dividing tree structure of structured document |
US8880557B2 (en) | 2010-06-24 | 2014-11-04 | International Business Machines Corporation | Method, program, and system for dividing tree structure of structured document |
US9614895B2 (en) | 2012-04-25 | 2017-04-04 | Hewlett Packard Enterprise Development Lp | File transfer using XML |
US9860301B2 (en) | 2012-04-25 | 2018-01-02 | Ent. Services Development Corporation Lp | File transfer using XML |
JP2016502716A (en) * | 2013-10-16 | 2016-01-28 | シャオミ・インコーポレイテッド | Electronic book document processing method, terminal, electronic device, program, and recording medium |
Also Published As
Publication number | Publication date |
---|---|
JP3905851B2 (en) | 2007-04-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3905851B2 (en) | Structured document segmentation method and program | |
US8375285B2 (en) | Enabling access to data files unsupported by a computing device | |
US10515142B2 (en) | Method and apparatus for extracting webpage information | |
US7478170B2 (en) | Generic infrastructure for converting documents between formats with merge capabilities | |
US20110258538A1 (en) | Capturing DOM Modifications Mediated by Decoupled Change Mechanism | |
US20020087596A1 (en) | Compact tree representation of markup languages | |
US20030172113A1 (en) | Synchronization of documents between a server and small devices | |
CN105095280A (en) | Caching method and apparatus for browser | |
US20130275496A1 (en) | Method, Apparatus And System For Rendering Web Page | |
WO2006051150A1 (en) | Form related data reduction | |
JP4771915B2 (en) | Apparatus, method, and program for converting HTML text | |
CN1996295A (en) | Image forming apparatus and method to search for and print images on network | |
WO2009049061A1 (en) | Methods, apparatus, and systems for providing local and online data services | |
US10289747B2 (en) | Dynamic file concatenation | |
CN112073240B (en) | Blue-green deployment system and method based on registration center component and storage medium | |
CN100576162C (en) | Method and system according to the print capacity operative installations print What of imaging device | |
US8195762B2 (en) | Locating a portion of data on a computer network | |
US8463744B2 (en) | Method and system for synchronizing data | |
CN105282238B (en) | A kind of method for managing resource | |
US7451390B2 (en) | Structured document processing system, method, program and recording medium | |
KR102407941B1 (en) | User interface generation method of electronic device calling function or procedure of external device based on remote procedure call(rpc), program and electronic device thereof | |
US20070136435A1 (en) | Path-token-based web service caching method | |
CN113535647A (en) | OFD file paging rendering method and system | |
JPWO2005101210A1 (en) | Data analysis apparatus and data analysis program | |
US20070288549A1 (en) | Information Processing System, Server Device, Client Device, and Program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20050310 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20050906 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20051107 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20070109 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070112 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100119 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110119 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120119 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130119 Year of fee payment: 6 |
|
LAPS | Cancellation because of no payment of annual fees |