JP2009087285A - System, method and program for xml parsing, electronic device, and web service - Google Patents

System, method and program for xml parsing, electronic device, and web service Download PDF

Info

Publication number
JP2009087285A
JP2009087285A JP2007259489A JP2007259489A JP2009087285A JP 2009087285 A JP2009087285 A JP 2009087285A JP 2007259489 A JP2007259489 A JP 2007259489A JP 2007259489 A JP2007259489 A JP 2007259489A JP 2009087285 A JP2009087285 A JP 2009087285A
Authority
JP
Japan
Prior art keywords
analysis
instruction
xml
data
information acquisition
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.)
Withdrawn
Application number
JP2007259489A
Other languages
Japanese (ja)
Inventor
Eri Miura
恵梨 三浦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2007259489A priority Critical patent/JP2009087285A/en
Publication of JP2009087285A publication Critical patent/JP2009087285A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)
  • Document Processing Apparatus (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To attain an XML parsing function equivalent to a DOM by saving a memory and to load the XML parsing system to an incorporated system on which the DOM can not be loaded by resource restriction. <P>SOLUTION: The XML parsing system 60 includes: an element analysis part (SOAP parser 62) which analyzes construction of XML data (SOAP data SD) input from the outside to acquire a pointer of each element constituting the XML data (SOAP data SD); and a sequential information acquisition part (event drive parser 63) which sequentially acquires information about elements of the XML data pointed by the pointer for every pointer. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、組み込みプログラム向けのXML構文解析システム、XML構文解析方法、XML構文解析プログラム、電子機器及びWebサービスに関する。   The present invention relates to an XML syntax analysis system, an XML syntax analysis method, an XML syntax analysis program, an electronic device, and a Web service for an embedded program.

近年、Webサービスなどの普及により、ネットワーク上のクライアント、サーバ間での通信手段としてXML(eXtensible Markup Language)データを用いた通信が主流となっている。ネットワーク対応のプリンタやスキャナなどのデバイスに関しても例外でなく、PCなどのクライアントからの要求をXMLデータで受け、その要求に対するレスポンスをXMLデータで行うという通信が普及している。   In recent years, with the spread of Web services and the like, communication using XML (eXtensible Markup Language) data has become mainstream as a communication means between clients and servers on a network. There are no exceptions regarding devices such as network-compatible printers and scanners, and communication in which a request from a client such as a PC is received as XML data and a response to the request is performed as XML data has become widespread.

また、Webサービス同士の連携を図るためのメッセージ交換やリモートプロシージャの呼び出しをXMLベースで行うためのSOAP(Simple Object Access Protocol)というプロトコル仕様が提案されている。SOAPは、ネットワーク上のアプリケーション間(オブジェクト間)の情報を交換し合うための単純で軽量なプロトコルの仕様である。   In addition, a protocol specification called SOAP (Simple Object Access Protocol) for exchanging messages and calling remote procedures on an XML basis for cooperation between Web services has been proposed. SOAP is a simple and lightweight protocol specification for exchanging information between applications (objects) on a network.

デバイスは、クライアントから送られてくるSOAPデータからクライアントの要求がどういった内容であるのかを確認するために、SOAPデータを構成するXML構文を解析し処理を行う必要がある。それを解決する仕組みとして、DOM(Document Object Model)があるが、DOMはシステムに大きなプログラムサイズとRAMサイズを要求する。プリンタやスキャナなどのデバイスは、プログラムサイズやRAMサイズ(デバイス起動時使用できるメモリサイズ)に制限があるため、なるべく省プログラムサイズ、省メモリで動作する仕組みでなくてはならないため、DOMを適用できないケースが多い。   The device needs to analyze and process the XML syntax constituting the SOAP data in order to confirm the content of the client request from the SOAP data sent from the client. There is a DOM (Document Object Model) as a mechanism for solving this, but the DOM requires a large program size and a RAM size from the system. Devices such as printers and scanners are limited in program size and RAM size (memory size that can be used when the device starts up), and therefore must be configured to operate with as little program size and memory as possible, so DOM cannot be applied. There are many cases.

この問題を解決するために、例えば特許文献1には、パース処理と妥当性検証とを同時に行うことにより高速化を実現する方法が記載されている。   In order to solve this problem, for example, Patent Document 1 describes a method for realizing high speed by performing parsing processing and validity verification at the same time.

特開2005−242912号公報JP-A-2005-242912

しかしながら、従来の方法では、プログラムサイズは減らせるがRAMサイズは大きいままという課題がある。   However, the conventional method has a problem that the program size can be reduced, but the RAM size remains large.

本発明は、上述の課題の少なくとも一部を解決するためになされたものであり、以下の形態または適用例として実現することが可能である。   SUMMARY An advantage of some aspects of the invention is to solve at least a part of the problems described above, and the invention can be implemented as the following forms or application examples.

[適用例1]
上位アプリケーションと、要素解析部と、逐次情報取得部と、を含み、前記上位アプリケーションは、外部から入力されたXMLデータの解析指示を前記要素解析部に送信し、前記要素解析部から前記解析指示に対する解析結果を受信し、前記解析結果に基づいて所定の処理を行い、前記要素解析部は、前記上位アプリケーションから前記解析指示を受信して前記逐次情報取得部に解析を指示し、前記上位アプリケーションからの前記解析指示に対する前記解析結果を得るまで解析の指示を繰り返し、前記逐次情報取得部は、前記要素解析部からの前記解析指示を受信して前記XMLデータを解析し、前記解析結果を前記要素解析部に送信する、ことを特徴とするXML構文解析システム。
[Application Example 1]
The host application includes an upper application, an element analysis unit, and a sequential information acquisition unit. The upper application transmits an analysis instruction of XML data input from the outside to the element analysis unit, and the analysis instruction is sent from the element analysis unit. The element analysis unit receives the analysis instruction from the upper application, instructs the sequential information acquisition unit to perform analysis, and performs the upper application. The analysis instruction is repeated until the analysis result for the analysis instruction is obtained, and the sequential information acquisition unit receives the analysis instruction from the element analysis unit, analyzes the XML data, and converts the analysis result to the analysis result. An XML parsing system characterized by being transmitted to an element analysis unit.

この構成によれば、省メモリでDOMと同等のXML構文解析機能を実現できるため、リソース制限によりDOMを搭載できない組み込みシステムへ搭載することでXML構文解析機能を実現できる。   According to this configuration, since the XML parsing function equivalent to DOM can be realized with memory saving, the XML parsing function can be realized by installing in an embedded system where DOM cannot be installed due to resource limitation.

[適用例2]
上記に記載のXML構文解析システムにおいて、前記XML構文解析システムは、前記上位アプリケーションの前記解析結果に基づき前記XMLデータを構成する要素同士の階層構造を記録した階層構造データを生成し、前記要素解析部は、前記逐次情報取得部へ送信した前記要素が前記上位アプリケーションから要求された要素より前方にあるかどうか前記階層構造データに基づいて判断し、前方にあると判断した場合には、前記逐次情報取得部に対して前記XMLデータの先頭から処理をする指示を送る、ことを特徴とするXML構文解析システム。
[Application Example 2]
In the XML syntax analysis system described above, the XML syntax analysis system generates hierarchical structure data in which a hierarchical structure of elements constituting the XML data is recorded based on the analysis result of the upper application, and the element analysis The unit determines whether the element transmitted to the sequential information acquisition unit is ahead of the element requested by the higher-order application based on the hierarchical structure data. An XML parsing system, characterized in that an instruction for processing from the beginning of the XML data is sent to an information acquisition unit.

この構成によれば、階層構造データによりXMLデータにおける現在の要素の位置関係を把握できるので、従来、XMLデータの途中の要素にポインタがあった場合、その上の要素にたどり着くためには、XMLデータの最後までポインタを移動後、先頭に戻っていたために費やしていた時間を大幅に節約することができる。   According to this configuration, since the positional relationship of the current element in the XML data can be grasped from the hierarchical structure data, conventionally, when there is a pointer in the middle part of the XML data, in order to reach the element above the XML, After moving the pointer to the end of the data, it was possible to save a great deal of time spent returning to the beginning.

[適用例3]
上位アプリケーション工程と、要素解析工程と、逐次情報取得工程と、を含み、前記上位アプリケーション工程は、外部から入力されたXMLデータの解析指示を前記要素解析工程に送り、前記要素解析工程から前記解析指示に対する解析結果を受け取り、前記解析結果に基づいて所定の処理を行い、前記要素解析工程は、前記上位アプリケーション工程から前記解析指示を受け取って前記逐次情報取得工程に解析を指示し、前記上位アプリケーション工程からの前記解析指示に対する前記解析結果を得るまで解析の指示を繰り返し、前記逐次情報取得工程は、前記要素解析工程からの前記解析指示を受信して前記XMLデータを解析し、前記解析結果を前記要素解析工程に送る、ことを特徴とするXML構文解析方法。
[Application Example 3]
A host application process, an element analysis process, and a sequential information acquisition process. The host application process sends an analysis instruction of XML data input from the outside to the element analysis process, and the analysis from the element analysis process An analysis result for the instruction is received, a predetermined process is performed based on the analysis result, and the element analysis step receives the analysis instruction from the upper application step and instructs the sequential information acquisition step for analysis, and the upper application The analysis instruction is repeated until the analysis result with respect to the analysis instruction from the step is obtained, and the sequential information acquisition step receives the analysis instruction from the element analysis step, analyzes the XML data, and obtains the analysis result. An XML parsing method, wherein the XML parsing method is sent to the element analysis step.

[適用例4]
上位アプリケーションステップと、要素解析ステップと、逐次情報取得ステップと、を含み、前記上位アプリケーションステップは、外部から入力されたXMLデータの解析指示を前記要素解析ステップに送り、前記要素解析ステップから前記解析指示に対する解析結果を受け取り、前記解析結果に基づいて所定の処理を行い、前記要素解析ステップは、前記上位アプリケーションステップから前記解析指示を受け取って前記逐次情報取得ステップに解析を指示し、前記上位アプリケーションステップからの前記解析指示に対する前記解析結果を得るまで解析の指示を繰り返し、前記逐次情報取得ステップは、前記要素解析ステップからの前記解析指示を受信して前記XMLデータを解析し、前記解析結果を前記要素解析ステップに送る、ことを特徴とするXML構文解析プログラム。
[Application Example 4]
A host application step, an element analysis step, and a sequential information acquisition step. The host application step sends an analysis instruction of XML data input from the outside to the element analysis step, and the analysis from the element analysis step An analysis result for the instruction is received, a predetermined process is performed based on the analysis result, and the element analysis step receives the analysis instruction from the upper application step and instructs the sequential information acquisition step to perform analysis, and the upper application The analysis instruction is repeated until the analysis result for the analysis instruction from the step is obtained, and the sequential information acquisition step receives the analysis instruction from the element analysis step, analyzes the XML data, and obtains the analysis result. This is sent to the element analysis step. XML parsing program characterized.

この構成によれば、省メモリでDOMと同等のXML構文解析機能を実現できるため、リソース制限によりDOMを搭載できない組み込みシステムへ搭載することでXML構文解析機能を実現できる。   According to this configuration, since the XML parsing function equivalent to DOM can be realized with memory saving, the XML parsing function can be realized by installing in an embedded system where DOM cannot be installed due to resource limitation.

[適用例5]
適用例1または2に記載のXML構文解析システムまたは適用例4に記載のXML構文解析プログラムを含むことを特徴とする電子機器。
[Application Example 5]
An electronic apparatus comprising the XML parsing system described in Application Example 1 or 2 or the XML parsing program described in Application Example 4.

この構成によれば、省メモリでDOMと同等のXML構文解析機能を実現できるため、リソース制限によりDOMを搭載できない組み込みシステムへ搭載することでXML構文解析機能を実現できる。   According to this configuration, since the XML parsing function equivalent to DOM can be realized with memory saving, the XML parsing function can be realized by installing in an embedded system where DOM cannot be installed due to resource limitation.

[適用例6]
上記に記載の電子機器を複数含み構成されていることを特徴とするWebサービス。
[Application Example 6]
A web service comprising a plurality of the electronic devices described above.

[適用例7]
上記に記載のWebサービスにおいて、前記Webサービスは、前記XMLデータをベースとしたSOAPにより情報交換を行うことを特徴とするWebサービス。
[Application Example 7]
In the Web service described above, the Web service exchanges information by SOAP based on the XML data.

この構成によれば、様々なプロトコルにバインディングして使用できるSOAPを使うことにより、環境に依存しないアプリケーションの作成ができる。   According to this configuration, it is possible to create an application that does not depend on the environment by using SOAP that can be used by binding to various protocols.

以下、XML構文解析システムの実施形態について図面に従って説明する。   Hereinafter, an embodiment of an XML parsing system will be described with reference to the drawings.

(第1実施形態)
<XML構文解析システムの構成>
先ず、第1実施形態に係るXML構文解析システムの構成について、図1を参照して説明する。図1は、第1実施形態に係るXML構文解析システムの構成を示すブロック図である。図1に示すように、XML構文解析システム60は、電子機器の一例としてネットワークプリンタ100に組み込まれている。また、ネットワークプリンタ100は、ネットワークケーブル(LAN:Local Area Network)300を介してクライアントPC200と接続され、Webサービスを利用した印刷システムを構成している。
(First embodiment)
<Configuration of XML parsing system>
First, the configuration of the XML parsing system according to the first embodiment will be described with reference to FIG. FIG. 1 is a block diagram showing the configuration of the XML parsing system according to the first embodiment. As shown in FIG. 1, the XML parsing system 60 is incorporated in a network printer 100 as an example of an electronic device. The network printer 100 is connected to a client PC 200 via a network cable (LAN: Local Area Network) 300 to configure a printing system using a Web service.

ネットワークプリンタ100は、内部バス10にCPU20と、ROM30と、RAM40と、プリントエンジン50と、が接続されている。XML構文解析システム60は、ROM30に格納され、プログラム実行時にRAM40にロードされる。XML構文解析システム60は、上位アプリケーション61と、要素解析部であるSOAPパーサ62と、逐次情報取得部であるイベント駆動パーサ63と、から構成されている。   In the network printer 100, a CPU 20, a ROM 30, a RAM 40, and a print engine 50 are connected to the internal bus 10. The XML parsing system 60 is stored in the ROM 30 and loaded into the RAM 40 when the program is executed. The XML parsing system 60 includes a higher-level application 61, a SOAP parser 62 that is an element analysis unit, and an event-driven parser 63 that is a sequential information acquisition unit.

クライアントPC200からの印刷要求項目を記載したSOAPデータSDは、LAN300を介してネットワークプリンタ100のRAM40に格納される。上位アプリケーション61は、SOAPパーサ62を使用してRAM40に格納されたSOAPデータSDを解析し、プリントエンジン50に印刷命令を送る。上位アプリケーション61は、SOAPパーサ62へのSOAPデータSDの解析指示送信およびSOAPパーサ62からの解析結果受信のための各種API(Application Program Interface)をSOAPパーサ62に送る。   The SOAP data SD describing the print request items from the client PC 200 is stored in the RAM 40 of the network printer 100 via the LAN 300. The upper application 61 analyzes the SOAP data SD stored in the RAM 40 using the SOAP parser 62 and sends a print command to the print engine 50. The host application 61 sends various APIs (Application Program Interface) for sending the analysis instruction of the SOAP data SD to the SOAP parser 62 and receiving the analysis result from the SOAP parser 62.

SOAPパーサ62は、APIに基づき上位アプリケーション61から子要素又は兄第要素への移動指示を受信し、イベント駆動パーサ63に対してはイベント駆動パーサ63の解析単位であるノードの解析をポインタPTで指示する。イベント駆動パーサ63は、RAM40に格納されたSOAPデータSD上のポインタ位置から逐次データEVをノード単位毎取得し、該取得したノードの種類を判定する。ここで、ノードとは”<“から”>“までのデータ列または”>“から”<”までのデータ列を1ノードとする。例えば、図2では<soap:Header>、Message dataがそれぞれ1ノードであり、改行、空白も1ノードとして扱われる。また、ノード種類とは<>で括られたデータは開始ノードであり、</>で括られたデータは終了ノード、それ以外は値である。   The SOAP parser 62 receives an instruction to move from the higher-level application 61 to the child element or the elder brother element based on the API, and for the event-driven parser 63, analyzes the node that is the analysis unit of the event-driven parser 63 with the pointer PT. Instruct. The event driven parser 63 sequentially acquires the data EV for each node from the pointer position on the SOAP data SD stored in the RAM 40, and determines the type of the acquired node. Here, a node refers to a data string from “<“ to “>” or a data string from “>” to “<” as one node. For example, in FIG. 2, <soap: Header> and Message data are each one node, and a line feed and a blank are also treated as one node. The node type is the start node, the data enclosed in <> is the start node, the data enclosed in </> is the end node, and the others are values.

イベント駆動パーサ63は、上述したようにSOAPデータSDの解析を行い、解析したノードの種類をSOAPパーサ62に応答すると共にポインタPTをノード終端まで移動する。SOAPパーサ62は、イベント駆動パーサ63から受信したノード種類に基づいて上位アプリケーション61から指示された子要素又は兄弟要素までポインタが移動したか否かを判断し、移動していれば上位アプリケーション61に対して移動の完了を応答する。上位アプリケーション61は、SOAPパーサ62からの移動完了通知を受信すると所望の子要素又は兄弟要素まで移動したか否かを判断し、移動していなければ所望の子要素または兄弟要素に移動するまで、SOAPパーサ62に移動の指示を繰り返す。   The event driven parser 63 analyzes the SOAP data SD as described above, responds to the SOAP parser 62 with the analyzed node type, and moves the pointer PT to the end of the node. The SOAP parser 62 determines whether or not the pointer has moved to the child element or sibling element instructed by the upper application 61 based on the node type received from the event driven parser 63. In response to the completion of movement. When the upper application 61 receives the movement completion notification from the SOAP parser 62, the upper application 61 determines whether or not it has moved to the desired child element or sibling element, and if it has not moved, until it moves to the desired child element or sibling element, The movement instruction is repeated to the SOAP parser 62.

<SOAPデータの構成>
次に、SOAPデータの構成について図2を参照して説明する。図2は、SOAPデータの構成の概略を示すリストである。
<Structure of SOAP data>
Next, the configuration of the SOAP data will be described with reference to FIG. FIG. 2 is a list showing an outline of the structure of the SOAP data.

図2に示すように、SOAPデータSDは、XML構文により記載されている。SOAPデータSDは、1行目のエンベロープ<soap:Envelope>、2行目のヘッダ<soap:Header>そして17行目のボディ<soap:Body>の各要素で構成されている。   As shown in FIG. 2, the SOAP data SD is described in XML syntax. The SOAP data SD is composed of an envelope <soap: Envelope> on the first line, a header <soap: Header> on the second line, and a body <soap: Body> on the 17th line.

ヘッダ<soap:Header>は、複数の子要素である、3行目の<wsa:MessageID>、4行目の<wsa:Action>、5行目の<wsa:To>、6行目の<wsa:RelatesTo>、7行目の<wsa:ReplyTo>、14行目の<ext:AAA>、15行目の<ext:BBB>、を含む。またこれら複数の子要素は、互いに兄弟要素と呼ばれる。   The header <soap: Header> is a plurality of child elements <wsa: MessageID> on the third line, <wsa: Action> on the fourth line, <wsa: To> on the fifth line, <on the sixth line wsa: RelatesTo>, <wsa: ReplyTo> on line 7, <ext: AAA> on line 14, and <ext: BBB> on line 15. These multiple child elements are called sibling elements.

7行目の<wsa:ReplyTo>は、さらに子要素として8行目の<wsa:Address>、9行目の<wsa:ReferenceParameters>、を含んでいる。また、9行目の<wsa:ReferenceParameters>は、さらに子要素として10行目の<ext:DDD>DDD data</ext:DDD>、11行目の<ext:EEE>EEE data</ext:EEE>、を含んでいる。   <Wsa: ReplyTo> on the seventh line further includes <wsa: Address> on the eighth line and <wsa: ReferenceParameters> on the ninth line as child elements. In addition, <wsa: ReferenceParameters> on the 9th line further includes <ext: DDD> DDD data </ ext: DDD> on the 10th line as child elements, and <ext: EEE> EEE data </ ext: on the 11th line. EEE>, including.

3行目の<wsa:MessageID>は、Message dataという値を含み、4行目の<wsa:Action>は、Action dataという値を含み、5行目の<wsa:To>は、To dataという値を含み、6行目の<wsa:RelatesTo>は、RelatesTo dataという値を含んでいる。   <Wsa: MessageID> on the third line contains the value Message data, <wsa: Action> on the fourth line contains the value Action data, and <wsa: To> on the fifth line says To data In the sixth line, <wsa: RelatesTo> includes a value “RelatesTo data”.

<XML構文解析システムの動作>
次に、XML構文解析システムの動作について図3を参照して説明する。図3は、XML構文解析システムの動作を示すフローチャートである。現在のポインタはSOAPデータSDの2行目の<soap:Header>の直前に位置するものとし、上位アプリケーション61は3行目<wsa:MessageID>の値Message dataの取得を行いたいものとする。
<Operation of XML parsing system>
Next, the operation of the XML parsing system will be described with reference to FIG. FIG. 3 is a flowchart showing the operation of the XML parsing system. It is assumed that the current pointer is located immediately before <soap: Header> on the second line of the SOAP data SD, and the upper application 61 wants to acquire the value Message data of <wsa: MessageID> on the third line.

上位アプリケーション61は、所望のSOAPデータSDの値を取得するためにSOAPパーサ62に対しSOAP解析を次の子要素に解析を移動するように指示を行う。   The upper application 61 instructs the SOAP parser 62 to move the analysis to the next child element in order to obtain a desired value of the SOAP data SD.

SOAPパーサ62は、上位アプリケーション61から子要素への解析移動指示を受信すると、イベント駆動パーサ63に対してSOAPデータSDの解析を進めるように指示を行う。   When the SOAP parser 62 receives an analysis movement instruction to the child element from the upper application 61, it instructs the event drive parser 63 to proceed with the analysis of the SOAP data SD.

先ず、ステップS100では、イベント駆動パーサ63は、SOAPデータSDのヘッダ<soap:Header>のポインタを取得する。   First, in step S100, the event driving parser 63 acquires a pointer of the header <soap: Header> of the SOAP data SD.

次に、ステップS102では、イベント駆動パーサ63は、SOAPデータSDから逐次データEVを取得し、データとして2行目の<soap:Header>を取得したことによりデータがヘッダであることを認識し、SOAPパーサ62にヘッダを取得したことを通知すると共に、ポインタPTを<soap:Header>の後端に移動する。   Next, in step S102, the event-driven parser 63 sequentially acquires the data EV from the SOAP data SD, recognizes that the data is a header by acquiring <soap: Header> on the second line as the data, In addition to notifying the SOAP parser 62 that the header has been acquired, the pointer PT is moved to the rear end of <soap: Header>.

SOAPパーサ62は上位アプリケーション61から指示を受けた子要素に解析が移動したと判断し、上位アプリケーション61に子要素の解析結果を通知する。   The SOAP parser 62 determines that the analysis has moved to the child element that has received an instruction from the upper application 61 and notifies the upper application 61 of the analysis result of the child element.

上位アプリケーション61は、子要素の解析結果を受信すると受信した解析結果が所望の解析結果であるかを判断し、所望の解析結果ではないと判断すると、解析を次の子要素に進めるようにSOAPパーサ62に指示を行う。   When the upper application 61 receives the analysis result of the child element, it determines whether the received analysis result is the desired analysis result. If the upper application 61 determines that the analysis result is not the desired analysis result, the upper application 61 advances the analysis to the next child element. The parser 62 is instructed.

SOAPパーサ62は、上位アプリケーション61から子要素への解析移動指示を受信すると、イベント駆動パーサ63に対してSOAPデータSDの解析を進めるように指示を行う。   When the SOAP parser 62 receives an analysis movement instruction to the child element from the upper application 61, it instructs the event drive parser 63 to proceed with the analysis of the SOAP data SD.

イベント駆動パーサ63は、SOAPデータSDのポインタを取得しポインタ位置からSOAPデータSDの取得を行い、<soap:Header>直後の改行および<wsa:MessageID>直前の空白を取得すると取得したノードの種類が値であると判断してSOAPパーサ62に値である旨を通知すると共に、空白の後ろすなわち<wsa:MessageIDの直前にポインタを移動する。   The event-driven parser 63 acquires the pointer of the SOAP data SD, acquires the SOAP data SD from the pointer position, and acquires the line feed immediately after <soap: Header> and the space immediately before <wsa: MessageID>. Is determined to be a value and notifies the SOAP parser 62 that it is a value, and the pointer is moved after the space, that is, immediately before <wsa: MessageID.

SOAPパーサ62は、イベント駆動パーサ63から解析結果が値であること受信すると、イベント駆動パーサ63に対して解析した値が空白であるか否かを問い合わせる。   When the SOAP parser 62 receives from the event driving parser 63 that the analysis result is a value, the SOAP parser 62 inquires of the event driving parser 63 whether or not the analyzed value is blank.

イベント駆動パーサ63は、値が空白であることをSOAPパーサ62に応答する。SOAPパーサ62は解析結果が空白であることが分かると、解析が子要素に達していないと判断できるため、解析結果を上位アプリケーション61に応答することなく、解析を進めるようにイベント駆動パーサ63に指示を行う。   The event driven parser 63 responds to the SOAP parser 62 that the value is blank. If the SOAP parser 62 finds that the analysis result is blank, it can determine that the analysis has not reached the child element, so the event-driven parser 63 can proceed with the analysis without responding to the upper application 61. Give instructions.

上記フローを所望の要素の解析結果が得られるまで繰り返す。   The above flow is repeated until an analysis result of a desired element is obtained.

次に、ステップS104では、現在の要素に子要素があるか否かを判定し、子要素がある場合はステップS110に移行し、子要素がない場合はステップS106に移行する。   Next, in step S104, it is determined whether or not the current element has a child element. If there is a child element, the process proceeds to step S110, and if there is no child element, the process proceeds to step S106.

次に、ステップS106では、次の要素があるか否か判定し、次の要素がある場合はステップS108に移行し、次の要素がない場合は処理を終了する。   Next, in step S106, it is determined whether or not there is a next element. If there is a next element, the process proceeds to step S108, and if there is no next element, the process ends.

次に、ステップS108では、現在の要素と同じ階層の次の要素の値を取得し、ステップS104に移行する。   Next, in step S108, the value of the next element in the same hierarchy as the current element is acquired, and the process proceeds to step S104.

一方、ステップS110では、子要素の値を取得し、ステップS104に移行する。   On the other hand, in step S110, the value of the child element is acquired, and the process proceeds to step S104.

以上に述べた本実施形態によれば、以下の効果が得られる。   According to the present embodiment described above, the following effects can be obtained.

本実施形態では、SOAPパーサ62がAPIに基づきRAM40に格納されたSOAPデータSDから各要素のポインタPTを取得し、イベント駆動パーサ63に要素のポインタPTを逐次送り、イベント駆動パーサ63によりポインタPTが指し示す要素の情報を取得し、上位アプリケーション61に返すので、省メモリでDOMと同等のXML構文解析機能を実現できるため、リソース制限によりDOMを搭載できない組み込みシステムへ搭載することでXML構文解析機能を実現でき、Webサービスの搭載などが可能となる。   In the present embodiment, the SOAP parser 62 acquires the element pointer PT from the SOAP data SD stored in the RAM 40 based on the API, sequentially sends the element pointer PT to the event drive parser 63, and the event drive parser 63 sends the pointer PT. Since the information of the element pointed to is acquired and returned to the upper application 61, the XML parsing function equivalent to DOM can be realized with memory saving, so the XML parsing function can be implemented by installing it in an embedded system where DOM cannot be installed due to resource limitations. Can be implemented, and a web service can be installed.

(第2実施形態)
第1実施形態では、解析開始前にポインタを現在の位置から移動させることは出来なかったが、本第2実施形態ではSOAPデータSDの階層構造データであるノード構成管理データを作成し、該ノード構成管理データに基づいてポインタを先頭に移動させることができる点が第1実施形態と異なる。特にSOAPデータSDサイズが大きく、上位アプリケーション61が現在のポインタの直前のノードの解析結果を要求した場合には、イベント駆動パーサ63の解析は一方向に逐次解析を進めることしか出来ないため、所望の解析結果を得るのに多大な時間を要した。
(Second Embodiment)
In the first embodiment, the pointer could not be moved from the current position before starting the analysis, but in the second embodiment, node configuration management data that is hierarchical structure data of the SOAP data SD is created, and the node It is different from the first embodiment in that the pointer can be moved to the head based on the configuration management data. In particular, when the SOAP data SD size is large and the upper application 61 requests the analysis result of the node immediately before the current pointer, the analysis of the event-driven parser 63 can only proceed sequentially in one direction. It took a lot of time to obtain the analysis results.

本第2実施形態では、SOAPデータSDのノード構成データを作成し、該ノード構成データを参照することによって、現在のポインタの位置と所望のノードの位置関係が分かるため、先頭から所望のノードまでの距離と現在のポインタから所望のノードまでの距離を比較して、先頭から所望のノードまでの距離の方が短い場合には、ポインタを先頭に移動してSOAPデータSDの解析時間を短縮することができる。   In the second embodiment, by creating node configuration data of the SOAP data SD and referring to the node configuration data, the positional relationship between the current pointer position and the desired node can be known. And the distance from the current pointer to the desired node are compared. If the distance from the head to the desired node is shorter, the pointer is moved to the head and the analysis time of the SOAP data SD is shortened. be able to.

以下、第2実施形態におけるXML構文解析システムの動作を解説する。本第2実施形態では、ポインタが図2の12行目の</wsa:ReferenceParameters>の直前に存在し、上位アプリケーション61が図2の9行目の<wsa:ReferenceParameters>の子要素への移動を要求するものとする。   The operation of the XML syntax analysis system in the second embodiment will be described below. In the second embodiment, the pointer exists immediately before </ wsa: ReferenceParameters> on the 12th line in FIG. 2, and the upper application 61 moves to the child element of <wsa: ReferenceParameters> on the 9th line in FIG. Is required.

図4は、SOAPデータのノード構成管理データを示すブロック図である。先ず、クライアントPC200からSOAPデータSDを受信した時点で、RAM40にSOAPデータSDを格納すると共に、図4に示すようなSOAPデータSDのノード構成管理データ400を作成し、イベント駆動パーサ63が解析するたびに更新するものとする。   FIG. 4 is a block diagram showing node configuration management data of SOAP data. First, when the SOAP data SD is received from the client PC 200, the SOAP data SD is stored in the RAM 40, and the node configuration management data 400 of the SOAP data SD as shown in FIG. 4 is created and analyzed by the event driven parser 63. It shall be updated each time.

ここで、図4について説明する。現在の要素401は、現在のポインタが位置する要素を表す。現在のポジションの種類402は、現在のポインタが位置しているノードの種類を表す。現在の階層数403は、ポインタが位置している要素の階層を意味する。現在の要素が属する親要素404は、ポインタが位置する子要素が属する全ての親要素を表す。各階層の先頭要素405は、現在ポインタが位置する要素に達するまでに、各階層で最初に現れるノードを示す。解析した総要素数406は、現在のポインタに達するまでに解析した要素の総数を表す。   Here, FIG. 4 will be described. The current element 401 represents the element where the current pointer is located. The current position type 402 represents the type of node where the current pointer is located. The current hierarchy number 403 means the hierarchy of the element where the pointer is located. The parent element 404 to which the current element belongs represents all the parent elements to which the child element where the pointer is located belongs. A head element 405 of each hierarchy indicates a node that appears first in each hierarchy before reaching the element where the current pointer is located. The total number of analyzed elements 406 represents the total number of elements analyzed until the current pointer is reached.

SOAPパーサ62は、上位アプリケーション61から<wsa:ReferenceParameters>の子要素への移動の要求を受信すると、ノード構成管理データ400の解析した総要素数406を取得する。   When the SOAP parser 62 receives a request to move to a child element of <wsa: ReferenceParameters> from the upper application 61, the SOAP parser 62 acquires the total number of elements 406 analyzed in the node configuration management data 400.

解析した総要素数406が11であるため、SOAPパーサ62は<wsa:ReferenceParameters>の子要素は既に解析済みであると判断し、イベント駆動パーサ63の初期化を行う。   Since the total number of elements 406 analyzed is 11, the SOAP parser 62 determines that the child elements of <wsa: ReferenceParameters> have already been analyzed, and initializes the event-driven parser 63.

イベント駆動パーサ63の初期化によってポインタはSOAPデータSDの先頭に戻るため、<wsa:ReferenceParameters>の子要素に達するまで第1実施形態と同様に解析を行う。   Since the pointer returns to the top of the SOAP data SD by the initialization of the event driven parser 63, the analysis is performed in the same manner as in the first embodiment until the child element of <wsa: ReferenceParameters> is reached.

以上に述べた本実施形態によれば、以下の効果が得られる。   According to the present embodiment described above, the following effects can be obtained.

本第2実施形態では、ノード構成管理データ400によりSOAPデータSDにおける現在のポインタの位置関係を把握できるので、従来、SOAPデータSDの途中にポインタがあった場合、その上の要素にたどり着くためには、SOAPデータSDの最後までポインタを移動後、先頭に戻っていたために費やしていた時間を大幅に節約することができる。   In the second embodiment, since the current positional relationship of the pointers in the SOAP data SD can be grasped by the node configuration management data 400, conventionally, when there is a pointer in the middle of the SOAP data SD, it is necessary to reach the element above it. Can save a great deal of time spent because the pointer has moved back to the beginning after moving the pointer to the end of the SOAP data SD.

以上、XML構文解析システムの実施形態を説明したが、こうした実施の形態に何ら限定されるものではなく、趣旨を逸脱しない範囲内において様々な形態で実施し得ることができる。以下、変形例を挙げて説明する。   As mentioned above, although the embodiment of the XML parsing system has been described, it is not limited to such an embodiment, and can be implemented in various forms without departing from the spirit of the system. Hereinafter, a modification will be described.

(変形例1)電子機器の変形例1について説明する。前記第1実施形態では、電子機器としてネットワークプリンタ100の場合について説明したが、他に、ネットワークスキャナ、ネットワークプロジェクタ、ファックス、ネットワークストレージ、などのネットワーク機器に利用することができる。   (Modification 1) Modification 1 of the electronic apparatus will be described. In the first embodiment, the case of the network printer 100 as an electronic device has been described, but it can also be used for network devices such as a network scanner, a network projector, a fax machine, and a network storage.

第1実施形態に係るXML構文解析システムの構成を示すブロック図。The block diagram which shows the structure of the XML syntax analysis system which concerns on 1st Embodiment. SOAPデータの構成の概略を示すリスト。The list which shows the outline of a structure of SOAP data. XML構文解析システムの動作を示すフローチャート。The flowchart which shows operation | movement of an XML parsing system. SOAPデータのノード構成管理データを示すブロック図。The block diagram which shows the node structure management data of SOAP data.

符号の説明Explanation of symbols

10…内部バス、20…CPU、30…ROM、40…RAM、50…プリントエンジン、60…XML構文解析システム、61…上位アプリケーション、62…SOAPパーサ、63…イベント駆動パーサ、100…ネットワークプリンタ、200…クライアントPC、300…LAN。   DESCRIPTION OF SYMBOLS 10 ... Internal bus, 20 ... CPU, 30 ... ROM, 40 ... RAM, 50 ... Print engine, 60 ... XML parsing system, 61 ... Upper level application, 62 ... SOAP parser, 63 ... Event drive parser, 100 ... Network printer, 200: Client PC, 300: LAN.

Claims (7)

上位アプリケーションと、
要素解析部と、
逐次情報取得部と、
を含み、
前記上位アプリケーションは、外部から入力されたXMLデータの解析指示を前記要素解析部に送信し、前記要素解析部から前記解析指示に対する解析結果を受信し、前記解析結果に基づいて所定の処理を行い、
前記要素解析部は、前記上位アプリケーションから前記解析指示を受信して前記逐次情報取得部に解析を指示し、前記上位アプリケーションからの前記解析指示に対する前記解析結果を得るまで解析の指示を繰り返し、
前記逐次情報取得部は、前記要素解析部からの前記解析指示を受信して前記XMLデータを解析し、前記解析結果を前記要素解析部に送信する、
ことを特徴とするXML構文解析システム。
A host application,
An element analysis unit;
A sequential information acquisition unit;
Including
The host application transmits an analysis instruction for XML data input from the outside to the element analysis unit, receives an analysis result for the analysis instruction from the element analysis unit, and performs predetermined processing based on the analysis result ,
The element analysis unit receives the analysis instruction from the upper application and instructs the sequential information acquisition unit to perform analysis, and repeats the analysis instruction until obtaining the analysis result for the analysis instruction from the upper application,
The sequential information acquisition unit receives the analysis instruction from the element analysis unit, analyzes the XML data, and transmits the analysis result to the element analysis unit.
An XML parsing system characterized by that.
請求項1に記載のXML構文解析システムにおいて、
前記XML構文解析システムは、前記上位アプリケーションの前記解析結果に基づき前記XMLデータを構成する要素同士の階層構造を記録した階層構造データを生成し、
前記要素解析部は、前記逐次情報取得部へ送信した前記要素が前記上位アプリケーションから要求された要素より前方にあるかどうか前記階層構造データに基づいて判断し、前方にあると判断した場合には、前記逐次情報取得部に対して前記XMLデータの先頭から処理をする指示を送る、
ことを特徴とするXML構文解析システム。
The XML parsing system according to claim 1,
The XML parsing system generates hierarchical structure data in which a hierarchical structure of elements constituting the XML data is recorded based on the analysis result of the upper application,
The element analysis unit determines whether the element transmitted to the sequential information acquisition unit is ahead of the element requested from the higher-order application based on the hierarchical structure data, and when determining that the element is ahead , To send an instruction to process from the beginning of the XML data to the sequential information acquisition unit,
An XML parsing system characterized by that.
上位アプリケーション工程と、
要素解析工程と、
逐次情報取得工程と、
を含み、
前記上位アプリケーション工程は、外部から入力されたXMLデータの解析指示を前記要素解析工程に送り、前記要素解析工程から前記解析指示に対する解析結果を受け取り、前記解析結果に基づいて所定の処理を行い、
前記要素解析工程は、前記上位アプリケーション工程から前記解析指示を受け取って前記逐次情報取得工程に解析を指示し、前記上位アプリケーション工程からの前記解析指示に対する前記解析結果を得るまで解析の指示を繰り返し、
前記逐次情報取得工程は、前記要素解析工程からの前記解析指示を受信して前記XMLデータを解析し、前記解析結果を前記要素解析工程に送る、
ことを特徴とするXML構文解析方法。
Upper application process,
Element analysis process;
Sequential information acquisition process;
Including
The upper application process sends an analysis instruction for XML data input from the outside to the element analysis process, receives an analysis result for the analysis instruction from the element analysis process, performs a predetermined process based on the analysis result,
The element analysis step receives the analysis instruction from the upper application step, instructs the sequential information acquisition step to analyze, and repeats the analysis instruction until obtaining the analysis result for the analysis instruction from the upper application step,
The sequential information acquisition step receives the analysis instruction from the element analysis step, analyzes the XML data, and sends the analysis result to the element analysis step.
An XML parsing method characterized by the above.
上位アプリケーションステップと、
要素解析ステップと、
逐次情報取得ステップと、
を含み、
前記上位アプリケーションステップは、外部から入力されたXMLデータの解析指示を前記要素解析ステップに送り、前記要素解析ステップから前記解析指示に対する解析結果を受け取り、前記解析結果に基づいて所定の処理を行い、
前記要素解析ステップは、前記上位アプリケーションステップから前記解析指示を受け取って前記逐次情報取得ステップに解析を指示し、前記上位アプリケーションステップからの前記解析指示に対する前記解析結果を得るまで解析の指示を繰り返し、
前記逐次情報取得ステップは、前記要素解析ステップからの前記解析指示を受信して前記XMLデータを解析し、前記解析結果を前記要素解析ステップに送る、
ことを特徴とするXML構文解析プログラム。
Upper application steps;
An element analysis step;
Sequential information acquisition step;
Including
The upper application step sends an analysis instruction for XML data input from the outside to the element analysis step, receives an analysis result for the analysis instruction from the element analysis step, performs a predetermined process based on the analysis result,
The element analysis step receives the analysis instruction from the upper application step, instructs the sequential information acquisition step to analyze, and repeats the analysis instruction until obtaining the analysis result for the analysis instruction from the upper application step,
The sequential information acquisition step receives the analysis instruction from the element analysis step, analyzes the XML data, and sends the analysis result to the element analysis step.
An XML parsing program characterized by that.
請求項1または2に記載のXML構文解析システムまたは請求項4に記載のXML構文解析プログラムを含むことを特徴とする電子機器。   An electronic apparatus comprising the XML parsing system according to claim 1 or 2 or the XML parsing program according to claim 4. 請求項5に記載の電子機器を複数含み構成されていることを特徴とするWebサービス。   A Web service comprising a plurality of electronic devices according to claim 5. 請求項6に記載のWebサービスにおいて、前記Webサービスは、前記XMLデータをベースとしたSOAPにより情報交換を行うことを特徴とするWebサービス。   7. The web service according to claim 6, wherein the web service exchanges information by SOAP based on the XML data.
JP2007259489A 2007-10-03 2007-10-03 System, method and program for xml parsing, electronic device, and web service Withdrawn JP2009087285A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007259489A JP2009087285A (en) 2007-10-03 2007-10-03 System, method and program for xml parsing, electronic device, and web service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007259489A JP2009087285A (en) 2007-10-03 2007-10-03 System, method and program for xml parsing, electronic device, and web service

Publications (1)

Publication Number Publication Date
JP2009087285A true JP2009087285A (en) 2009-04-23

Family

ID=40660587

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007259489A Withdrawn JP2009087285A (en) 2007-10-03 2007-10-03 System, method and program for xml parsing, electronic device, and web service

Country Status (1)

Country Link
JP (1) JP2009087285A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010016526A1 (en) 2008-08-05 2010-02-11 東レ株式会社 Pharmaceutical composition for treatment and prevention of cancer

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010016526A1 (en) 2008-08-05 2010-02-11 東レ株式会社 Pharmaceutical composition for treatment and prevention of cancer

Similar Documents

Publication Publication Date Title
JP4398448B2 (en) Method for processing print instructions in a server-based network and corresponding server-based network
JP5678507B2 (en) Printing apparatus, processing method, and computer program
JP4668067B2 (en) Printing apparatus, printing method, program for printing apparatus, printing instruction apparatus, and memory release control method
JP5159071B2 (en) COMMUNICATION SYSTEM, COMMUNICATION DEVICE, AND ITS CONTROL METHOD
JP2006072978A (en) Service request device, service providing device, service request method, service providing method, service request program, service providing program, and recording medium
JP4045799B2 (en) Printing system
JP5444652B2 (en) Network device, processing method, and computer program
US7822864B2 (en) Communication apparatus, program product for adding communication mechanism to communication apparatus for providing improved usability and communication efficiency, and recording medium storing program product
WO2001082051A2 (en) Broadcast printing system and method
JP5134456B2 (en) Service flow processing apparatus and service flow processing method
JP2021096869A (en) Information processing device, program, and method
JP2001043163A (en) Method, device, medium, and network scanner for controlling execution of remote application on network
JP2009255390A (en) Image forming apparatus, functional cooperation control method, and functional cooperation control program
US7812983B2 (en) Methods and systems for transferring binary data
JP2005322222A (en) Communication function adding method, program, storage medium and communication apparatus
JP2009087285A (en) System, method and program for xml parsing, electronic device, and web service
JP4839796B2 (en) Communication processing in network devices
JP5014095B2 (en) Compound machine
JP2000059561A (en) Scanner controller, scanner control system and control method
EP1821193A2 (en) Adaptive configuration of imaging devices
US8860981B2 (en) Systems and methods for print job scheduling
JP5272400B2 (en) Method, apparatus and computer program for dynamically adding a new service to an apparatus
JP3740179B2 (en) Image display control apparatus and method, and image display control system
JP3897083B2 (en) Print processing apparatus and print processing method
JP2006168063A (en) Image forming apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100901

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121023

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20121112