Oyranos Colour Management System API
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
oyranos_xml.c File Reference

xml handling More...

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "oyranos_config_internal.h"
#include "oyranos.h"
#include "oyranos_alpha.h"
#include "oyranos_debug.h"
#include "oyranos_elektra.h"
#include "oyranos_helper.h"
#include "oyranos_internal.h"
#include "oyranos_string.h"

Macros

#define OY_XFORMS_CSS   "\ <style type=\"text/css\"> \n\ @namespace xf url(\"http://www.w3.org/2002/xforms\");\n\ xf|label {\n\ font-family: Helvetica, Geneva, Lucida, sans-serif;\n\ width: 24ex;\n\ text-align: right;\n\ padding-right: 1em;\n\ }\n\ xf|select1 { display: table-row; }\n\ xf|select1 xf|label, xf|choices xf|label { display: table-cell; }\n\ </style>"
 default CSS More...
 

Functions

void oyWriteOptionToXML_ (oyGROUP_e group, oyWIDGET_e start, oyWIDGET_e end, char **text, uint32_t flags)
 
char * oyGetHtmlHeader (const char **options, oyAlloc_f allocate_func)
 write a HTML page header More...
 
void oyWriteOptionToHTML_ (oyGROUP_e group, oyWIDGET_e start, oyWIDGET_e end, char **text)
 write a option to HTML More...
 
char * oyDescriptionToHTML (int group, const char **options, oyAlloc_f allocateFunc)
 write a HTML description page More...
 
int oyXFORMsRenderUi (const char *xforms, oyUiHandler_s **ui_handlers, oyPointer user_data)
 render the UI by a selected toolkit More...
 
char * oyXFORMsFromModelAndUi (const char *data, const char *ui_text, const char **namespaces, const char *head_injection, oyAlloc_f allocate_func)
 join data and UI More...
 
int oyXMLNodeNameIs (xmlNodePtr cur, const char *node_name)
 string compare with a joined namespace and node name More...
 
const char * oyXFORMsModelGetAttrValue (xmlNodePtr cur, const char *attr_name)
 get the xml elements attribute value More...
 
const char * oyXFORMsModelGetXPathValue (xmlNodePtr cur, const char *attr_name, const char **xpath)
 get the xforms model value of a corresponding layout node More...
 
const char * oyXML2NodeValue (xmlNodePtr cur)
 get a node childs text value More...
 

Detailed Description

xml handling

Oyranos is an open source Colour Management System

Copyright:
2006-2012 (C) Kai-Uwe Behrmann

Macro Definition Documentation

#define OY_XFORMS_CSS   "\ <style type=\"text/css\"> \n\ @namespace xf url(\"http://www.w3.org/2002/xforms\");\n\ xf|label {\n\ font-family: Helvetica, Geneva, Lucida, sans-serif;\n\ width: 24ex;\n\ text-align: right;\n\ padding-right: 1em;\n\ }\n\ xf|select1 { display: table-row; }\n\ xf|select1 xf|label, xf|choices xf|label { display: table-cell; }\n\ </style>"

default CSS

The short stylesheet should cover the Oyranos subset of XFORMS elements.

Version
Oyranos: 0.1.10
Since
2009/10/04 (Oyranos: 0.1.10)
Date
2009/10/04

Referenced by oyXFORMsFromModelAndUi().

Function Documentation

char* oyDescriptionToHTML ( int  group,
const char **  options,
oyAlloc_f  allocateFunc 
)

write a HTML description page

Function oyDescriptionToHTML

const char * opts[] = {"add_html_header","1",
                       "add_oyranos_title","1",
                       "add_oyranos_copyright","1",
                       NULL};
char * html = oyDescriptionToHTML( oyGROUP_ALL, opts, malloc );
Parameters
groupcurrently only oyGROUP_ALL
optionszero terminated paired key/value strings
  • "add_html_header":"1" - adds a HTML header
  • "bgcolor":"#cccccc" - background color
  • "title":"myPage" - HTML page title
allocate_functhe user allocator
Returns
the string
Version
Oyranos: 0.3.2
Since
2011/08/09 (Oyranos: 0.3.2)
Date
2011/08/09

References oyDescriptionToHTML(), oyGetHtmlHeader(), oyGROUP_ALL, oyGROUP_BEHAVIOUR_MISSMATCH, oyGROUP_BEHAVIOUR_MIXED_MODE_DOCUMENTS, oyGROUP_BEHAVIOUR_PROOF, oyGROUP_BEHAVIOUR_RENDERING, oyGROUP_DEFAULT_PROFILES, oyWIDGET_ACTION_OPEN_MISMATCH_CMYK, oyWIDGET_ACTION_UNTAGGED_ASSIGN, oyWIDGET_BEHAVIOUR_END, oyWIDGET_DEFAULT_PROFILE_END, oyWIDGET_MIXED_MOD_DOCUMENTS_PRINT, oyWIDGET_MIXED_MOD_DOCUMENTS_SCREEN, oyWIDGET_RENDERING_INTENT, oyWIDGET_RENDERING_INTENT_PROOF, and oyWriteOptionToHTML_().

Referenced by oyDescriptionToHTML().

char* oyGetHtmlHeader ( const char **  options,
oyAlloc_f  allocate_func 
)

write a HTML page header

Function oyGetHtmlHeader

Parameters
optionszero terminated paired key/value strings
allocate_functhe user allocator
Returns
the string
Version
Oyranos: 0.3.2
Since
2011/08/09 (Oyranos: 0.3.2)
Date
2011/08/09

References oyVersionString().

Referenced by oyDescriptionToHTML().

void oyWriteOptionToHTML_ ( oyGROUP_e  group,
oyWIDGET_e  start,
oyWIDGET_e  end,
char **  text 
)

write a option to HTML

Function oyWriteOptionToHTML_ write option range to text, allocating memory on demand

Returns
the string
Version
Oyranos: 0.3.2
Since
2011/08/13 (Oyranos: 0.3.2)
Date
2011/08/13

References oyWIDGETTYPE_BEHAVIOUR.

Referenced by oyDescriptionToHTML().

void oyWriteOptionToXML_ ( oyGROUP_e  group,
oyWIDGET_e  start,
oyWIDGET_e  end,
char **  text,
uint32_t  flags 
)

write option range to text, allocating memory on demand

Parameters
[in]flags- 1: add group start
  • 2: add group end

References oyWIDGETTYPE_BEHAVIOUR.

char* oyXFORMsFromModelAndUi ( const char *  data,
const char *  ui_text,
const char **  namespaces,
const char *  head_injection,
oyAlloc_f  allocate_func 
)

join data and UI

Function oyXFORMsFromModelAndUi

Parameters
[in]datadata text
[in]ui_textui text
[in]namespacesurl style namespaces
[in]head_injectionhtml text to include in the HEAD section With a NULL pointer Oyranos will implicit insert a default CSS.
[in]allocate_funcuser allocator
Returns
XFORMS text
Version
Oyranos: 0.1.10
Since
2009/08/31 (Oyranos: 0.1.10)
Date
2009/08/31

References oy_domain_codeset, and OY_XFORMS_CSS.

const char* oyXFORMsModelGetAttrValue ( xmlNodePtr  cur,
const char *  attr_name 
)

get the xml elements attribute value

Function oyXFORMsModelGetAttrValue

Parameters
[in]curthe libxml2 node
[in]attr_namethe nodes attribute
Returns
the attributes value
Version
Oyranos: 0.3.2
Since
2011/07/31 (Oyranos: 0.3.2)
Date
2011/07/31

Referenced by oyXFORMsModelGetXPathValue().

const char* oyXFORMsModelGetXPathValue ( xmlNodePtr  cur,
const char *  attr_name,
const char **  xpath 
)

get the xforms model value of a corresponding layout node

Function oyXFORMsModelGetXPathValue

Parameters
[in]curthe libxml2 node
[in]attr_namethe nodes attribute, only "ref" ?
[out]xpaththe xpath of the referenced key
Returns
the attributes value
Version
Oyranos: 0.1.10
Since
2009/11/11 (Oyranos: 0.1.10)
Date
2009/11/11

References oyXFORMsModelGetAttrValue().

int oyXFORMsRenderUi ( const char *  xforms,
oyUiHandler_s **  ui_handlers,
oyPointer  user_data 
)

render the UI by a selected toolkit

Function oyXFORMsRenderUi Parse the XFORMS XML and render with the selected toolkit UI handlers.

Parameters
[in]xformsXFORMS text
[in]ui_handlersthe toolkit specific XFORMS handlers
[in,out]user_datauser context passed to ui_handlers
Returns
error
Version
Oyranos: 0.1.10
Since
2009/08/31 (Oyranos: 0.1.10)
Date
2009/08/31
const char* oyXML2NodeValue ( xmlNodePtr  cur)

get a node childs text value

Function oyXML2NodeValue

Parameters
[in]curthe libxml2 node
Returns
the childs text value
Version
Oyranos: 0.1.10
Since
2009/11/11 (Oyranos: 0.1.10)
Date
2009/11/11
int oyXMLNodeNameIs ( xmlNodePtr  cur,
const char *  node_name 
)

string compare with a joined namespace and node name

Function oyXMLNodeNameIs

Returns
boolean
Version
Oyranos: 0.1.10
Since
2009/11/12 (Oyranos: 0.1.10)
Date
2009/11/12