[openi18n-im:01308] PROPOSAL: New XML configuration format (was: Re: Re: XML configuration)

Akira TAGOH <[email protected]> Tue, 29 Mar 2005 10:57:11 +0900 (JST)
Newsgroups gmane.comp.internationalization.input-methods
Organization Red Hat, Inc.
Message-ID <[email protected]>
Hi,

I apologize for so long discussion to change the XML
configuration format and not updating the proposal sooner.

I've updated the proposal which was based on Miyashita-san
wrote.

Major updated stuff are:
- All elements are now a lower case with capital initial.
  in the previous discussion, we agreed with using the
  uppercase for IIIMF toplevel node. so lower case with
  capital initial would makes sense.

- Added FunctionGroup element and Function element.
  I assume that it's to change the hotkey like LE SWTICH etc
  ATM. it can be used when iiimd will supports any modulable
  stuff to add the facilities in the future.

- Removed default and DefaultLanguageEngine elements in
  LanguageEngineGroup.
  The default language engine people wants should be per
  languages. for example, even if people prefers en_US
  locale and no en LEs are available, the LEs for different
  language shouldn't be chosen. i.e. we won't need any
  special element out of LanguageEngine element IMO.

- Added default attribute to LanguageEngine instead.
  It allows to make a default LE for each languages then. if
  LanguageEngine doesn't have a default attribute, I assume
  that the server will lookup the LE in the registered
  order.

Any comments?

Thanks,
--
Akira TAGOH


>>>>> On Thu, 07 Oct 2004 12:21:06 +0900,
>>>>> "MH" == MIYASHITA Hisashi (宮下 尚:HIMI) <[email protected]> wrote:

MH> At Wed, 06 Oct 2004 22:44:30 +0900 (JST),
MH> Akira TAGOH wrote:

>> >>>>> On Wed, 06 Oct 2004 20:43:13 +0900,
>> >>>>> "MH" == MIYASHITA Hisashi (宮下 尚:HIMI) <[email protected]> wrote:
>> 
MH> I think your idea resembles to that of so-called "Gentry".  That is, all data
MH> in XML documents should be assigned to types and exclude other format.  I think
MH> this idea lacks the flexibility and power of XML.
>> 
>> Hm, that sounds like the same with my thoughts. though I
>> don't want to exclude such thing strongly, at least
>> describing hostname:port may confuses people when htt_server
>> will supports IPv6 say - ah, yes, I didn't consider about it
>> when I made this change :p I just remember this now, but
>> anyway.

MH> The converse is true, isn't it?  That is, decomposing all the component in IPv6
MH> into XML expression will be confusing, I think.  Anyway, it would not not a big problem
MH> here.

MH> For now, I don't see any clear reason why we have to define other XML namespace
MH> for user configurations than that for server configurations.  If we have to
MH> independently update the document type for user and server configuration, certainly
MH> we should define XML namespaces for each of them.  Do you think it's really necessary?
MH> Is that going a little too far?
>> >> 
>> >> how about moving out the LE-specific configuration into the
>> >> XML configuration file, say?
>> 
MH> Of course, it's an option.
>> 
>> er, so in that case, you think those should also have the
>> same namespace, right?

MH> Well, I think it is a sort of trivial choice.  IMO, if we manage all
MH> vocabularies for those,  we don't have to separate namespaces.
MH> But I won't stick to it.

MH> Hmmm...  I see the requirement.  But, still I don't think sorting all the configuration
MH> out by languages is the best solution.  Although the ID constraint of XML can be
MH> a solution for it, it usually seems to be complicated.  I've not come up with the
MH> better answer.
>> 
MH> Anyway, I can agree with you on this point.  If you don't mind, could you please
MH> update your proposal by using a proper schema definition?
>> 
>> Sure. probably updating the proposal will needs some times
>> because my mind seems confusion for the long
>> discussion. I'll reread these and send it again here.

MH> Thanks.  At this stage, we don't need a strict schema.
MH> It's for clarifying what is required and what should not be allowed.
MH> We should not waste our time to improve the detail of the schema.
MH> Let's continue to discuss on this topic, which will be based on
MH> the updated proposal.

MH>   With regards,

MH> from himi
iiimd.xml.conf.xsd (text/plain, 5.7 KB)
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.OpenI18N.org/IIIMF/NS/1.0" xmlns:iiimf="http://www.OpenI18N.org/IIIMF/NS/1.0">
  <xsd:element name="IIIMF">
    <xsd:complexType>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element ref="iiimf:Server"/>
        <xsd:element ref="iiimf:LanguageEngineGroup"/>
      </xsd:choice>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Server">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" ref="iiimf:ListenGroup"/>
        <xsd:element minOccurs="0" ref="iiimf:ACLGroup"/>
        <xsd:element minOccurs="0" ref="iiimf:Auth"/>
        <xsd:element minOccurs="0" ref="iiimf:FunctionGroup"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="ListenGroup">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element maxOccurs="unbounded" ref="iiimf:Listen"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Hostname" type="xsd:string" default="localhost"/>
  <xsd:element name="Listen">
    <xsd:complexType>
      <xsd:choice minOccurs="1">
        <xsd:sequence>
          <xsd:element minOccurs="1" ref="Hostname"/>
          <xsd:element minOccurs="1" name="Port" default="9010"/>
        </xsd:sequence>
        <xsd:element name="File" default="/var/run/iiim"/>
      </xsd:choice>
    </xsd:complexType>
    <xsd:complexType mixed="true">
      <xsd:attribute name="type" use="required">
        <xsd:simpleType>
          <xsd:restriction base="xsd:NMTOKEN">
            <xsd:enumeration value="tcp"/>
            <xsd:enumeration value="unix"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="ACLGroup">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="iiimf:ACL"/>
      </xsd:sequence>
      <xsd:attribute name="default" use="required" type="iiimf:PermissionType"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="ACL">
    <xsd:element minOccurs="1" ref="Hostname"/>
    <xsd:complexType mixed="true">
      <xsd:attribute name="type" use="required" type="iiimf:PermissionType"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:simpleType name="AuthType">
    <xsd:restriction base="xsd:NMTOKEN">
      <xsd:enumeration value="permit"/>
      <xsd:enumeration value="password"/>
      <xsd:enumeration value="deny"/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:element name="Auth">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" ref="iiimf:System"/>
        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="iiimf:User"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="System">
    <xsd:complexType>
      <xsd:attribute name="type" use="required" type="iiimf:AuthType"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="User">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" ref="iiimf:Password"/>
      </xsd:sequence>
      <xsd:attribute name="type" use="required" type="iiimf:AuthType"/>
      <xsd:attribute name="name" use="required"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Password" type="xsd:string"/>
  <xsd:element name="FunctionGroup">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="iiimf:Function"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Function">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="iiimf:Option"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:simpleType name="LanguageEngineNameDef">
    <xsd:restriction base="xsd:ID"/>
  </xsd:simpleType>
  <xsd:element name="LanguageEngineGroup">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="iiimf:LanguageEngine"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="LanguageEngine">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="iiimf:Implementation"/>
        <xsd:element ref="iiimf:Option"/>
      </xsd:sequence>
      <xsd:attribute name="default" type="iiimf:LanguageEngineNameDef"/>
      <xsd:attribute name="lang" use="required" type="xsd:language"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Implementation">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="iiimf:Module"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Module">
    <xsd:complexType>
      <xsd:attribute name="path" use="required"/>
      <xsd:attribute name="name" use="required" type="iiimf:LanguageEngineNameDef"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Option" type="iiimf:HotKey"/>
  <xsd:complexType name="HotKey">
    <xsd:sequence>
      <xsd:element ref="iiimf:Hotkey"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="Hotkey">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element maxOccurs="unbounded" ref="iiimf:Key"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Key">
    <xsd:complexType>
      <xsd:attribute name="modifier" type="iiimf:KeyModifier"/>
      <xsd:attribute name="name" use="required"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:simpleType name="KeyModifier">
    <xsd:restriction base="xsd:NMTOKEN">
      <xsd:enumeration value="Shift"/>
      <xsd:enumeration value="Control"/>
      <xsd:enumeration value="Alt"/>
      <xsd:enumeration value="Meta"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>
iiimd.xml.conf (text/plain, 1.6 KB)
<?xml version="1.0" encoding="UTF-8"?>
<IIIMF xmlns="http://www.OpenI18N.org/IIIMF/NS/1.0">
  <Server>
    <ListenGroup>
      <Listen type="tcp">
        <Hostname>localhost</Hostname>
        <Port>9010</Port>
      </Listen>
      <Listen type="unix">
        <File>/var/run/iiim</File>
      </Listen>
    </ListenGroup>
    <ACLGroup default="deny">
      <ACL type="allow">
        <Hostname>127.0.0.1</Hostname>
      </ACL>
    </ACLGroup>
    <Auth>
      <System type="password"/>
      <User type="password" name="foo">
        <Password>encrypted string</Password>
      </User>
      <User type="permit" name="root"/>
    </Auth>
    <FunctionGroup>
      <Function name="LE SWITCH">
        <Hotkey>
          <Key modifier="Control Shift" name="space"/>
        </Hotkey>
      </Function>
    </FunctionGroup>
  </Server>
  <LanguageEngineGroup>
    <LanguageEngine default="Canna LE" lang="ja">
      <Implementation>
        <Module path="/usr/lib/iiim/le/FreeWnnLE/FreeWnnLE.so" name="FreeWnn LE"/>
        <Module path="/usr/lib/iiim/le/CannaLE/CannaLE.so" name="Canna LE"/>
      </Implementation>
      <Hotkey>
        <Key modifier="Shift" name="space"/>
        <Key name="Kanji"/>
        <Key modifier="Alt" name="Kanji"/>
      </Hotkey>
    </LanguageEngine>
    <LanguageEngine lang="en">
      <Implementation>
        <Module path="/usr/lib/iiim/le/default/default.so" name="default"/>
        <Module path="/usr/lib/iiim/le/unitle/unitle.so" name="UNIT"/>
      </Implementation>
      <Hotkey>
        <Key modifier="Alt" name="`"/>
      </Hotkey>
    </LanguageEngine>
  </LanguageEngineGroup>
</IIIMF>