42#if defined __cplusplus
54static int addStringToXML(
xmlTextStruct *XML,
char *s,
long len );
55static void xData_parseOutlinePrintRoot( FILE *f,
xData_rootElement *root,
int outputText );
64 err = xData_parseReconstructXML2( &(xData_doc->
root), &XML, NULL, 0 );
66 if( err == 0 ) addStringToXML( &XML, (
char*)
"\n", -1 );
74 long i, textOffset = 0;
77 for( child = root->
children; child != NULL; child = child->
next ) {
80 if( addStringToXML( XML, &(text[textOffset]), child->
textOffset - textOffset ) )
return( 1 );
84 if( addStringToXML( XML, (
char*)
"<", -1 ) != 0 )
return( 1 );
85 if( addStringToXML( XML, child->
name, -1 ) != 0 )
return( 1 );
88 if( addStringToXML( XML, (
char*)
" ", -1 ) != 0 )
return( 1 );
91 if( addStringToXML( XML, (
char*)
"=\"", -1 ) != 0 )
return( 1 );
94 if( addStringToXML( XML, (
char*)
"\"", -1 ) != 0 )
return( 1 );
97 if( addStringToXML( XML, (
char*)
">", -1 ) != 0 )
return( 1 );
100 if( addStringToXML( XML, (
char*)
"</", -1 ) != 0 )
return( 1 );
101 if( addStringToXML( XML, child->
name, -1 ) != 0 )
return( 1 );
103 if( addStringToXML( XML, (
char*)
">", -1 ) != 0 )
return( 1 );
105 if( textOffset < textLength )
if( addStringToXML( XML, &(text[textOffset]), textLength - textOffset ) )
return( 1 );
111static int addStringToXML(
xmlTextStruct *XML,
char *s,
long len ) {
113 long lenS, length, inc;
121 length = XML->
length + lenS + 1;
124 if( inc < 10000 ) inc = 10000;
125 if( length < inc ) length = inc;
126 XML->
text = (
char *) realloc( XML->
text, length );
128 if( XML->
text == NULL )
return( 1 );
132 strncpy( p, s, len ); }
144 xData_parseOutlinePrintRoot( f, &(xData_doc->
root), outputText );
150static void xData_parseOutlinePrintRoot( FILE *f,
xData_rootElement *root,
int outputText ) {
152 int i, depth = root->
depth;
155 for( child = root->
children; child != NULL; child = child->
next ) {
156 for( i = 0; i < depth; i++ ) fprintf( f,
" " );
157 fprintf( f,
"name = %s at line = %ld column = %ld textOffset = %ld; attris:",
163 if( outputText && child->
text.
text != NULL ) fprintf( f,
"; text: %s", child->
text.
text );
165 xData_parseOutlinePrintRoot( f, &(child->
childrenRoot), outputText );
169#if defined __cplusplus
xData_attribute * attributes
xData_attributionList attributes
xData_rootElement childrenRoot