 readme  id readmetxt v 11211 20100716 050527 allisterbeharry exp views datasource readme current version 6x10beta2 release notes fixed http drupalorg node 838264 patch by levjj to add doap support to viewsrdf http drupalorg node 844442 views theme overriding now works as it should http drupalorg node 855166 author element is now included in atom doc header http drupalorg node 847716 closing tag of an xml element does not include xmlns or any additional attributes defined on the starting tag upgrade notes to upgrade from the beta1 release you can simply drop in the new files into the modules folder however if you have views that rely on theme overriding you should rescan template files for your view in the view s theme information otherwise if you notice anything screwy or breakage try rescanning template files also about views datasource is a set of plugins for views for rendering node content in a set of shareable reusable data formats based on xml json and xhtml these formats allow content in a drupal site to be easily used as data sources for semantic web clients and web mashups views datasource plugins output content from node lists created in drupal views as 1 xml data documents using schemas like opml and atom 2 rdf xml data documents using vocabularies like foaf sioc and doap 3 json data documents in plain json or in a format like mit simile exhibit 4 xhtml data documents using microformat like hcard and hcalendar the project consists of 4 views style plugins 1 viewsxml output as raw xml opml and atom 2 viewsjson output as simple json and simile exhibit json 3 viewsrdf output as foaf sioc and doap 4 viewsxhtml output as hcard and hcalendar in drupal 6x to use these plugins you should 1 enable the module containing the format you want to render your views as 2 in the views ui set the view style in basic settings to one of i json data document render as simple json or simile exhibit json ii xml data document render as raw xml opml or atom iii rdf data document render as a foaf or sioc or doap rdf xml document iv xhtml data document render as hcard or hcalendar xhtml 3 in the view style options choose the options or vocabulary for your format like raw or the opml or atom vocabulary for xml rendering 4 add the fields to your view that contain the information you want to be pulled into the format renderer all formats will output the fields recognized as belonging to that format and certain formats like atom and sioc require certain fields to be present see below the sioc format requires the fields node nid type title body posted date 5 that s it the rendered view will be visible in the preview and at your view s page displaypath when you create a page display for your view with a unique url no drupal markup is emitted from this page just the data for the particular content type with the proper contenttype http header like text xml or application rdf xml a json data document will render the nodes generated by a view as a serialization of an array of javascript objects with each object s properties corresponding to a view field simple json is just plainvanilla json serialization usable in most apps while simile exhibit json is the serialization format used by the exhibit web app http similemitedu exhibit an xml data document with render the nodes generated by a view as xml the raw xml format creates a root element called nodes and then a node child element for each node in the view with each node s child elements corresponding to a view field opml is a very simple xml schema useful for generating simple lists like lists of tracks in an music playlist atom is a syndication schema with similar intents as rss the following fields will bviewsrdf will render the nodes generated by a view as an rdf xml foaf document with each element corresponding to a node in the view to use just have fields in the view named as their equivalent foaf properties for example to have a or element have a field named name and nick in your view similarly viewsxhtml provides the hcard plugin which will render each node in the xhtml hcard format just have fields corresponding to hcard properties defined in the view for example to create an element inside the root element just have one or more fields in the view containing the text email the foaf and hcard renderers are most useful with view based on user profiles where you can create profile fields corresponding to properties defined in the foaf http xmlnscom foaf spec or hcard http microformatsorg wiki hcardcheatsheet spec however any node type like those created with nodeprofile or bio or advanced profile or content profile can be used in the view it doesn t matter what data table the view is based on only what fields are present in the view options each style has a range of options you can use to customize the output the following options are common to all plugins 1 field output normal or raw this determines if each object in the view is displayed as normally rendered by drupal or as the raw result object raw is useful if you don t want any drupal formatting applied to the view result for example if you have a field with a date and you just want the timestamp value from the database note that both a field s label and content are rendered as raw so xml element or attribute labels will have the internal field name for example instead of body a raw field will have the label noderevisionsbody 2 plaintext output selecting this neans that all html markup will be stripped from the view result this is useful for example if you are generating an xml document from nodes and you just want the plain text content of a node without markup tags mixing with the other xml elements note that you can also escape xml content using cdata sections see below 3 contenttype this determine the contenttype header sent in a page display of a view this header is necessary for most clients consuming data from the view you can use the default contenttype for the particular plugin or choose from alternate types 4 use views api mode by default the plugins stop drupal from doing any additional processing when a view is rendered allowing the content to be output without any additional drupal markup however if you are calling a view programatically then this will hlar your code prematurely the solution contributed by icylake is to use the use views api mode option if you are going to call the view from code this option causes the plugin to not terminate drupal execution the following options are common to the viewsxml and viewsxhtml plugins 1 escape row content as cdata this option escapes all content from the result row using the cdata xml directive this is useful if you want all content markup preserved but kept separate from the other xml tags in the document you will have to instruct your client that the data you are processing is in cdata blocks and different xml processors may handle these blocks differently 2 xml document header this option lets you specify the xml document header which precedes the root xml element if you specify a header here it will override any header generated automatically by the plugin the viewsjson plugin has the following options 1 root object name this specifies the name of the toplevel object in the json object the default is the name of the view base table nodes users etc 2 json data format this specifies the format of the json output either simple plain vanilla json or the json format compatible with the simile exhibit application the viewsxml plugin has the following options 1 xml schema this specifies the xml schema the view will render raw simply renders each view field using the field name as a element attribute label and the field content as the element attribute value opml renders each field as an attributevalue pair in an element the opml schema requires at least one field labelled text or if this is not found it falls back to body or noderevisionsbody the following fields are recommended fallback in brackets type nodetype created published nodecreated post date atom renderes a view using the atom syndication schema you can use this format to create an atom syndication of the content in your view atom requires the following fields to be present fields in bracket indicate what the plugin will fall back to if it can find the explicitly named atom field id nid title nodetitle updated lastupdated updated date changed last updated commented last comment time the following fields are recommended content body nodebody noderevisionsbody link nid a link will be constructed from the drupal path and the nid summary author uid 2 root element name only applies to the raw xml schema this specifies the root xml element in the document all other elements will be children of this element the default is the name of the view base table 3 element output only applies to the raw xml schema this specifies whether the view fields will be output as nested child elements or attributes for example if element output is set to nested then a field labelled title with content foo will be output as foo if element output is set to attributes then this field will be output as title foo for each row element note that the plugin automatically strips invalid xml element and attribute label characters like spaces so a field like post date will become postdate 4 view author this is used by the atom and opml plugins to provide the author of the atom or opml document it can be a valid drupal user name a drupal user uid or any name otherwise the viewsrdf plugin has the following options 1 rdf vocabulary this indicates what rdf vocabulary to use in the document either foaf or sioc or doap foaf friend of a friend is useful for sharing a list of users or people while sioc semanticallyinterlinked online communities project is most useful for describing a set of pages stories blogs or forum posts with comments from different people sioc itself uses foaf to describe the posts and comments from different people doap description of a project is useful for as the name suggests projects see these links for more info http wwwfoafprojectorg http siocprojectorg http tracusefulinccom doap the following fields are recognized when using the foaf vocabulary fallbacks in brackets name firstname surname title nick mbox mail email mboxsha1sum openid workplacehomepage homepage weblog img depiction member phone jabberid msnchatid aimchatid yahoochatid the following fields are required when using the sioc vocabulary id nid created nodecreated post date title type nodetype changed nodechanged updated commented date lastupdated updated date body nodebody noderevisionsbody uid usersuid the following fields are recognized when using the doap vocabulary optional fields in square brackets nid name homepage license shortdesc language repositories developers the viewsxhtml plugin has the following options 1 microformat this specifies the microformat to be rendered hcard is most useful for a list of users or people hcalendar can be used to describe a list of events the following fields are recognized by hcard address type post office box street address extended address region locality postal code country name agent bday class category email honorific prefix given name additional name family name honoric suffix nickname organization name organization unit photo tel the following fields are recognized by hcalendar class category description summary dtstart event start eventstart dtend event end eventend todo proper date handling for each format check for separator in profile fields properly handle grouped multiple values in viewsxhtml et al strict conformance with atom spec recognize when field rewriting rules are used represent multiplevalued fields using nested child elements  