The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="raptor-section-feature">
<refmeta>
<refentrytitle role="top_of_page">Features</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>RAPTOR Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Features</refname>
<refpurpose>Parser and Serializer features</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>



enum        <link linkend="raptor-feature">raptor_feature</link>;
unsigned <link linkend="int">int</link> <link linkend="raptor-get-feature-count">raptor_get_feature_count</link>       (void);
<link linkend="int">int</link>         <link linkend="raptor-features-enumerate">raptor_features_enumerate</link>       (const <link linkend="raptor-feature">raptor_feature</link> feature,
                                             const <link linkend="char">char</link> **name,
                                             <link linkend="raptor-uri">raptor_uri</link> **uri,
                                             const <link linkend="char">char</link> **label);
<link linkend="raptor-feature">raptor_feature</link> <link linkend="raptor-feature-from-uri">raptor_feature_from_uri</link>      (<link linkend="raptor-uri">raptor_uri</link> *uri);
<link linkend="int">int</link>         <link linkend="raptor-feature-value-type">raptor_feature_value_type</link>       (const <link linkend="raptor-feature">raptor_feature</link> feature);
</synopsis>
</refsynopsisdiv>









<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
Optional parameters for <link linkend="raptor-parser"><type>raptor_parser</type></link> and <link linkend="raptor-serializer"><type>raptor_serializer</type></link>
objects that can be get and set.  Utility functions also exist
to enumerate them, their description and the parameter type
taken.
</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="raptor-feature" role="enum"/>enum raptor_feature</title>
<indexterm><primary>raptor_feature</primary></indexterm><programlisting>typedef enum {
  RAPTOR_FEATURE_SCANNING,
  RAPTOR_FEATURE_ASSUME_IS_RDF,
  RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES,
  RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES,
  RAPTOR_FEATURE_ALLOW_BAGID,
  RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST,
  RAPTOR_FEATURE_NORMALIZE_LANGUAGE,
  RAPTOR_FEATURE_NON_NFC_FATAL,
  RAPTOR_FEATURE_WARN_OTHER_PARSETYPES,
  RAPTOR_FEATURE_CHECK_RDF_ID,
  RAPTOR_FEATURE_RELATIVE_URIS,
  RAPTOR_FEATURE_START_URI,
  RAPTOR_FEATURE_WRITER_AUTO_INDENT,
  RAPTOR_FEATURE_WRITER_AUTO_EMPTY,
  RAPTOR_FEATURE_WRITER_INDENT_WIDTH,
  RAPTOR_FEATURE_WRITER_XML_VERSION,
  RAPTOR_FEATURE_WRITER_XML_DECLARATION,
  RAPTOR_FEATURE_NO_NET,
  RAPTOR_FEATURE_LAST=RAPTOR_FEATURE_NO_NET
} raptor_feature;
</programlisting>
<para>
Raptor parser, serializer or XML writer features.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-SCANNING:CAPS" role="constant"/><literal>RAPTOR_FEATURE_SCANNING</literal></term>
<listitem><simpara> If true (default false), the RDF/XML
  parser will look for embedded rdf:RDF elements inside the XML
  content, and not require that the XML start with an rdf:RDF root
  element.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-ASSUME-IS-RDF:CAPS" role="constant"/><literal>RAPTOR_FEATURE_ASSUME_IS_RDF</literal></term>
<listitem><simpara> If true (default false) then the
  RDF/XML parser will assume the content is RDF/XML, not require
  that rdf:RDF root element, and immediately interpret the content
  as RDF/XML.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-ALLOW-NON-NS-ATTRIBUTES:CAPS" role="constant"/><literal>RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES</literal></term>
<listitem><simpara> If true (default true)
  then the RDF/XML parser will allow non-XML namespaced attributes
  to be accepted as well as rdf: namespaced ones.  For example,
  'about' and 'ID' will be interpreted as if they were rdf:about
  and rdf:ID respectively.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-ALLOW-OTHER-PARSETYPES:CAPS" role="constant"/><literal>RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES</literal></term>
<listitem><simpara> If true (default true)
  then the RDF/XML parser will allow unknown parsetypes to be
  present and will pass them on to the user.  Unimplemented at
  present.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-ALLOW-BAGID:CAPS" role="constant"/><literal>RAPTOR_FEATURE_ALLOW_BAGID</literal></term>
<listitem><simpara> If true (default true) then the
  RDF/XML parser will support the rdf:bagID attribute that was
  removed from the RDF/XML language when it was revised.  This
  support may be removed in future.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-ALLOW-RDF-TYPE-RDF-LIST:CAPS" role="constant"/><literal>RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST</literal></term>
<listitem><simpara> If true (default false)
  then the RDF/XML parser will generate the idList rdf:type
  rdf:List triple in the handling of rdf:parseType="Collection".
  This triple was removed during the revising of RDF/XML after
  collections were initially added.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-NORMALIZE-LANGUAGE:CAPS" role="constant"/><literal>RAPTOR_FEATURE_NORMALIZE_LANGUAGE</literal></term>
<listitem><simpara> If true (default true) then
  XML language values such as from xml:lang will be normalized to
  lowercase.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-NON-NFC-FATAL:CAPS" role="constant"/><literal>RAPTOR_FEATURE_NON_NFC_FATAL</literal></term>
<listitem><simpara> If true (default false) then
 illegal Unicode Normal Form C in literals will give a fatal
 error, otherwise just a warning.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-WARN-OTHER-PARSETYPES:CAPS" role="constant"/><literal>RAPTOR_FEATURE_WARN_OTHER_PARSETYPES</literal></term>
<listitem><simpara> If true (default true) then 
  the RDF/XML parser will warn about unknown rdf:parseType values.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-CHECK-RDF-ID:CAPS" role="constant"/><literal>RAPTOR_FEATURE_CHECK_RDF_ID</literal></term>
<listitem><simpara> If true (default true) then the
  RDF/XML will check rdf:ID attribute values for duplicates and
  cause an error if any are found.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-RELATIVE-URIS:CAPS" role="constant"/><literal>RAPTOR_FEATURE_RELATIVE_URIS</literal></term>
<listitem><simpara> If true (default true) then
  relative URIs will be used wherever possible when serializing.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-START-URI:CAPS" role="constant"/><literal>RAPTOR_FEATURE_START_URI</literal></term>
<listitem><simpara> Set the start URI for serlalizing to use.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-WRITER-AUTO-INDENT:CAPS" role="constant"/><literal>RAPTOR_FEATURE_WRITER_AUTO_INDENT</literal></term>
<listitem><simpara> Automatically indent elements when
  seriailizing.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-WRITER-AUTO-EMPTY:CAPS" role="constant"/><literal>RAPTOR_FEATURE_WRITER_AUTO_EMPTY</literal></term>
<listitem><simpara> Automatically detect and
  abbreviate empty elements when serializing.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-WRITER-INDENT-WIDTH:CAPS" role="constant"/><literal>RAPTOR_FEATURE_WRITER_INDENT_WIDTH</literal></term>
<listitem><simpara> Integer number of spaces to use
  for each indent level when serializing with auto indent.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-WRITER-XML-VERSION:CAPS" role="constant"/><literal>RAPTOR_FEATURE_WRITER_XML_VERSION</literal></term>
<listitem><simpara> Integer XML version XML 1.0 (10) or XML 1.1 (11)
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-WRITER-XML-DECLARATION:CAPS" role="constant"/><literal>RAPTOR_FEATURE_WRITER_XML_DECLARATION</literal></term>
<listitem><simpara> Write XML 1.0 or 1.1 declaration.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-NO-NET:CAPS" role="constant"/><literal>RAPTOR_FEATURE_NO_NET</literal></term>
<listitem><simpara> Deny network requests
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="RAPTOR-FEATURE-LAST:CAPS" role="constant"/><literal>RAPTOR_FEATURE_LAST</literal></term>
<listitem><simpara> Internal
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="raptor-get-feature-count" role="function"/>raptor_get_feature_count ()</title>
<indexterm><primary>raptor_get_feature_count</primary></indexterm><programlisting>unsigned <link linkend="int">int</link> raptor_get_feature_count       (void);</programlisting>
<para>
Get the count of features defined.
</para>
<para>
This is prefered to the compile time-only symbol <link linkend="RAPTOR-FEATURE-LAST:CAPS"><type>RAPTOR_FEATURE_LAST</type></link>
and returns a count of the number of features which is
<link linkend="RAPTOR-FEATURE-LAST:CAPS"><type>RAPTOR_FEATURE_LAST</type></link>+1.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> count of features in the <link linkend="raptor-feature"><type>raptor_feature</type></link> enumeration
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="raptor-features-enumerate" role="function"/>raptor_features_enumerate ()</title>
<indexterm><primary>raptor_features_enumerate</primary></indexterm><programlisting><link linkend="int">int</link>         raptor_features_enumerate       (const <link linkend="raptor-feature">raptor_feature</link> feature,
                                             const <link linkend="char">char</link> **name,
                                             <link linkend="raptor-uri">raptor_uri</link> **uri,
                                             const <link linkend="char">char</link> **label);</programlisting>
<para>
Get list of syntax features.
</para>
<para>
If uri is not NULL, a pointer toa new raptor_uri is returned
that must be freed by the caller with <link linkend="raptor-free-uri"><function>raptor_free_uri()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>feature</parameter>&nbsp;:</term>
<listitem><simpara> feature enumeration (0+)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store feature short name (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> pointer to store feature URI (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>label</parameter>&nbsp;:</term>
<listitem><simpara> pointer to feature label (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> 0 on success, &lt;0 on failure, &gt;0 if feature is unknown
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="raptor-feature-from-uri" role="function"/>raptor_feature_from_uri ()</title>
<indexterm><primary>raptor_feature_from_uri</primary></indexterm><programlisting><link linkend="raptor-feature">raptor_feature</link> raptor_feature_from_uri      (<link linkend="raptor-uri">raptor_uri</link> *uri);</programlisting>
<para>
Turn a feature URI into an feature enum.
</para>
<para>
The allowed feature URIs are available via <link linkend="raptor-features-enumerate"><function>raptor_features_enumerate()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> feature URI
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> &lt; 0 if the feature is unknown
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="raptor-feature-value-type" role="function"/>raptor_feature_value_type ()</title>
<indexterm><primary>raptor_feature_value_type</primary></indexterm><programlisting><link linkend="int">int</link>         raptor_feature_value_type       (const <link linkend="raptor-feature">raptor_feature</link> feature);</programlisting>
<para>
Get the type of a features.
</para>
<para>
The type of the <parameter>feature</parameter> is 0=integer , 1=string.  Other values are
undefined.  Most features are integer values and use
raptor_set_feature and <link linkend="raptor-get-feature"><function>raptor_get_feature()</function></link>
( raptor_serializer_set_feature <link linkend="raptor-serializer-get-feature"><function>raptor_serializer_get_feature()</function></link> )
</para>
<para>
String value features use <link linkend="raptor-parser-set-feature-string"><function>raptor_parser_set_feature_string()</function></link> and
<link linkend="raptor-parser-get-feature-string"><function>raptor_parser_get_feature_string()</function></link>
( <link linkend="raptor-serializer-set-feature-string"><function>raptor_serializer_set_feature_string()</function></link>
and <link linkend="raptor-serializer-get-feature-string"><function>raptor_serializer_get_feature_string()</function></link> )</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>feature</parameter>&nbsp;:</term>
<listitem><simpara> raptor serializer or parser feature
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the type of the feature or &lt;0 if <parameter>feature</parameter> is unknown
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>