<libroxml  version="3.0.2" />
contact: tristan.lelong@libroxml.net
Functions
roxml_nav.c File Reference

XML document navigation module. More...

#include "roxml_internal.h"

Go to the source code of this file.

Functions

ROXML_API node_troxml_get_prev_sibling (node_t *n)
 prev sibling getter function
 
ROXML_API node_troxml_get_next_sibling (node_t *n)
 next sibling getter function
 
ROXML_API node_troxml_get_parent (node_t *n)
 parent getter function
 
ROXML_API node_troxml_get_root (node_t *n)
 root getter function
 

Detailed Description

XML document navigation module.

(C) Copyright 2014 Tristan Lelong trist.nosp@m.an.l.nosp@m.elong.nosp@m.@lib.nosp@m.roxml.nosp@m..net

SPDX-Licence-Identifier: LGPL-2.1+ The author added a static linking exception, see License.txt.

Definition in file roxml_nav.c.

Function Documentation

◆ roxml_get_next_sibling()

ROXML_API node_t * roxml_get_next_sibling ( node_t n)

next sibling getter function

This function returns the next sibling of a given node

Parameters
nis one node of the tree
Returns
the next sibling node

Definition at line 34 of file roxml_nav.c.

◆ roxml_get_parent()

ROXML_API node_t * roxml_get_parent ( node_t n)

parent getter function

This function returns the parent of a given node

Parameters
nis one node of the tree
Returns
the parent node

Definition at line 45 of file roxml_nav.c.

◆ roxml_get_prev_sibling()

ROXML_API node_t * roxml_get_prev_sibling ( node_t n)

prev sibling getter function

This function returns the prev sibling of a given node

Parameters
nis one node of the tree
Returns
the prev sibling node

Definition at line 14 of file roxml_nav.c.

◆ roxml_get_root()

ROXML_API node_t * roxml_get_root ( node_t n)

root getter function

This function returns the root of a tree containing the given node The root is defined as a virtual node that contains all first rank nodes if document is not a valid xml document:

<data1>
 <item/>
 <item/>
</data1>
<data2>
 <item/>
 <item/>
</data2>

will be processed successfully and the root node will have 2 children: data1 and data2

if document was:

<?xml version="1.0">
<doc>
 <data1>
  <item/>
  <item/>
 </data1>
 <data2>
  <item/>
  <item/>
 </data2>
</doc>

In this case, the node "doc" will be the root, and will contain 2 children: data1 and data2

For a document to be valid, following conditions must be met:

  • the first node is a processing instruction with the string "xml" as target application.
  • there is only one ELM node containing all document (but there may be several process-instructions or comments)
Parameters
nis one node of the tree
Returns
the root node

Definition at line 55 of file roxml_nav.c.