![]() |
赤紫蘇2. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
忍坂2(α) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| akaxiso2.0-beta1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
忍坂2は、XML-Schemaドキュメントから、シリアライザブルなクラスを生成するためのスキーマコンパイラです。 コマンドライン osixaka2 [-p] [-d] [-o ディレクトリ名] [-D] [-L 設定ファイル名] [-S 設定ファイル名] <XML文書 ファイル> オプション
例として、忍坂2による、XML Schemaのためのスキーマ文書生成について説明します。 XMLSchemaは、以下の二つのスキーマ文書により定義されています。
これらのファイルは、オリジナルのスキーマです。
前処理を施したファイルは、akaxiso2/osixaka2以下にあります。このファイルを使用して、以下のコマンドを実行してください。 Windowsの場合(akaxiso2\binディレクトリにて) akaxiso2\bin> osixaka2 ..\osixaka2\XMLSchema.xsd Linuxの場合(akaxiso2/osixaka2ディレクトリにて) $ ./osixaka2 XMLSchema.xsd この操作により、element.h/xiso.h/xiso.cppの三つのファイルが生成されます。それぞれの内容を以下に示します。
以上のファイルをコンパイルし、赤紫蘇ライブラリとリンクすることで、XML Schemaドキュメントのシリアライズ、デシリアライズが可能となります。デシリアライズ、シリアライズするためのサンプルコードは、osixaka2/test_main.cpp(HTML版)をご参照ください。 設定ファイル 設定ファイルでは、以下の項目を設定可能です。設定ファイルは、XMLドキュメントです。
設定ファイルの作成と使用 -S、-Lオプションを用いて、設定ファイルの作成と使用を行います。 設定ファイルの作成 akaxiso2/osixaka2/osixaka1.xml ファイルは、旧忍坂と互換なファイルを生成するための設定ファイルです。 $ osixaka2 -L osixaka1.xml <XML Schemaドキュメントファイル名> とすることで、(旧)忍坂と互換なファイルを生成することができます。 以下、デフォルトで使用される設定ファイルを示します。 <?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>
<osx:preference xmlns:osx="http://akaxiso.sourceforge.jp/osixaka/preference">
<choice_container type="std::list"/>
<array_container type="std::list"/>
<member_format prefix="" postfix="_"/>
<array_format prefix="" postfix="_array"/>
<substitution original="class" substituted="_class"/>
<substitution original="public" substituted="_public"/>
<substitution original="protected" substituted="_protected"/>
<substitution original="private" substituted="_private"/>
<substitution original="union" substituted="_union"/>
<substitution original="enum" substituted="_enum"/>
<substitution original="namespace" substituted="_namespace"/>
<substitution original="using" substituted="_using"/>
<escape to_escape="-" escaped="_"/>
<namespace prefix="wsdl" uri="http://schemas.xmlsoap.org/wsdl/"/>
<nill_type>aka:nill</nill_type>
<cpp_builtins>
<type name="xs:byte">
<cpp>char</cpp>
<array>aka:char_array</array>
</type>
<type name="xs:unsignedByte">
<cpp>unsigned char</cpp>
<array>aka:uchar_array</array>
</type>
<type name="xs:short">
<cpp>short</cpp>
<array>aka:short_array</array>
</type>
<type name="xs:unsignedShort">
<cpp>short</cpp>
<array>aka:short_array</array>
</type>
<type name="xs:int">
<cpp>long</cpp>
<array>aka:long_array</array>
</type>
<type name="xs:unsignedInt">
<cpp>ULONGLONG</cpp>
<array>aka:longlong_array</array>
</type>
<type name="xs:long">
<cpp>LONGLONG</cpp>
<array>aka:longlong_array</array>
</type>
<type name="xs:unsignedLong">
<cpp>ULONGLONG</cpp>
<array>aka:ulonglong_array</array>
</type>
<type name="xs:integer">
<cpp>long</cpp>
<array>aka:long_array</array>
</type>
<type name="xs:boolean">
<cpp>bool</cpp>
<array>aka:bool_array</array>
</type>
<type name="xs:float">
<cpp>float</cpp>
<array>aka:float_array</array>
</type>
<type name="xs:double">
<cpp>double</cpp>
<array>aka:double_array</array>
</type>
<type name="xs:string">
<cpp>std:string</cpp>
<array>aka:string_array</array>
</type>
<type name="xs:anySimpleType">
<cpp>std:string</cpp>
<array>aka:string_array</array>
</type>
<type name="aka:nill">
<cpp>aka:nill</cpp>
<array>aka:nill_array</array>
</type>
</cpp_builtins>
<schema_builtins>
<type name="xs:normalizedString">
<cpp>std:string</cpp>
<array>xs:normalizedString_array</array>
</type>
<type name="xs:token">
<cpp>std:string</cpp>
<array>xs:token_array</array>
</type>
<type name="xs:base64Binary">
<cpp>std:string</cpp>
<array>xs:base64Binary_array</array>
</type>
<type name="xs:hexBinary">
<cpp>std:string</cpp>
<array>xs:hexBinary_array</array>
</type>
<type name="xs:positiveInteger">
<cpp>long</cpp>
<array>xs:positiveInteger_array</array>
</type>
<type name="xs:negativeInteger">
<cpp>long</cpp>
<array>xs:negativeInteger_array</array>
</type>
<type name="xs:nonNegativeInteger">
<cpp>long</cpp>
<array>xs:nonNegativeInteger_array</array>
</type>
<type name="xs:nonPositiveInteger">
<cpp>long</cpp>
<array>xs:nonPositiveInteger_array</array>
</type>
<type name="xs:decimal">
<cpp>long</cpp>
<array>xs:decimal_array</array>
</type>
<type name="xs:time">
<cpp>std:string</cpp>
<array>xs:time_array</array>
</type>
<type name="xs:dateTime">
<cpp>std:string</cpp>
<array>xs:dateTime_array</array>
</type>
<type name="xs:duration">
<cpp>std:string</cpp>
<array>xs:duration_array</array>
</type>
<type name="xs:date">
<cpp>std:string</cpp>
<array>xs:date_array</array>
</type>
<type name="xs:gMonth">
<cpp>std:string</cpp>
<array>xs:gMonth_array</array>
</type>
<type name="xs:gYear">
<cpp>std:string</cpp>
<array>xs:gYear_array</array>
</type>
<type name="xs:gYearMonth">
<cpp>std:string</cpp>
<array>xs:gYearMonth_array</array>
</type>
<type name="xs:gDay">
<cpp>std:string</cpp>
<array>xs:gDay_array</array>
</type>
<type name="xs:gMonthDay">
<cpp>std:string</cpp>
<array>xs:gMonthDay_array</array>
</type>
<type name="xs:Name">
<cpp>std:string</cpp>
<array>xs:Name</array>
</type>
<type name="xs:QName">
<cpp>aka:qname</cpp>
<leaf>xs:QNameLeaf</leaf>
<array>xs:QName_array</array>
</type>
<type name="xs:NCName">
<cpp>std:string</cpp>
<array>xs:NCName_array</array>
</type>
<type name="xs:anyURI">
<cpp>std:string</cpp>
<array>xs:anyURI_array</array>
</type>
<type name="xs:language">
<cpp>std:string</cpp>
<array>xs:language_array</array>
</type>
<type name="xs:ID">
<cpp>std:string</cpp>
<array>xs:ID_array</array>
</type>
<type name="xs:IDREF">
<cpp>std:string</cpp>
<array>xs:IDREF_array</array>
</type>
<type name="xs:IDREFS">
<cpp>std:string</cpp>
<array>xs:IDREFS_array</array>
</type>
<type name="xs:ENTITY">
<cpp>std:string</cpp>
<array>xs:ENTITY_array</array>
</type>
<type name="xs:ENTITIES">
<cpp>std:string</cpp>
<array>xs:ENTITIES_array</array>
</type>
<type name="xs:NOTATION">
<cpp>std:string</cpp>
<array>xs:NOTATION_array</array>
</type>
<type name="xs:NMTOKEN">
<cpp>std:string</cpp>
<array>xs:NMTOKEN_array</array>
</type>
<type name="xs:NMTOKENS">
<cpp>std:string</cpp>
<array>xs:NMTOKENS_array</array>
</type>
</schema_builtins>
</osx:preference>
仕様、制限、未実装部など
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ホームに戻る 赤紫蘇2プロジェクトページへ
