xmlprint.h File Reference

#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  _xmlprintOutput
struct  _xmlprintTag

Defines

#define AMP   "&amp;"
#define APOS   "&apos;"
#define GT   "&gt;"
#define LT   "&lt;"
#define QUOT   "&quot;"

Typedefs

typedef _xmlprintOutput xmlprintOutput
typedef _xmlprintTag xmlprintTag

Functions

char * doSpecialCharacters (char *source, int attribute)
 Returns null terminated string XML special character are now used.
xmlprintOutputxmlprint_addtag (xmlprintOutput *output, char *tag, char *attributes)
 Writes tag to stdout and add this tag to stack also.
void xmlprint_addtagvalue (xmlprintOutput *output, char *value)
 Writes value to current tag.
void xmlprint_closeoutput (xmlprintOutput *output)
 Closes output.
xmlprintOutputxmlprint_createoutput ()
 Initializes xmlprintOutput and writes first line of XML to stdout.
xmlprintOutputxmlprint_endtag (xmlprintOutput *output)
 Ends current tag.
void xmlprint_oneliner (xmlprintOutput *output, char *tag, char *attributes)
 Writes one line tag for stdout.


Define Documentation

#define AMP   "&amp;"

Special character &

Definition at line 116 of file xmlprint.h.

#define APOS   "&apos;"

Special character '

Definition at line 119 of file xmlprint.h.

#define GT   "&gt;"

Special character >

Definition at line 118 of file xmlprint.h.

#define LT   "&lt;"

Special character <

Definition at line 117 of file xmlprint.h.

#define QUOT   "&quot;"

Special character "

Definition at line 120 of file xmlprint.h.


Typedef Documentation

typedef struct _xmlprintOutput xmlprintOutput

Definition at line 112 of file xmlprint.h.

typedef struct _xmlprintTag xmlprintTag

Definition at line 90 of file xmlprint.h.


Function Documentation

char* doSpecialCharacters ( char *  source,
int  attribute 
)

Returns null terminated string XML special character are now used.

This function goes through source string and changes every XML special characters into valid ones

Parameters:
source char*, null terminated string
attribute int, an integer. 0 change all special characters. 1 Remove all other expect "
Returns:
null terminated string

xmlprintOutput* xmlprint_addtag ( xmlprintOutput output,
char *  tag,
char *  attributes 
)

Writes tag to stdout and add this tag to stack also.

xmlprint_addtag writes tag to stdout and add this tag to stack also. After this function it is possible to use xmlprint_addtagvalue function.

Parameters:
output xmlprintOutput*, a XML output
tag char*, a XML tag as a null terminated string
attributes char*, a XML tag's attributes as a null terminated string
Returns:
xmlprintOutput
Remarks:
Attribute values cannot contain character ". If values contain " character use doSpecialCharacters function to remove " character from it.

void xmlprint_addtagvalue ( xmlprintOutput output,
char *  value 
)

Writes value to current tag.

xmlprint_addtagvalue writes text inside current value

Parameters:
output xmlprintOutput*, a XML output
value char*, a text to current tag as a null terminated string

void xmlprint_closeoutput ( xmlprintOutput output  ) 

Closes output.

xmlprint_closeoutput calls xmlprint_endtag as long as there are no tags left to close. After this output is freed from the memory. Use this function only when there will no more tags to add.

Parameters:
output xmlprintOutput*, a XML output

xmlprintOutput* xmlprint_createoutput (  ) 

Initializes xmlprintOutput and writes first line of XML to stdout.

xmlprint_createoutput initializes xmlprintOutput and writes first line of xml text which is: "<?xml version="1.0"?>"

Returns:
xmlprintOutput

xmlprintOutput* xmlprint_endtag ( xmlprintOutput output  ) 

Ends current tag.

xmlprint_endtag ends current tag and returns xmlprintOutput with second tag from stack.

Parameters:
output xmlprintOutput*, a XML output
Returns:
xmlprintOutput

void xmlprint_oneliner ( xmlprintOutput output,
char *  tag,
char *  attributes 
)

Writes one line tag for stdout.

xmlprint_oneliner writes one line tag with possible attributes

Parameters:
output xmlprintOutput*, a XML output
tag char*, a XML tag as a null terminated string
attributes char*, a XML tag's attributes as a null terminated string
Remarks:
Attribute values cannot contain character ".

footer


 SourceForge.net Logo