JP2004240507A - Xml generation device and xml generation program - Google Patents
Xml generation device and xml generation program Download PDFInfo
- Publication number
- JP2004240507A JP2004240507A JP2003026282A JP2003026282A JP2004240507A JP 2004240507 A JP2004240507 A JP 2004240507A JP 2003026282 A JP2003026282 A JP 2003026282A JP 2003026282 A JP2003026282 A JP 2003026282A JP 2004240507 A JP2004240507 A JP 2004240507A
- Authority
- JP
- Japan
- Prior art keywords
- information
- xml
- data
- path
- input
- 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
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、XMLデータのデータ構造を定義する定義情報に基づいてXMLデータを生成するXML生成装置、およびXML生成プログラムに関する。
【0002】
【従来の技術】
B2Bi(Business to Business Integration)やEAI(Enterprise Application Integration)などの提携システムにおいて、企業間でテストデータを用いて導通試験を行ったりするときにテスト用のXML(eXtensible Markup Language)データが用いられる場合がある。また、システム構築における業務仕様策定の際に雛形データ(以下、テンプレートという)があると便利である。
【0003】
XMLデータは構造が複雑であるので、編集作業に手間がかかる場合がある。特許文献1には、XMLデータの生成に際して、作業効率を向上させ、作業者の負担を軽減できるデータ構造化方式が記載されている。特許文献1に記載されたデータ構造化方式では、DTD(Document Type Definition)などの文書構造制約情報を入力する。そして、グラフィカルユーザインタフェースを用いた作業者からの指示に基づき、構造化対象のテキスト文書データなどの文書構造を編集する。
【0004】
【特許文献1】
特開2001−101183号公報(第5−8頁、第1図、第4−6図)
【0005】
【発明が解決しようとする課題】
特許文献1に記載されたデータ構造化方式では、構造化の対象となる実際の文書そのものを見ながら構造化の指示を行う構成を実現することによって、作業効率を向上させ、作業者の負担を軽減させている。しかし、単にユーザがXMLデータなどの編集作業をする際の負担軽減を図ったものであり、XMLデータ生成の際の工程を削減する構成を実現したものではない。従って、テストデータやXMLデータのテンプレートを容易に生成することはできない。
【0006】
そこで、本発明は、複数のXMLデータを容易に生成することができ、XMLデータ生成の際の工数を削減できるようにすることを目的とする。
【0007】
【課題を解決するための手段】
本発明によるXML生成装置は、指定されるデータ構造に従ってXMLデータを生成するXML生成装置であって、生成すべきXMLデータのデータ構造を指定する構造情報(例えば、入力DTDデータ11)を入力する構造情報入力手段(DTD入力部202によって実現される)と、パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報(例えば、入力NVリストデータ13)、または既存のXMLデータ(例えば、入力XMLデータ12)を、再利用情報として入力する再利用情報入力手段(XML入力部205と、NVリスト入力部207とによって実現される)と、生成すべきXMLデータの生成パターンを指定する情報である設定情報(例えば、生成デフォルト情報)を保持する設定情報保持手段(XML生成装置20の記憶装置によって実現される)と、設定情報および再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成するパス情報合成手段(パス合成部208によって実現される)と、パス情報合成手段によって合成された合成情報(例えば、合成DOMオブジェクト)に基づいて、XMLデータを生成するXML生成手段(XML生成部209によって実現される)とを備えたことを特徴とする。
【0008】
XML生成装置は、設定情報(例えば、生成オプション情報)を入力する設定情報入力手段(生成オプション入力部201によって実現される)を備え、パス情報合成手段は、設定情報入力手段が入力した設定情報と、設定情報保持手段が保持する設定情報と、再利用情報とに基づいてXMLデータのパス情報を生成し合成するものであってもよい。そのような構成によれば、XMLデータを生成する際に、ユーザは生成するXMLデータに含まれる要素値や属性値などの生成パターンを任意に変更することができる。
【0009】
再利用情報入力手段は、再利用情報として対応関係情報を入力する対応関係情報入力手段(NVリスト入力部207によって実現される)を含み、パス情報合成手段は、対応関係情報入力手段が入力した対応関係情報に含まれるパス情報を抽出し、抽出したパス情報を合成対象として採用してパス情報を合成するものであってもよい。そのような構成によれば、ユーザが過去の蓄積データをもとに編集したデータを再利用データとして利用してXMLデータを生成することができる。従って、XMLデータを編集する場合と比較して、ユーザの手作業に係る処理を低減することができる。
【0010】
再利用情報入力手段は、再利用情報として既存のXMLデータを入力するXML入力手段(XML入力部205によって実現される)を含み、パス情報合成手段は、XML入力手段が入力した既存のXMLデータに含まれるパス情報を抽出し、抽出したパス情報を合成対象として採用してパス情報を合成し、XML生成手段は、パス情報合成手段によって合成された合成情報に基づいて、新たなXMLデータを生成するものであってもよい。そのような構成によれば、既存のXMLデータを再利用して新たなXMLデータを生成することにより、ユーザの手作業に係る処理を削減することができる。
【0011】
パス情報合成手段は、対応関係情報に含まれるパス情報を、既存のXMLデータに含まれるパス情報に優先して採用することによってパス情報を合成するものであってもよい。そのような構成によれば、ユーザが編集した再利用データを優先的に反映したXMLデータを生成することができる。
【0012】
パス情報合成手段は、構造情報から特定されるパス情報が対応関係情報または既存のXMLデータに含まれていない場合、設定情報において指定された生成パターンに従いパス情報を合成するものであってもよい。そのような構成によれば、ユーザが編集または指定した再利用データに対応する部分のパス情報が含まれていない場合であってもXMLデータを生成できる。
【0013】
XML生成装置は、パス情報合成手段によって合成された合成情報、構造情報入力手段が入力した構造情報、またはXML入力手段が入力した既存のXMLデータに基づいて対応関係情報(例えば、出力NVリストデータ32、DTD変換NVリストデータ、またはXML変換NVリストデータ)を生成する対応関係情報生成手段(NVリスト生成部211、DTD変換部204、またはXML変換部206によって実現される)を備えたものであってもよい。そのような構成によれば、ユーザは、パス情報を合成した結果、構造情報、または既存のXMLデータに基づいて容易に再利用データを編集することができる。従って、ユーザが編集した再利用データを次回のXMLデータ生成時に再利用することができる。
【0014】
再利用情報入力手段は、XML生成手段が生成したXMLデータ、または対応関係情報生成手段が生成した対応関係情報を再利用情報として入力するものであってもよい。そのような構成によれば、生成したXMLデータやユーザが編集したデータを、再利用データとして次回のXMLデータ生成時に再利用することができる。
【0015】
本発明によるXML生成プログラムは、生成すべきXMLデータの生成パターンを指定する情報である設定情報を保持する設定情報保持手段を備えたXML生成装置に搭載されるXML生成プログラムであって、コンピュータに、生成すべきXMLデータのデータ構造を指定する構造情報を入力する処理と、パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報、または既存のXMLデータを、再利用情報として入力する処理と、設定情報および再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成する処理と、パス情報を合成した合成情報に基づいて、XMLデータを生成する処理とを実行させることを特徴とする。
【0016】
【発明の実施の形態】
以下、本発明の実施の形態を図面を参照して説明する。図1は、本発明によるXML生成装置の構成の一例を示すブロック図である。図1に示すように、XML生成装置20は、記憶装置A10に記憶されるデータを取得してXMLデータを生成し、生成したXMLデータを記憶装置B30に出力する。XML生成装置20は、パーソナルコンピュータやサーバ等の情報処理装置によって実現される。記憶装置A10および記憶装置B30は、磁気記憶装置などによって実現される。なお、記憶装置A10および記憶装置B30は、半導体記憶装置などによって実現されるものであってもよい。
【0017】
本実施の形態では、XML生成装置20は、記憶装置A10に記憶されるDTDデータに含まれるデータ構造の定義情報に従い、ユーザなどから入力される各設定値に基づいてXMLデータを生成する。また、XML生成装置20は、XMLデータを生成する際に、DTDデータ以外の記憶装置A10に記憶されるデータを参照する。XML生成装置20がXMLデータを生成する際に参照するデータには、XML生成装置20が過去に生成した既存データやユーザによって作成された編集データが含まれる。すなわち、XML生成装置20は、過去に生成した既存データを再利用してXMLデータを生成する。また、XML生成装置20は、ユーザが既存データに基づきエディタなどを用いて編集作成したデータを利用してXMLデータを生成する。
【0018】
記憶装置A10は、生成するXMLデータのデータ構造の情報を含む入力DTDデータ11と、XMLデータを生成する際にXML生成装置20が参照する入力XMLデータ12および入力NVリストデータ13とを記憶する。入力DTDデータ11は、生成するXMLデータのデータ構造の定義情報を含むDTDデータである。入力XMLデータ12は、XML生成装置20が過去に生成したXMLデータである。入力NVリストデータ13は、XML生成装置20が過去に生成したNVリスト(Name and Value List )データである。
【0019】
NVリストデータとは、各要素と要素の数との対応関係や各要素と要素の値との対応関係をリスト形式にしたテキストデータである。NVリストデータにおいて、各要素の対応関係は、各要素と要素の数または各要素と要素の値とを「=」で対応付けて表示される。例えば、各要素の対応関係は、「要素名=要素数」や「要素名=要素値」と表示される。また、例えば、「=」ではなく「,」を用いて、「要素名,要素数」や「要素名,要素値」と各要素の対応関係をCSV(Comma Separated Value )形式で表示してもよい。入力NVリストデータ13は、例えば、XML生成装置20が過去に生成したXMLデータに含まれる各要素の対応関係の情報をリスト形式にしたNVリストデータである。従って、ユーザは、エディタなどの編集用ソフトウェアを用いて入力NVリストデータ13を容易に編集できる。
【0020】
なお、生成するXMLデータのデータ構造の定義情報を含む入力データはDTDデータに限られない。例えば、XMLデータのデータ構造の定義情報を含むXMLスキーマであってもよい。
【0021】
XML生成装置20は、図1に示すように、XMLデータの生成パターンを指定する各設定値を入力する生成オプション入力部201と、記憶装置A10からの入力DTDデータ11を入力するDTD入力部202と、入力DTDデータ11を解析する構造解析部203と、入力DTDデータ11をNVリストデータに変換するDTD変換部204と、記憶装置A10からの入力XMLデータ12を入力するXML入力部205と、入力XMLデータ12をNVリストデータに変換するXML変換部206と、記憶装置A10からの入力NVリストデータ13を入力するNVリスト入力部207と、各入力データに基づいてパス情報を合成するパス合成部208と、合成結果に基づいてXMLデータを生成するXML生成部209と、生成したXMLデータを出力するXML出力部210と、合成結果に基づいてNVリストデータを生成するNVリスト生成部211と、生成したNVリストデータを出力するNVリスト出力部212とを含む。
【0022】
生成オプション入力部201は、キーボードやマウスなどの入力装置とXML生成装置20の制御部とによって実現され、ユーザからの入力指示に従ってXMLデータの生成パターンを指定する各設定値の入力を必要に応じて受け付ける。以下、ユーザからの指示に従って入力されるXMLデータ生成のための設定値を含む情報を生成オプション情報と記す。なお、生成オプション情報をユーザからの指示に従って入力装置から入力するのでなく、生成オプション入力部201は、生成オプション情報を含む外部ファイルを、外部の記憶装置から読み込んで入力してもよい。
【0023】
なお、XML生成装置20は、XMLデータの生成パターンを指定する各設定値のデフォルト値の情報を、XML生成装置20の記憶装置(図示せず)などに保持している。以下、XML生成装置20が保持する各設定値のデフォルト値の情報を生成デフォルト情報と記す。各設定値のうち、生成オプション入力部201から生成オプション情報として入力された設定値については、XML生成装置20は、生成オプション情報に含まれる設定値に基づいてXMLデータを生成する。生成オプション情報として入力されなかった設定値については、XML生成装置20は、生成デフォルト情報に含まれる設定値に基づいてXMLデータを生成する。
【0024】
DTD入力部202、XML入力部205、およびNVリスト入力部207は、XML生成装置20の入出力インタフェース部と制御部とによって実現される。DTD入力部202は、記憶装置A10から入力DTDデータ11を読み込む。XML入力部205は、必要に応じて記憶装置A10から入力XMLデータ12を読み込む。NVリスト入力部207は、必要に応じて記憶装置A10から入力NVリストデータ13を読み込む。
【0025】
構造解析部203、DTD変換部204、XML変換部206、パス合成部208、XML生成部209、およびNVリスト生成部211は、XML生成装置20の記憶装置に記憶されるプログラムを実行する制御部によって実現される。構造解析部203は、DTD入力部202からの入力DTDデータ11のデータ構造をXML生成装置20のメモリ(図示せず)上にDTDオブジェクトとして展開する。DTD変換部204は、展開されたDTDオブジェクトに基づいて、入力DTDデータ11をNVリストのデータ形式に変換しNVリストデータを生成する。以下、入力DTDデータ11をデータ変換して生成したNVリストデータをDTD変換NVリストデータと記す。XML変換部206は、XML入力部205からの入力XMLデータ12をNVリストのデータ形式に変換しNVリストデータを生成する。以下、入力XMLデータ12をデータ変換して生成したNVリストデータをXML変換NVリストデータと記す。
【0026】
パス合成部208は、構造解析部203によって展開されたDTDオブジェクトと、生成オプション入力部201からの生成オプション情報と、生成デフォルト情報とに基づいてパス情報を合成する。パス情報の概念についは後述する。また、パス合成部208は、XML変換NVリストデータと、入力NVリストデータ13とを必要に応じて参照してパス情報を合成する。パス合成部208は、パス情報を合成した合成結果をDOM(Document Object Model )オブジェクトとしてメモリ上に展開する。以下、パス合成部208がパス情報を合成した合成結果に基づいてメモリ上に展開したDOMオブジェクトを、合成DOMオブジェクトと記す。
【0027】
XML生成部209は、合成DOMオブジェクトをテキスト形式に変換してXMLデータを生成する。以下、XML生成部209が生成するXMLデータを出力XMLデータ31と記す。NVリスト生成部211は、合成DOMオブジェクトをNVリスト形式に変換してNVリストデータを生成する。以下、NVリスト生成部211が生成するNVリストデータを出力NVリストデータ32と記す。
【0028】
XML出力部210およびNVリスト出力部212は、XML生成装置20の入出力インタフェース部と制御部とによって実現される。XML出力部210は、XML生成部209が生成した出力XMLデータ31を記憶装置B30に出力して記憶させる。NVリスト出力部212は、NVリスト生成部211が生成した出力NVリストデータ32を記憶装置B30に出力して記憶させる。
【0029】
記憶装置B30は、図1に示すように、XML生成装置20から出力される出力XMLデータ31および出力NVリストデータ32を記憶する。なお、記憶装置A10と記憶装置B30とは、1台の半導体記憶装置や磁気記憶装置などで実現されるものであってもよい。
【0030】
構造情報入力手段は、DTD入力部202によって実現される。再利用情報入力手段は、XML入力部205と、NVリスト入力部とによって実現される。設定情報保持手段は、XML生成装置20の記憶装置によって実現される。パス情報合成手段は、パス合成部208によって実現される。XML生成手段は、XML生成部209によって実現される。設定情報入力手段は、生成オプション入力部201によって実現される。XML入力手段は、XML入力部205によって実現される。対応関係情報入力手段は、NVリスト入力部207によって実現される。対応関係情報生成手段は、NVリスト生成部211と、DTD変換部204と、XML変換部206とによって実現される。
【0031】
図2は、入力DTDデータ11の内容の例を示す説明図である。図2に示すように、本例では、入力DTDデータ11において、親要素「Simple」が定義され、さらに子要素「One 」,「ZeroOrOne?」,「ZeroOrMore* 」,「OneOrMore+ 」などが定義される。図2に示すように、入力DTDデータ11には「?」,「*」,「+」などの要素の記載回数を定義するXML言語の記号が付加された子要素が含まれる。また、本例では、子要素「One 」には、属性名「idReq 」および「idImp 」が定義される。属性「idReq 」には、属性値を必ず指定しなければならないことを示すXML言語の宣言「#REQUIRED 」が記述されている。属性「idImp 」には、属性値を省略可能であることを示すXML言語の宣言「#IMPLIED」が記述されている。
【0032】
また、本例では、図2に示すように、親要素「Simple」内に定義した子要素のうち、「OrA 」、「OrB 」および「OrC 」については、いずれか1つを選択して指定しなければならないことを示すXML言語の記号「| 」が記述されている。「OrA 」を指定した場合には、さらに「selectType 1」, 「selectType 2」, 「selectType 3」のうちのいずれか1つのデータ種別を選択して指定しなければならない。なお、本実施の形態では、「| 」記号がある要素について生成オプション情報として設定値が入力されていない場合には、先頭要素を選択して指定する旨が生成デフォルト情報に設定されている場合を例に説明する。
【0033】
図3は、入力XMLデータ12の内容の例を示す説明図である。本例では、図3に示すように、入力XMLデータ12において、属性「idReq 」の属性値として「000001」が指定されている。また、入力XMLデータ12に含まれる子要素「OneOrMore 」の要素数は2つであることが指定されており、それぞれ要素値「data1 」および「data2 」が指定されている。また、子要素「OrA 」が選択して指定され、データ種別として「selectType 1」が選択して指定されている。そして、子要素「OrA 」の属性値として「Value A 」が指定されている。
【0034】
なお、入力XMLデータ12は、必ずしも入力DTDデータ11で定義されるデータ構造に合致したデータでなくてもよい。例えば、図2に示す入力DTDデータ11において属性「idReq 」が #REQUIRED宣言されているので要素「One 」は必須要素であるが、入力XMLデータ12は要素「One 」を含まないデータであってもよい。また、入力XMLデータ12は、DTD外部ファイル宣言部において入力DTDデータ11とは異なるDTDデータの参照を宣言しているものであってもよい。
【0035】
図4は、入力NVリストデータ13の内容の例を示す説明図である。本例では、図4に示すように、入力NVリストデータ13において、「/Simple/One/@idImp」,「/Simple/OneOrMore+」,「/Simple/OneOrMore[2]」の3つのパスに対してそれぞれパス値「インプライド」、「3」および「データ2」が指定されている。
【0036】
次に、パス情報の概念を説明する。パスとは、XMLデータやNVリストデータに含まれる各要素について、「/ 」などの区切り記号を用いて親要素と子要素と間の関係を示したものである。本実施の形態では、パス名をXPath(XML Path Language )で表現する場合を例に説明する。例えば、親要素「Simple」と子要素「One 」,「OneOrMore 」との間の関係を示すパスは、「/Simple/One/@idReq」や「/Simple/OneOrMore」と表現される。パス情報とは、パス名と要素の数またはパスの値(例えば、要素値や属性値)とを示す情報である。
【0037】
パス形式の変換に際してDTDデータやXMLデータに「?」,「*」,「+」などの記号が存在する場合には、これらの記号を各要素名の末尾に付加することによりパス形式に変換する。例えば、「/Simple/ZeroOrOne?」,「/Simple/ZeroOrMore* 」,「/Simple/OneOrMore+」などのパスが生成される。記号「| 」が存在する場合には、選択要素の前後に括弧を付加することによりパス形式に変換する。例えば、「/Simple/(OrA|OrB|OrC) 」などのパスが生成される。
【0038】
例えば、生成オプション情報において、「?」および「*」が付加された要素の数を「0」と設定し、「+」が付加された要素の数を「1」と設定してパス情報を合成した場合を例に説明する。図5は、パス合成部208が図2に示す入力DTDデータ11に従ってパス情報を合成した結果を、NVリスト変換したNVリストデータの一例を示す説明図である。図5に示すNVリストデータは、入力XMLデータ12および入力NVリストデータ13の入力はなく、生成オプション情報と、生成デフォルト情報とに基づいてパス情報を合成した合成結果に基づくデータである。
【0039】
また、前述の「?」,「*」,「+」が付加された要素の数以外の設定値として、パスの区切り記号を「/ 」と設定し、パスのプレフィックス(パスの接頭子)を指定しない旨を設定し、要素値や属性値のデフォルト値としてnull値(不定値)を出力しない旨を設定し、IMPLIED属性を出力しない旨を設定しているものとする。null値を出力しない旨が設定されている場合には、例えば、パス値としてパス名がそのまま出力される。
【0040】
図5に示すように、パス「/Simple/One/@idReq」については、「null値」を出力しない旨が設定されているので、例えば、そのままパス名「/Simple/One/@idReq」をパス値としてパス情報が生成される。パス「/Simple/ZeroOrOne?」および「/Simple/ZeroOrMore* 」については、要素数「0」と設定されているので、パス値「0」としてパス情報が生成される。要素数「0」であるので、要素の内容を示すパス「/Simple/ZeroOrOne 」および「/Simple/ZeroOrMore」についてのパス情報は生成されない。パス「/Simple/OneOrMore+」については、要素数「1」と設定されているので、パス値「1」としてパス情報が生成される。そして、要素の内容を示すパス「/Simple/OneOrMore 」については、null値を出力しない旨が設定されているので、例えば、そのままパス名「/Simple/OneOrMore 」をパス値としてパス情報が生成される。
【0041】
「| 」記号の選択指定については設定されていないので、生成デフォルト情報に基づいて先頭情報が選択される。すなわち、それぞれ「OrA 」と「selectType1」とが選択され、その選択結果に基づいてパス情報が生成される。なお、生成オプション情報で2番目の情報を選択するように設定されている場合には、パス情報として「/Simple/(OrA|OrB|OrC)=2 」と生成され、要素「OrB 」の内容についてのパス情報が生成される。 IMPLIED属性については出力しない旨が設定されているので、本例では、属性「idImp 」に対するパス情報は生成されない。
【0042】
また、生成オプション情報において「?」,「*」,「+」が付加された全ての要素の数を「1」に設定した場合には、図2に示す入力DTDデータ11に含まれる要素の全てのパス情報を生成することができる。図6は、図2に示す入力DTDデータ11に従ってパス情報を合成した結果を、NVリスト変換したNVリストデータの他の例を示す説明図である。「?」,「*」,「+」を含む要素の数以外の設定値や他の条件については、図5の場合と同様である。すなわち、パスの区切り記号を「/ 」と設定し、パスのプレフィックスを指定しない旨を設定し、要素値や属性値のデフォルト値としてnull値を出力しない旨を設定し、IMPLIED属性を出力しない旨を設定しているものとする。
【0043】
図6に示すように、図5で生成されたパス情報に加えて、パス「/Simple/ZeroOrOne?」および「/Simple/ZeroOrMore* 」についてのパス情報が生成される。すなわち、パス「/Simple/ZeroOrOne?」については、パス値「1」としてパス情報が生成される。そして、要素の内容を示すパス「/Simple/ZeroOrOne 」ついては、例えば、そのままパス名「/Simple/ZeroOrOne 」をパス値としてパス情報が生成される。また、「/Simple/ZeroOrMore* 」については、パス値「1」としてパス情報が生成される。そして、要素の内容を示すパス「/Simple/ZeroOrMore」については、例えば、そのままパス名「/Simple/ZeroOrMore」をパス値としてパス情報が生成される。
【0044】
次に、動作について説明する。図7は、XML生成装置20がXMLデータを生成する処理経過の一例を示す流れ図である。DTD入力部202は、記憶装置A10から入力DTDデータ11を読み込む(ステップS101)。構造解析部203は、DTD入力部202からの入力DTDデータ11のデータ構造を解析してメモリ上にDTDオブジェクトとして展開する(ステップS102)。
【0045】
生成オプション入力部201は、ユーザからの入力指示に従って、生成オプション情報の入力を受け付け生成オプション情報の各設定値を設定する(ステップS103)。生成オプション入力部201は、生成オプション情報として以下の設定値を設定する。
【0046】
例えば、生成オプション入力部201は、「?」、「*」、または「+」などの記号が付加された要素の数を予め設定する。生成オプション入力部201は、パスの区切り記号を設定する。例えば、生成オプション入力部201は、パスの区切り記号として「/ 」と設定する。生成オプション入力部201は、パスの接頭子であるプレフィックスを設定する。生成オプション入力部201は、データの各要素値や属性値のデフォルト値としてnull値を出力するか否かを設定する。また、生成オプション入力部201は、データ内に IMPLIED指定された要素が存在する場合に、その要素を出力するか否かを設定する。
【0047】
ユーザから生成オプション情報の入力指示が入力されなかった場合には、ステップS103の処理は実行されない。ステップS103の処理を実行しない場合には、XML生成装置20は、以下の処理において生成デフォルト情報に基づいてXMLデータを生成する。また、各設定値のうち生成オプション情報として入力されなかった設定値については、XML生成装置20は、生成デフォルト情報に含まれる設定値に基づいてXMLデータを生成する。
【0048】
XML入力部205は、ユーザから入力XMLデータのファイル名が入力されると、入力されたファイル名に対応する入力XMLデータ12を、記憶装置A10から読み込む(ステップS104)。ユーザからファイル名が入力されない場合には、XML入力部205は、ステップS104の処理を実行しない。すなわち、XML生成装置20は、以下の処理において、入力XMLデータ12を参照せずにXMLデータを生成する。
【0049】
NVリスト入力部207は、ユーザから入力NVリストデータのファイル名が入力されると、入力されたファイル名に対応する入力NVリストデータ13を、記憶装置A10から読み込む(ステップS105)。ユーザからファイル名が入力されない場合には、NVリスト入力部207は、ステップS105の処理を実行しない。すなわち、XML生成装置20は、以下の処理において、入力NVリストデータ13を参照せずにXMLデータを生成する。
【0050】
なお、ユーザからファイル名が入力された場合にステップS104やステップS105の処理を実行するのではなく、例えば、バッチ処理に含まれる指示に従って、ステップS104やステップS105の処理を実行するようにしてもよい。
【0051】
ステップS103,S104,S105の処理を実行する順番は、本実施の形態で示した順番に限られない。また、ステップS103,S104,S105のうちのいずれかまたは全ての処理をステップS101およびステップS102の処理の前に実行してもよい。
【0052】
ユーザから入力DTDデータ11をNVリストデータに変換する旨の指示が入力されると、DTD変換部204は、XML生成装置20のメモリ上に展開されたDTDオブジェクトに基づいて、入力DTDデータ11をNVリストのデータ形式に変換しDTD変換NVリストデータを生成する(ステップS106)。ユーザから入力DTDデータ11の変換指示が入力されなかった場合には、DTD変換部204は、ステップS106の処理を実行しない。すなわち、DTD変換部204は、DTD変換NVリストデータを生成しない。
【0053】
なお、ユーザからNVリストデータに変換する旨の指示が入力された場合にステップS106の処理を実行するのではなく、例えば、バッチ処理に含まれる指示に従って、ステップS106の処理を実行するようにしてもよい。
【0054】
XML変換部206は、XML入力部205からの入力XMLデータ12をNVリストのデータ形式に変換してNVリストデータとして生成する(ステップS107)。ユーザからファイル名が入力されずステップS104の処理が実行されなかった場合には、XML変換部206は、ステップS107の処理を実行しない。すなわち、XML変換部206は、XML変換NVリストデータを生成しない。
【0055】
図8は、XML変換部206が生成するXML変換NVリストデータの一例を示す説明図である。図8に示すXML変換NVリストデータは、図3に示す入力XMLデータ12をNVリスト変換して生成されたNVリストデータである。図8に示すように、XML変換部206は、前述したパスの概念に従って入力XMLデータ12をNVリスト変換しXML変換NVリストデータを生成する。
【0056】
パス合成部208は、メモリ上に展開された入力DTDデータ11のDTDオブジェクトに従い、生成オプション情報と生成デフォルト情報とに含まれる各設定値に基づいてパス情報を合成する(ステップS108)。また、XML変換NVリストデータが生成されている場合には、パス合成部208は、XML変換NVリストデータを参照してパス情報を合成する。また、入力NVリストデータ13が入力されている場合には、パス合成部208は、入力NVリストデータ13を参照してパス情報を合成する。
【0057】
図9は、パス合成部208がパス情報を合成する処理経過の一例を示す流れ図である。パス合成部208は、まず入力NVリストデータ13を参照し、対応する部分のパス情報が入力NVリストデータ13に存在するか否かを判定する(ステップS21)。パス情報が存在する場合には、パス合成部208は、入力NVリストデータ13に含まれるパス情報を抽出する(ステップS22)。ステップS21で対応する部分のパス情報がない場合または入力NVリストデータ13がない場合には、パス合成部208は、XML変換NVリストデータを参照する。パス合成部208は、対応する部分のパス情報がXML変換NVリストデータに存在するか否かを判定する(ステップS23)。パス情報が存在する場合には、パス合成部208は、XML変換NVリストデータに含まれるパス情報を抽出する(ステップS24)。
【0058】
ステップS23で対応する部分のパス情報がない場合またはXML変換NVリストデータがない場合には、パス合成部208は、生成オプション情報または生成デフォルト情報に、デフォルト値としてnull値を出力する旨の指定があるか否かを判定する(ステップS25)。null値を出力する旨の指定がある場合には、パス合成部208は、対応する部分のパス値をnull値としてパス情報を生成する(ステップS26)。null値を出力する旨の指定がない場合には、パス合成部208は、対応する部分のパス名をそのままパス値としてパス情報を生成する(ステップS27)。パス合成部208は、ステップS21からステップS27までの手順に従って抽出または生成したパス情報を合成する。そして、パス合成部は、合成DOMオブジェクトをメモリ上に展開する。
【0059】
パス情報が合成されると、XML生成部209は、メモリ上に構成された合成DOMオブジェクトをテキスト形式に変換して出力XMLデータ31を生成する(ステップS109)。また、ユーザから出力NVリストデータ32を生成する旨の指示が入力されると、NVリスト生成部211は、合成DOMオブジェクトをNVリスト形式に変換して出力NVリストデータ32を生成する(ステップS110)。ユーザから出力NVリストデータ32を生成する旨の指示が入力されなかった場合には、NVリスト生成部211は、ステップS110の処理を実行しない。すなわち、NVリスト生成部211は、出力NVリストデータ32を生成しない。
【0060】
なお、ユーザから出力NVリストデータ32を生成する旨の指示が入力された場合にステップS110の処理を実行するのではなく、例えば、バッチ処理に含まれる指示に従って、ステップS110の処理を実行するようにしてもよい。
【0061】
図10は、生成された出力XMLデータ31および出力NVリストデータ32の一例を示す説明図である。図10(a)は、XML生成部209が生成した出力XMLデータ31である。また、図10(b)は、NVリスト生成部211が生成した出力NVリストデータ32である。本例では、入力XMLデータ12および入力NVリストデータ13の入力がなく、図2に示す入力DTDデータ11に従って、生成オプション情報と生成デフォルト情報とに基づいて、出力XMLデータ31と出力NVリストデータ32とを生成した場合を例に説明する。また、ステップS103において、「?」および「*」が付加された要素の数を「0」と設定し、「+」が付加された要素の数を「1」と設定し、パスの区切り記号は「/ 」と設定し、パスのプレフィックスは指定しない旨を設定し、要素値や属性値のデフォルト値としてnull値を出力する旨を設定し、IMPLIED属性を出力しない旨を設定しているものとする。
【0062】
図10(a)に示すように、XML生成部209は、XML宣言部「?xml version=’1.0’ encoding=’UTF−8’?」とDTD外部ファイル宣言部「!DOCTYPE Simple SYSTEM ”simple.dtd” 」とを自動的に生成する。なお、XML宣言部のうち出力文字コードの指定である「encoding=’UTF−8’」の部分については、ステップS103において生成オプション情報の設定値として設定してもよい。
【0063】
XML生成部209は、生成オプション情報によって「+」が付加された要素を1つ生成するように設定されているので、要素「OneOrMore 」についてのタグを1つ生成する。本例では、デフォルト値としてnull値を出力する旨が設定されているので、パス合成部208は、ステップS27においてパス値がnull値であるとしてパス情報を合成する。従って、XML生成部209は、タグ「OneOrMore 」を空要素のタグとして生成する。XML生成部209は、属性「idReq 」については #REQUIRED宣言がされておりnull値を属性値として生成できないので、ワーニング表示であることを示す「####required####」を生成する。また、「| 」記号の選択指定については生成オプション情報に設定されていないので、XML生成部209は、生成デフォルト情報に基づいて先頭情報を選択してタグを生成する。本例では、XML生成部209は、それぞれ「OrA 」および「selectType 1」を選択してタグを生成する。
【0064】
また、図10(b)に示すように、NVリスト生成部211は、要素「ZeroOrOne?」および「ZeroOrMore* 」については要素値「0」を生成し、要素「OneOrMore+」について要素値「1」を生成する。そして、デフォルト値としてnull値を出力する旨が設定されているので、NVリスト生成部211は、要素「OneOrMore 」の要素値を空欄として生成する。また、NVリスト生成部211は、属性「idReq 」については #REQUIRED宣言がされておりnull値を属性値として生成できないので、ワーニング「####required####」を生成する。また、「| 」記号の選択指定については、NVリスト生成部211は、それぞれ「OrA 」および「selectType 1」を選択して要素値を生成する。
【0065】
図11は、生成された出力XMLデータ31および出力NVリストデータ32の他の例を示す説明図である。図11(a)は、XML生成部209が生成した出力XMLデータ31である。また、図11(b)は、NVリスト生成部211が生成した出力NVリストデータ32である。本例では、図10と同様に、図2に示す入力DTDデータ11に従って、生成オプション情報と生成デフォルト情報とに基づいて、出力XMLデータ31と出力NVリストデータ32とを生成した場合を例に説明する。本例では、ステップS103において、「?」,「*」,「+」が付加された要素の数を「1」と設定し、パスの区切り記号は「/ 」と設定し、パスのプレフィックスは指定しない旨を設定し、要素値や属性値のデフォルト値としてnull値を出力しない旨を設定し、IMPLIED属性を出力する旨を設定しているものとする。
【0066】
図11(a)に示すように、「?」,「*」,「+」が付加された各要素について要素を1つ生成するように設定されているので、XML生成部209は、要素「ZeroOrOne 」,「ZeroOrMore」,「OneOrMore 」についてそれぞれタグを1つ生成する。また、図11(b)に示すように、NVリスト生成部211は、要素「ZeroOrOne 」,「ZeroOrMore」,「OneOrMore 」についてそれぞれ要素値を1つ生成する。本例では、デフォルト値としてnull値を出力しない旨が設定されているので、パス合成部208は、ステップS27においてパス名をそのままパス値としてパス情報を合成する。従って、XML生成部209は、パス名をそのままそれぞれの要素値としてタグを生成する。同様にNVリスト生成部211は、パス名をそのまま各要素の要素値として生成する。
【0067】
また、デフォルト値としてnull値を出力しない旨が設定されているので、XML生成部209およびNVリスト生成部211は、パス名をそのまま属性「idReq 」の属性値として生成する。また、IMPLIED属性を出力する旨が設定されているので、XML生成部209およびNVリスト生成部211は、それぞれ属性「idImp 」のパス名をそのまま属性値として生成する。
【0068】
図12は、生成された出力XMLデータ31および出力NVリストデータ32のさらに他の例を示す説明図である。図12(a)は、XML生成部209が生成した出力XMLデータ31である。また、図12(b)は、NVリスト生成部211が生成した出力NVリストデータ32である。本例では、参照データとして図3に示す入力XMLデータ12のみが入力された場合を例に説明する。本例では、ステップS103において、「?」,「*」,「+」が付加された要素の数を「1」と設定し、パスの区切り記号は「/ 」と設定し、パスのプレフィックスは指定しない旨を設定し、要素値や属性値のデフォルト値としてnull値を出力しない旨を設定し、IMPLIED属性を出力する旨を設定しているものとする。
【0069】
「?」,「*」,「+」が付加された各要素について要素を1つ生成するように設定されているが、要素「OneOrMore 」については図3に示す入力XMLデータ12で2つのパス値が指定されているので、パス合成部208は、ステップS24において入力XMLデータ12で指定されるパス値を抽出しパス情報を合成する。従って、XML生成部209は、図12(a)に示すように、要素「OneOrMore 」について2つのタグを生成する。また、XML生成部209は、それぞれ2つのタグ「OneOrMore 」の要素値として、入力XMLデータ12で指定される「data1 」および「data2 」を生成する。また、NVリスト生成部211は、図12(b)に示すように、「OneOrMore 」の要素値として、入力XMLデータ12で指定されている「data1 」および「data2 」を生成する。
【0070】
また、デフォルト値としてnull値を出力しない旨が設定されているが、属性「idReq 」については図3に示す入力XMLデータ12で属性値「000001」と指定されているので、パス合成部208は、ステップS24において入力XMLデータ12で指定される属性値「000001」を抽出しパス情報を合成する。従って、XML生成部209およびNVリスト生成部211は、図12(a)および図12(b)に示すように、属性「idReq 」については「000001 」を属性値として生成する。
【0071】
「| 」記号の選択指定については、図3に示す入力XMLデータ12で、「OrA 」および「selectType 1」を選択するように指定されているので、パス合成部208は、ステップS24においてデータ種別が「selectType 1」である要素「OrA 」についてのパス値を抽出してパス情報を合成する。従って、XML生成部209は、図13(a)に示すように、データ種別が「selectType 1」である要素「OrA 」についてのタグを生成する。そして、図3に示す入力XMLデータ12で「OrA 」のパス値が「Value A 」と指定されているので、パス合成部208は、タグ「OrA 」の要素値として入力XMLデータ12で指定される「Value A 」を生成する。また、NVリスト生成部211は、図13(b)に示すように、「OrA 」の要素値として、入力XMLデータ12で指定される「Value A 」を要素値として生成する。
【0072】
図13は、生成された出力XMLデータ31および出力NVリストデータ32のさらに他の例を示す説明図である。図13(a)は、XML生成部209が生成した出力XMLデータ31である。また、図13(b)は、NVリスト生成部211が生成した出力NVリストデータ32である。本例では、参照データとして図3に示す入力XMLデータ12と図4に示す入力NVリストデータ13とが入力された場合を例に説明する。本例では、ステップS103において、「?」,「*」,「+」が付加された要素の数を「1」と設定し、パスの区切り記号は「/ 」と設定し、パスのプレフィックスは指定しない旨を設定し、要素値や属性値のデフォルト値としてnull値を出力しない旨を設定し、IMPLIED属性を出力する旨を設定しているものとする。
【0073】
「?」,「*」,「+」が付加された各要素について要素を1つ生成するように設定されているが、要素「OneOrMore 」については図4に示す入力NVリストデータ13で要素の数が「3」と指定されているので、パス合成部208は、ステップS22で入力NVリストデータ13に指定される要素の数を抽出しパス情報を合成する。従って、XML生成部209は、図13(a)に示すように、要素「OneOrMore 」について3つのタグを生成する。また、要素「OneOrMore 」の2つ目の要素値については図4に示す入力NVリストデータ13で「データ2」と指定されているので、パス合成部208は、ステップS22で入力NVリストデータ13に指定される要素の値を抽出しパス情報を合成する。従って、XML生成部209は、図13(a)に示すように、タグ「OneOrMore 」の2つ目の要素値として「データ2」を生成する。
【0074】
NVリスト生成部211は、図13(b)に示すように、要素「OneOrMore 」について3つの要素を生成する。また、NVリスト生成部211は、要素「OneOrMore 」の2つ目の要素値として、入力NVリストデータ13で指定される「データ2」を生成する。
【0075】
また、デフォルト値としてnull値を出力しない旨が設定されているが、属性「idImp 」については図4に示す入力NVリストデータ13で「インプライド」と出力するように指定されているので、パス合成部208は、ステップS22で入力NVリストデータ13に指定されている属性値を抽出しパス情報を合成する。従って、XML生成部209およびNVリスト生成部211は、図13(a)および図13(b)に示すように、属性「idImp 」については「インプライド」を属性値として生成する。
【0076】
また、要素「OneOrMore 」の1つ目の値については図3に示す入力XMLデータ12で「data1 」と指定されているので、パス合成部208は、ステップS24で入力XMLデータ12に指定される値を抽出しパス情報を合成する。従って、XML生成部209は、図13(a)に示すように、タグ「OneOrMore 」の1つ目の値を「data1 」と生成する。また、NVリスト生成部211は、図13(b)に示すように、要素「OneOrMore 」の1つ目の要素値を「data1 」と生成する。
【0077】
また、属性「idReq 」については図3に示す入力XMLデータ12で「000001」と出力するように指定されているので、パス合成部208は、ステップS24で入力XMLデータ12に指定される要素を抽出しパス情報を合成する。従って、XML生成部209およびNVリスト生成部211は、図13(a)および図13(b)に示すように、属性「idReq 」については「000001 」を属性値として生成する。
【0078】
「| 」記号の選択指定については、図3に示す入力XMLデータ12で、「OrA 」および「selectType 1」を選択するように指定されているので、図12の場合と同様に、XML生成部209は、データ種別が「selectType 1」である要素「OrA 」についてのタグを生成し、要素値として入力XMLデータ12で指定される「Value A 」を生成する。また、NVリスト生成部211は、「OrA 」の要素値として、入力XMLデータ12で指定される「Value A 」を要素値として生成する。
【0079】
ステップS109で出力XMLデータ31が生成されると、XML出力部210は、生成した出力XMLデータ31を記憶装置B30に出力し記憶させる(ステップS111)。また、NVリスト出力部212は、ステップS110が実行された場合には、生成した出力NVリストデータ32を記憶装置B30に出力し記憶させる(ステップS112)。また、NVリスト出力部212は、ステップS106が実行された場合には、生成したDTD変換NVリストデータを記憶装置B30に出力し記憶させる(ステップS113)。また、NVリスト出力部212は、ステップS107が実行された場合には、生成したXML変換NVリストデータを記憶装置B30に出力し記憶させる(ステップS114)。なお、ステップS111,S112,S113,S114を実行する順番は、本実施の形態で示した順番に限られない。
【0080】
以上のように、本実施の形態によれば、生成すべきXMLデータのデータ構造の定義情報に従い、既存のXMLデータやユーザが既存データなどをもとに編集したNVリストデータを再利用データとして利用することによりXMLデータを生成する。よって、再利用データを利用することにより、ユーザの手作業に係る処理を削減することができる。従って、一部のデータのみが異なる多数のテストデータやXMLデータのテンプレートを容易に生成することができ、XMLデータ生成の際の工数を低減することができる。
【0081】
また、本実施の形態によれば、生成した出力XMLデータ31を蓄積し、過去に生成した出力XMLデータ31のなかで再利用したいデータを指定して入力XMLデータ12として利用することができる。従って、既存のXMLデータを再利用して新たなXMLデータを生成することにより、ユーザの手作業に係る処理を削減することができる。
【0082】
また、本実施の形態によれば、入力DTDデータ11、入力XMLデータ12、または出力XMLデータ31を、ユーザがエディタなどで編集しやすいNVリストデータとして生成し蓄積することができる。よって、ユーザが過去の蓄積データをもとに編集したNVリストデータを再利用データとして利用してXMLデータを生成することができる。従って、XMLデータを編集する場合と比較して、ユーザの手作業に係る処理を低減することができる。
【0083】
なお、本実施の形態では、XML生成装置20に記憶装置A10および記憶装置B30が接続される場合を例に説明したが、XML生成装置20は、XML生成装置20内蔵の記憶装置に記憶される入力データに基づいてXMLデータを生成するものであってもよい。また、XML生成装置20は、生成したXMLデータを、XML生成装置20内蔵の記憶装置に記憶させるものであってもよい。
【0084】
また、本実施の形態では、パスの区切り記号として「/ 」を指定し、パスのプレフィックスを指定しない場合を例に説明したが、パスの区切り記号およびプレフィックスは、本実施の形態で示した例に限られない。例えば、パスの区切り記号として「. 」を指定し、パスのプレフィックスを「data」としてもよい。そのように指定した場合には、例えば、本実施の形態で「/Simple/One/@idReq」と示したパス値は、「data.Simple.One.@idReq」と出力される。
【0085】
また、本実施の形態では、ユーザがエディタ編集したNVリストデータを再利用データとして利用してXMLデータを生成する場合を例に説明したが、ユーザが編集したXMLデータを再利用データとして利用してもよい。
【0086】
また、図1に示した構成は、ソフトウェアによって実現可能である。すなわち、本実施の形態では、コンピュータに、生成すべきXMLデータのデータ構造を指定する構造情報を入力する処理と、パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報、または既存のXMLデータを、再利用情報として入力する処理と、設定情報および再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成する処理と、パス情報を合成した合成情報に基づいて、XMLデータを生成する処理とを実行させるためのXML生成プログラムによってXML生成装置を実現可能である。
【0087】
【発明の効果】
本発明によれば、XML生成装置が、生成すべきXMLデータのデータ構造を指定する構造情報を入力する構造情報入力手段と、パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報、または既存のXMLデータを、再利用情報として入力する再利用情報入力手段と、設定情報および再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成するパス情報合成手段と、パス情報合成手段によって合成された合成情報に基づいて、XMLデータを生成するXML生成手段とを備えるように構成したので、既存のXMLデータやユーザが既存データなどをもとに編集したデータを再利用データとして利用することにより、ユーザの手作業に係る処理を削減することができる。従って、テストデータや多数のXMLデータのテンプレートを容易に生成することができ、XMLデータ生成の際の工数を低減することができる。
【0088】
また、本発明によれば、XML生成プログラムが、コンピュータに、生成すべきXMLデータのデータ構造を指定する構造情報を入力する処理と、パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報、または既存のXMLデータを、再利用情報として入力する処理と、設定情報および再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成する処理と、パス情報を合成した合成情報に基づいて、XMLデータを生成する処理とを実行させるので、既存のXMLデータやユーザが既存データなどをもとに編集したデータを再利用データとして利用することにより、ユーザの手作業に係る処理を削減することができる。従って、テストデータやXMLデータのテンプレートを容易に生成することができ、XMLデータ生成の際の工数を低減することができる。
【図面の簡単な説明】
【図1】本発明によるXML生成装置の構成の一例を示すブロック図である。
【図2】入力DTDデータの内容の例を示す説明図である。
【図3】入力XMLデータの内容の例を示す説明図である。
【図4】入力NVリストデータの内容の例を示す説明図である。
【図5】パス合成結果に基づくNVリストデータの一例を示す説明図である。
【図6】パス合成結果に基づくNVリストデータの他の例を示す説明図である。
【図7】XMLデータを生成する処理経過の一例を示す流れ図である。
【図8】XML変換NVリストデータの例を示す説明図である。
【図9】パス合成の処理経過の一例を示す流れ図である。
【図10】出力XMLデータおよび出力NVリストデータの内容の一例を示す説明図である。
【図11】出力XMLデータおよび出力NVリストデータの内容の他の例を示す説明図である。
【図12】出力XMLデータおよび出力NVリストデータの内容のさらに他の例を示す説明図である。
【図13】出力XMLデータおよび出力NVリストデータの内容のさらに他の例を示す説明図である。
【符号の説明】
10 記憶装置A
11 入力DTDデータ
12 入力XMLデータ
13 入力NVリストデータ
20 XML生成装置
201 生成オプション入力部
202 DTD入力部
203 構造解析部
204 DTD変換部
205 XML入力部
206 XML変換部
207 NVリスト入力部
208 パス合成部
209 XML生成部
210 XML出力部
211 NVリスト生成部
212 NVリスト出力部
30 記憶装置B
31 出力XMLデータ
32 出力NVリストデータ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an XML generation device that generates XML data based on definition information that defines a data structure of XML data, and an XML generation program.
[0002]
[Prior art]
In an affiliated system such as B2Bi (Business to Business Integration) or EAI (Enterprise Application Integration), when conducting a continuity test using test data between companies, an XML (Extensible Markup Language data using an Extensible Markup) is used when conducting a continuity test using test data between companies. There is. It is convenient to have template data (hereinafter referred to as a template) when formulating business specifications in system construction.
[0003]
Since the XML data has a complicated structure, editing work may be troublesome.
[0004]
[Patent Document 1]
JP 2001-101183 A (Page 5-8, FIG. 1, FIG. 4-6)
[0005]
[Problems to be solved by the invention]
In the data structuring method described in
[0006]
Therefore, it is an object of the present invention to be able to easily generate a plurality of XML data, and to reduce the number of steps when generating the XML data.
[0007]
[Means for Solving the Problems]
An XML generation apparatus according to the present invention is an XML generation apparatus that generates XML data according to a specified data structure, and inputs structure information (for example, input DTD data 11) that specifies a data structure of XML data to be generated. Structure information input means (implemented by the DTD input unit 202) and correspondence information indicating the correspondence between the element indicated by the path and the number of elements or the correspondence between the element and the value of the element (for example, the input NV list data 13 ) Or existing XML data (for example, input XML data 12) as reusable information input means (implemented by the XML
[0008]
The XML generation apparatus includes setting information input means (implemented by the generation option input unit 201) for inputting setting information (for example, generation option information), and the path information synthesizing means includes setting information input by the setting information input means. The path information of the XML data may be generated and combined based on the setting information held by the setting information holding unit and the reuse information. According to such a configuration, when generating the XML data, the user can arbitrarily change a generation pattern such as an element value and an attribute value included in the generated XML data.
[0009]
The reuse information input means includes correspondence information input means (implemented by the NV list input unit 207) for inputting correspondence information as reuse information, and the path information synthesizing means receives input from the correspondence information input means. The path information included in the correspondence information may be extracted, and the extracted path information may be adopted as a synthesis target to synthesize the path information. According to such a configuration, it is possible to generate XML data by using data edited based on past accumulated data by the user as reuse data. Therefore, compared to the case of editing the XML data, it is possible to reduce processing related to the manual work of the user.
[0010]
The reuse information input means includes an XML input means (implemented by the XML input unit 205) for inputting existing XML data as reuse information, and the path information synthesizing means includes an existing XML data input by the XML input means. Is extracted, and the extracted path information is adopted as a synthesis target to synthesize the path information. The XML generation unit converts the new XML data based on the synthesis information synthesized by the path information synthesis unit. It may be generated. According to such a configuration, by generating new XML data by reusing the existing XML data, it is possible to reduce processing related to the manual work of the user.
[0011]
The path information synthesizing means may synthesize the path information by preferentially adopting the path information included in the correspondence information over the path information included in the existing XML data. According to such a configuration, it is possible to generate XML data in which the reuse data edited by the user is preferentially reflected.
[0012]
When the path information specified from the structure information is not included in the correspondence information or the existing XML data, the path information combining unit may combine the path information according to the generation pattern specified in the setting information. . According to such a configuration, the XML data can be generated even when the path information corresponding to the reuse data edited or specified by the user is not included.
[0013]
The XML generation apparatus performs correspondence information (for example, output NV list data) based on synthesis information synthesized by the path information synthesis unit, structure information input by the structure information input unit, or existing XML data input by the XML input unit. 32, which is provided with correspondence information generation means (realized by the NV
[0014]
The reuse information input means may input the XML data generated by the XML generation means or the correspondence information generated by the correspondence information generation means as reuse information. According to such a configuration, the generated XML data and the data edited by the user can be reused as reusable data at the next generation of the XML data.
[0015]
An XML generation program according to the present invention is an XML generation program mounted on an XML generation apparatus having setting information holding means for holding setting information which is information for specifying a generation pattern of XML data to be generated. Processing for inputting structure information for designating the data structure of the XML data to be generated, and correspondence information indicating the correspondence between the element indicated by the path and the number of elements or the correspondence between the element and the value of the element, A process of inputting XML data as reuse information, and generating path information indicating a path name and the number of elements or the value of an element for each path specified from the structure information based on the setting information and the reuse information. It is characterized by executing a process of combining and a process of generating XML data based on the combined information obtained by combining the path information.
[0016]
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 an example of the configuration of an XML generation device according to the present invention. As shown in FIG. 1, the
[0017]
In the present embodiment, the
[0018]
The storage device A10 stores input
[0019]
The NV list data is text data in which the correspondence between each element and the number of elements and the correspondence between each element and the value of the element are listed. In the NV list data, the correspondence between each element is displayed by associating each element with the number of elements or each element and the value of the element with “=”. For example, the correspondence between the elements is displayed as “element name = number of elements” or “element name = element value”. Also, for example, using “,” instead of “=”, the correspondence between “element name, number of elements” or “element name, element value” and each element is displayed in CSV (Comma Separated Value) format. Good. The input
[0020]
The input data including the definition information of the data structure of the generated XML data is not limited to the DTD data. For example, an XML schema including definition information of a data structure of XML data may be used.
[0021]
As shown in FIG. 1, the
[0022]
The generation
[0023]
Note that the
[0024]
The
[0025]
The
[0026]
The
[0027]
The
[0028]
The
[0029]
The storage device B30 stores
[0030]
The structure information input unit is realized by the
[0031]
FIG. 2 is an explanatory diagram illustrating an example of the content of the
[0032]
In this example, as shown in FIG. 2, among the child elements defined in the parent element "Simple", one of "OrA", "OrB" and "OrC" is selected and designated. The symbol "|" of the XML language indicating that this must be done is described. When "OrA" is designated, one of the data types of "
[0033]
FIG. 3 is an explanatory diagram showing an example of the content of the
[0034]
Note that the
[0035]
FIG. 4 is an explanatory diagram illustrating an example of the contents of the input
[0036]
Next, the concept of path information will be described. The path indicates the relationship between the parent element and the child element using a delimiter such as “/” for each element included in the XML data or NV list data. In the present embodiment, an example will be described in which a path name is expressed by XPath (XML Path Language). For example, a path indicating the relationship between the parent element "Simple" and the child elements "One" and "OneOrMore" is expressed as "/ Simple / One / @ idReq" or "/ Simple / OneOrMore". The path information is information indicating a path name and the number of elements or a path value (for example, an element value or an attribute value).
[0037]
When symbols such as “?”, “*”, And “+” exist in the DTD data and XML data when converting the path format, the symbols are converted to the path format by adding these symbols to the end of each element name. I do. For example, paths such as “/ Simple / ZeroOrOne?”, “/ Simple / ZeroOrMore *”, and “/ Simple / OneOrMore +” are generated. If the symbol "|" exists, it is converted to a path format by adding parentheses before and after the selected element. For example, a path such as “/ Simple / (OrA | OrB | OrC)” is generated.
[0038]
For example, in the generation option information, the number of elements to which "?" And "*" are added is set to "0", the number of elements to which "+" is added is set to "1", and the path information is set. An example in which the images are combined will be described. FIG. 5 is an explanatory diagram showing an example of NV list data obtained by converting the result of combining path information by the
[0039]
Also, as a setting value other than the number of elements to which "?", "*", And "+" are added, the path delimiter is set to "/" and the path prefix (path prefix) is set. It is assumed that no designation is set, that a null value (undefined value) is not output as a default value of an element value or an attribute value, and that no IMPLIED attribute is output. If it is set not to output a null value, for example, a path name is output as it is as a path value.
[0040]
As shown in FIG. 5, for the path "/ Simple / One / @ idReq", "null value" is set not to be output. For example, the path name "/ Simple / One / @ idReq" is not changed. Path information is generated as a path value. For the paths “/ Simple / ZeroOrOne?” And “/ Simple / ZeroOrMore *”, the number of elements is set to “0”, so that the path information is generated as the path value “0”. Since the number of elements is “0”, no path information is generated for the paths “/ Simple / ZeroOrOne” and “/ Simple / ZeroOrMore” indicating the contents of the elements. For the path “/ Simple / OneOrMore +”, since the number of elements is set to “1”, path information is generated as a path value “1”. For the path “/ Simple / OneOrMore” indicating the content of the element, it is set that a null value is not output. For example, path information is generated using the path name “/ Simple / OneOrMore” as it is as the path value. You.
[0041]
Since the selection designation of the "|" symbol is not set, the head information is selected based on the generated default information. That is, “OrA” and “selectType1” are selected, and path information is generated based on the selection result. If the generation option information is set to select the second information, “/ Simple / (OrA | OrB | OrC) = 2” is generated as the path information, and the content of the element “OrB” Is generated. Since no output is set for the IMPLIED attribute, path information for the attribute “idImp” is not generated in this example.
[0042]
When the number of all elements to which "?", "*", And "+" are added in the generation option information is set to "1", the number of elements included in the
[0043]
As shown in FIG. 6, in addition to the path information generated in FIG. 5, path information about the paths “/ Simple / ZeroOrOne?” And “/ Simple / ZeroOrMore *” is generated. That is, for the path “/ Simple / ZeroOrOne?”, Path information is generated as a path value “1”. For the path "/ Simple / ZeroOrOne" indicating the content of the element, for example, path information is generated using the path name "/ Simple / ZeroOrOne" as a path value. For “/ Simple / ZeroOrMore *”, path information is generated as a path value “1”. For the path “/ Simple / ZeroOrMore” indicating the content of the element, for example, path information is generated using the path name “/ Simple / ZeroOrMore” as a path value.
[0044]
Next, the operation will be described. FIG. 7 is a flowchart illustrating an example of a process of generating the XML data by the
[0045]
The generation
[0046]
For example, the generation
[0047]
If the input instruction of the generation option information has not been input from the user, the process of step S103 is not performed. When the process of step S103 is not performed, the
[0048]
When the file name of the input XML data is input by the user, the
[0049]
When the file name of the input NV list data is input by the user, the NV
[0050]
Note that, when the file name is input from the user, instead of executing the processing of step S104 or S105, for example, the processing of step S104 or S105 may be executed according to an instruction included in the batch processing. Good.
[0051]
The order in which the processes of steps S103, S104, and S105 are performed is not limited to the order described in the present embodiment. Further, any or all of steps S103, S104, and S105 may be performed before the processing of steps S101 and S102.
[0052]
When the user inputs an instruction to convert the
[0053]
When the user inputs an instruction to convert to NV list data, the process of step S106 is not executed, but, for example, the process of step S106 is executed according to an instruction included in the batch process. Is also good.
[0054]
The
[0055]
FIG. 8 is an explanatory diagram illustrating an example of XML conversion NV list data generated by the
[0056]
The
[0057]
FIG. 9 is a flowchart illustrating an example of the progress of the process in which the
[0058]
If there is no path information of the corresponding part in step S23 or if there is no XML conversion NV list data, the
[0059]
When the path information is synthesized, the
[0060]
Note that, when an instruction to generate the output
[0061]
FIG. 10 is an explanatory diagram showing an example of the generated
[0062]
As shown in FIG. 10A, the
[0063]
The
[0064]
As shown in FIG. 10B, the NV
[0065]
FIG. 11 is an explanatory diagram showing another example of the generated
[0066]
As illustrated in FIG. 11A, since one element is set for each element to which “?”, “*”, And “+” are added, the
[0067]
In addition, since it is set that the null value is not output as the default value, the
[0068]
FIG. 12 is an explanatory diagram showing still another example of the generated
[0069]
For each element to which “?”, “*”, And “+” are added, one element is generated. For the element “OneOrMore”, two paths are used in the
[0070]
Further, it is set that a null value is not output as a default value. However, since the attribute value “idReq” is specified as the attribute value “000001” in the
[0071]
Regarding the selection designation of the “|” symbol, since “OrA” and “
[0072]
FIG. 13 is an explanatory diagram showing still another example of the generated
[0073]
For each element to which “?”, “*”, And “+” are added, one element is set. However, for the element “OneOrMore”, the input
[0074]
The NV
[0075]
Also, it is set that a null value is not output as a default value. However, since the attribute “idImp” is specified to be output as “implied” in the input
[0076]
Further, since the first value of the element “OneOrMore” is specified as “data1” in the
[0077]
Since the attribute “idReq” is specified to be output as “000001” in the
[0078]
Regarding the selection designation of the "|" symbol, "OrA" and "
[0079]
When the
[0080]
As described above, according to the present embodiment, existing XML data or NV list data edited by a user based on existing data or the like is used as reuse data in accordance with the definition information of the data structure of the XML data to be generated. The XML data is generated by using the XML data. Therefore, by using the reuse data, it is possible to reduce processing related to the manual work of the user. Therefore, it is possible to easily generate a large number of test data and XML data templates that differ only in a part of the data, and to reduce the number of steps in generating the XML data.
[0081]
Further, according to the present embodiment, the generated
[0082]
Further, according to the present embodiment, the
[0083]
Note that, in the present embodiment, a case where the storage device A10 and the storage device B30 are connected to the
[0084]
Further, in the present embodiment, an example has been described in which “/” is specified as a path delimiter and a path prefix is not specified. However, the path delimiter and the prefix are the same as those described in the present embodiment. Not limited to For example, “.” May be specified as a path delimiter, and the prefix of the path may be “data”. When such designation is made, for example, the path value indicated as “/ Simple / One / @ idReq” in the present embodiment is output as “data.Simple.One. @ IdReq”.
[0085]
Further, in the present embodiment, an example has been described in which XML data is generated by using NV list data edited by the user as reuse data as an example, but XML data edited by the user is used as reuse data. You may.
[0086]
The configuration shown in FIG. 1 can be realized by software. That is, in the present embodiment, a process of inputting, to a computer, structure information for specifying a data structure of XML data to be generated, a correspondence between an element indicated by a path and the number of elements, or a correspondence between an element and an element value A process of inputting correspondence information indicating a relationship or existing XML data as reuse information, and a path name and the number of elements or elements for each path specified from the structure information based on the setting information and the reuse information. An XML generation apparatus can be realized by an XML generation program for executing a process of generating and combining path information indicating the value of and the process of generating XML data based on the combined information obtained by combining the path information. .
[0087]
【The invention's effect】
According to the present invention, a structure information input unit for inputting structure information for designating a data structure of XML data to be generated, a correspondence relationship between an element indicated by a path and an element number, or an element to element value Reusable information input means for inputting relevance information indicating a relevance relationship with existing or existing XML data as reusable information, and for each path specified from the structure information based on the setting information and the reusable information, A path information synthesizing unit that generates and synthesizes path information indicating a path name and the number of elements or an element value; and an XML generating unit that generates XML data based on the synthesis information synthesized by the path information synthesizing unit. With this configuration, existing XML data and data edited by the user based on existing data can be used as reusable data, thereby reducing user manual work. It is possible to reduce the processing that. Therefore, it is possible to easily generate a template of test data and a large number of XML data, and it is possible to reduce man-hours at the time of generating the XML data.
[0088]
Further, according to the present invention, the XML generation program inputs, to the computer, structure information for designating the data structure of the XML data to be generated, the correspondence between the element indicated by the path and the number of elements, or the element and element. A process of inputting, as reuse information, correspondence information indicating the correspondence relationship with the value of the XML or existing XML data, and a path name for each path specified from the structure information based on the setting information and the reuse information. To generate and combine path information indicating the number of elements and the value of the element, and to generate XML data based on the combined information obtained by combining the path information. By using data edited based on existing data or the like as reusable data, it is possible to reduce processing related to a user's manual work. Therefore, a template for test data or XML data can be easily generated, and the number of steps for generating XML data can be reduced.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating an example of a configuration of an XML generation device according to the present invention.
FIG. 2 is an explanatory diagram illustrating an example of the content of input DTD data.
FIG. 3 is an explanatory diagram showing an example of the content of input XML data.
FIG. 4 is an explanatory diagram showing an example of the contents of input NV list data.
FIG. 5 is an explanatory diagram showing an example of NV list data based on a path synthesis result.
FIG. 6 is an explanatory diagram showing another example of NV list data based on a path synthesis result.
FIG. 7 is a flowchart illustrating an example of a process of generating XML data;
FIG. 8 is an explanatory diagram showing an example of XML conversion NV list data.
FIG. 9 is a flowchart showing an example of the progress of path synthesis processing.
FIG. 10 is an explanatory diagram showing an example of the contents of output XML data and output NV list data.
FIG. 11 is an explanatory diagram showing another example of the contents of output XML data and output NV list data.
FIG. 12 is an explanatory diagram showing still another example of the contents of output XML data and output NV list data.
FIG. 13 is an explanatory diagram showing still another example of the contents of output XML data and output NV list data.
[Explanation of symbols]
10 Storage device A
11 Input DTD data
12 Input XML data
13 Input NV list data
20 XML generator
201 Generation option input section
202 DTD input unit
203 Structural Analysis Department
204 DTD converter
205 XML input unit
206 XML converter
207 NV list input section
208 Path synthesis unit
209 XML generation unit
210 XML output unit
211 NV list generation unit
212 NV list output unit
30 Storage device B
31 Output XML data
32 Output NV list data
Claims (9)
生成すべきXMLデータのデータ構造を指定する構造情報を入力する構造情報入力手段と、
パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報、または既存のXMLデータを、再利用情報として入力する再利用情報入力手段と、
生成すべきXMLデータの生成パターンを指定する情報である設定情報を保持する設定情報保持手段と、
前記設定情報および前記再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成するパス情報合成手段と、
前記パス情報合成手段によって合成された合成情報に基づいて、XMLデータを生成するXML生成手段とを
備えたことを特徴とするXML生成装置。An XML generation device that generates XML data according to a specified data structure,
Structure information input means for inputting structure information for designating a data structure of XML data to be generated;
Reuse information input means for inputting, as reuse information, correspondence information indicating the correspondence between the element indicated by the path and the number of elements or the correspondence between the element and the value of the element, or existing XML data;
Setting information holding means for holding setting information which is information for specifying a generation pattern of XML data to be generated;
Path information synthesizing means for generating and synthesizing path information indicating a path name and the number of elements or element values for each path specified from the structure information, based on the setting information and the reuse information,
An XML generation apparatus, comprising: XML generation means for generating XML data based on synthesis information synthesized by the path information synthesis means.
パス情報合成手段は、前記設定情報入力手段が入力した設定情報と、設定情報保持手段が保持する設定情報と、再利用情報とに基づいてXMLデータのパス情報を生成し合成する
請求項1記載のXML生成装置。A setting information input means for inputting setting information;
2. The path information synthesizing unit generates and synthesizes path information of XML data based on the setting information input by the setting information input unit, the setting information held by the setting information holding unit, and the reuse information. XML generation device.
パス情報合成手段は、前記対応関係情報入力手段が入力した対応関係情報に含まれるパス情報を抽出し、抽出した前記パス情報を合成対象として採用してパス情報を合成する
請求項1または請求項2記載のXML生成装置。The reuse information input means includes correspondence information input means for inputting correspondence information as reuse information,
The path information combining unit extracts path information included in the correspondence information input by the correspondence information input unit, and combines the path information by using the extracted path information as a combination target. 2. The XML generator according to 2.
パス情報合成手段は、前記XML入力手段が入力した既存のXMLデータに含まれるパス情報を抽出し、抽出した前記パス情報を合成対象として採用してパス情報を合成し、
XML生成手段は、前記パス情報合成手段によって合成された合成情報に基づいて、新たなXMLデータを生成する
請求項1から請求項3のうちのいずれか1項に記載のXML生成装置。The reuse information input means includes an XML input means for inputting existing XML data as reuse information,
Path information combining means for extracting path information included in the existing XML data input by the XML input means, and combining the extracted path information as a synthesis target to synthesize path information;
4. The XML generation device according to claim 1, wherein the XML generation unit generates new XML data based on the synthesis information synthesized by the path information synthesis unit.
コンピュータに、
生成すべきXMLデータのデータ構造を指定する構造情報を入力する処理と、パスが示す要素と要素数との対応関係若しくは要素と要素の値との対応関係を示す対応関係情報、または既存のXMLデータを、再利用情報として入力する処理と、
前記設定情報および前記再利用情報に基づいて、構造情報から特定されるパス毎に、パス名と要素数または要素の値とを示すパス情報を生成し合成する処理と、
パス情報を合成した合成情報に基づいて、XMLデータを生成する処理とを実行させるためのXML生成プログラム。An XML generation program mounted on an XML generation apparatus including setting information holding means for holding setting information which is information for specifying a generation pattern of XML data to be generated,
On the computer,
A process of inputting structure information for designating a data structure of XML data to be generated, and a relationship information indicating a correspondence between an element indicated by a path and the number of elements or a correspondence between an element and an element value, or an existing XML A process of inputting data as reuse information;
Based on the setting information and the reuse information, for each path specified from the structure information, processing to generate and synthesize path information indicating the path name and the number of elements or the value of the element,
And a process for generating XML data based on the combined information obtained by combining the path information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003026282A JP2004240507A (en) | 2003-02-03 | 2003-02-03 | Xml generation device and xml generation program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003026282A JP2004240507A (en) | 2003-02-03 | 2003-02-03 | Xml generation device and xml generation program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004240507A true JP2004240507A (en) | 2004-08-26 |
Family
ID=32954338
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003026282A Pending JP2004240507A (en) | 2003-02-03 | 2003-02-03 | Xml generation device and xml generation program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004240507A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101122629B1 (en) | 2011-11-18 | 2012-03-09 | 김춘기 | Method for creation of xml document using data converting of database |
KR101243058B1 (en) | 2012-10-25 | 2013-03-13 | 한국과학기술정보연구원 | Xml thesis constructing system and method |
-
2003
- 2003-02-03 JP JP2003026282A patent/JP2004240507A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101122629B1 (en) | 2011-11-18 | 2012-03-09 | 김춘기 | Method for creation of xml document using data converting of database |
US9208255B2 (en) | 2011-11-18 | 2015-12-08 | Chun Gi Kim | Method of converting data of database and creating XML document |
KR101243058B1 (en) | 2012-10-25 | 2013-03-13 | 한국과학기술정보연구원 | Xml thesis constructing system and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5197688B2 (en) | Integrated environment generator | |
US8286146B2 (en) | Method for automatic generation of schema mapping application code | |
CN108984172B (en) | Interface file generation method and device | |
JP2007233973A (en) | Sequential processing transfer device and sequential processing transfer method | |
JP2004240507A (en) | Xml generation device and xml generation program | |
JP2009122933A (en) | Definition information-reconstructing device for xml document conversion, method and program for the same | |
JP5275087B2 (en) | Program generating apparatus and block diagram generating apparatus | |
JP2008052356A (en) | Source code automatic generation device | |
JP2007079906A (en) | Source code generator | |
JP2009211599A (en) | Mapping definition creation system and mapping definition creation program | |
JP3994854B2 (en) | Data mapping rule reuse device, method, and program in electronic catalog conversion system | |
JP4519081B2 (en) | Document conversion apparatus and program | |
JPWO2005038647A1 (en) | User interface software design system | |
JP2005250593A (en) | Object information generating device | |
JP2004145736A (en) | Character recognition device, character recognition data output method, program and recording medium | |
JP2009157847A (en) | Program development device, and program development program | |
JP2009230606A (en) | Source code template generator | |
JP2007094453A (en) | Program development support system, program development support method and program | |
JP4220439B2 (en) | Structured data conversion apparatus and method | |
JPH08328841A (en) | Software generating device | |
JP5400344B2 (en) | Document conversion apparatus and program | |
JP4154164B2 (en) | Knowledge reuse system | |
JP4438625B2 (en) | Display device | |
JP2005157827A (en) | Method and device for creating program | |
JPH04142622A (en) | Program generator |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20051118 |
|
RD03 | Notification of appointment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7423 Effective date: 20051117 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20051117 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060322 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20060912 |