LinguisticDefinition::XmlLingDefFormatter Class Reference

Interprets an XML document, and creates a LingDef object accordingly. More...

#include <XmlLingDefFormatter.h>

Inheritance diagram for LinguisticDefinition::XmlLingDefFormatter:

LinguisticDefinition::LingDefFormatter LinguisticDefinition::Formatter List of all members.

Public Member Functions

 XmlLingDefFormatter ()
LingDef createLingDef (const std::string &xmlData, const std::string &isoLanguageCode="")
 Creates a LingDef object for an XML document.
LingDef createLingDef (xmlDocPtr doc, const std::string &isoLanguageCode="")
 Creates a LingDef object for an XML document.
bool populateLingDef (const std::string &xmlData, LingDef &lingDef)
 A quick access function, to avoid copying the result object.
bool populateLingDef (xmlDocPtr doc, LingDef &lingDef)
 A quick access function, to avoid copying the result object.
std::string output (const LingDef &) const
void output (const LingDef &, std::ostream &) const

Detailed Description

Interprets an XML document, and creates a LingDef object accordingly.

An example XML:


  <LingDef xml:lang="ar">

   <Pos id="base" type="virtual">
    <Misc>
     <Enum name="langlevel">
      <Value name="z0"/>
      <Value name="z1"/>
      <Value name="z2"/>
     </Enum>
     <Boolean name="void_translation"/>
    </Misc>
   </Pos>

   <Pos id="noun" inherits="base" type="element">
    <Name short="N">NOUN</Name>
     <Morphology>
      <Enum name="gender" allowNone="false" allowSeveral="true">
       <Value name="masc" short="m" default="true"/>
       <Value name="fem" short="f"/>
      </Enum>

      <Enum name="number">
       <Value name="sing" short="s" default="true"/>
       <Value name="plur" short="p"/>
      </Enum>
     </Morphology>
   </Pos>

  </LingDef>
 

For each node, it is possible to set the property xml:lang, which allows deactivation of that node and its children if the language does not match. The property can be either positive or negative: 'ar' would cause the node to be used only for Arabic, '!ar' all languages but Arabic, 'ar,fa,ur' Arabic, Farsi and Urdu, '!ar,!fa,!ur' all but Arabic Farsi and Urdu.

Definition at line 60 of file XmlLingDefFormatter.h.


Constructor & Destructor Documentation

XmlLingDefFormatter::XmlLingDefFormatter (  ) 

Definition at line 9 of file XmlLingDefFormatter.cc.


Member Function Documentation

LingDef LinguisticDefinition::XmlLingDefFormatter::createLingDef ( xmlDocPtr  doc,
const std::string &  isoLanguageCode = "" 
)

Creates a LingDef object for an XML document.

Parameters:
doc The XML document, as a constructed xmlDoc
isoLanguageCode The ISO language code for the language to use

LingDef LinguisticDefinition::XmlLingDefFormatter::createLingDef ( const std::string &  xmlData,
const std::string &  isoLanguageCode = "" 
)

Creates a LingDef object for an XML document.

Parameters:
xmlData The XML document, as a string
isoLanguageCode The ISO language code for the language to use

Referenced by main().

void LinguisticDefinition::XmlLingDefFormatter::output ( const LingDef ,
std::ostream &   
) const [virtual]

Implements LinguisticDefinition::LingDefFormatter.

string XmlLingDefFormatter::output ( const LingDef  )  const [virtual]

Implements LinguisticDefinition::LingDefFormatter.

Definition at line 659 of file XmlLingDefFormatter.cc.

bool XmlLingDefFormatter::populateLingDef ( xmlDocPtr  doc,
LingDef lingDef 
)

A quick access function, to avoid copying the result object.

Parameters:
doc The XML document, as a constructed xmlDoc
lingDef A pre-constructed LingDef object, which will be populated
Returns:
Whether or not the document was correct

Definition at line 53 of file XmlLingDefFormatter.cc.

bool LinguisticDefinition::XmlLingDefFormatter::populateLingDef ( const std::string &  xmlData,
LingDef lingDef 
)

A quick access function, to avoid copying the result object.

Parameters:
xmlData The XML document, as a string
lingDef A pre-constructed LingDef object, which will be populated
Returns:
Whether or not the document was correct


The documentation for this class was generated from the following files:
Generated on Fri Jun 23 14:03:16 2006 for LinguisticDefinition by  doxygen 1.4.7