Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GNOME
libxml2
Commits
48dec9d3
Commit
48dec9d3
authored
Jun 27, 2005
by
Daniel Veillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding xml:id Daniel
* runtest.c: adding xml:id Daniel
parent
54a203c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
ChangeLog
ChangeLog
+4
-0
runtest.c
runtest.c
+70
-0
No files found.
ChangeLog
View file @
48dec9d3
Mon Jun 27 23:55:56 CEST 2005 Daniel Veillard <daniel@veillard.com>
* runtest.c: adding xml:id
Mon Jun 27 23:29:36 CEST 2005 Daniel Veillard <daniel@veillard.com>
* runtest.c: finishing XPath, adding XPointer
...
...
runtest.c
View file @
48dec9d3
...
...
@@ -2053,6 +2053,73 @@ xptrDocTest(const char *filename,
return
(
ret
);
}
#endif
/* LIBXML_XPTR_ENABLED */
/**
* xmlidDocTest:
* @filename: the file to parse
* @result: the file with expected result
* @err: the file with error messages
*
* Parse a file containing xml:id and check for errors and verify
* that XPath queries will work on them as expected.
*
* Returns 0 in case of success, an error code otherwise
*/
static
int
xmlidDocTest
(
const
char
*
filename
,
const
char
*
result
,
const
char
*
err
,
int
options
)
{
int
res
=
0
;
int
ret
=
0
;
char
*
temp
;
xpathDocument
=
xmlReadFile
(
filename
,
NULL
,
options
|
XML_PARSE_DTDATTR
|
XML_PARSE_NOENT
);
if
(
xpathDocument
==
NULL
)
{
fprintf
(
stderr
,
"Failed to load %s
\n
"
,
filename
);
return
(
-
1
);
}
temp
=
resultFilename
(
filename
,
""
,
".res"
);
if
(
temp
==
NULL
)
{
fprintf
(
stderr
,
"Out of memory
\n
"
);
fatalError
();
}
xpathOutput
=
fopen
(
temp
,
"w"
);
if
(
xpathOutput
==
NULL
)
{
fprintf
(
stderr
,
"failed to open output file %s
\n
"
,
temp
);
xmlFreeDoc
(
xpathDocument
);
free
(
temp
);
return
(
-
1
);
}
testXPath
(
"id('bar')"
,
0
,
0
);
fclose
(
xpathOutput
);
if
(
result
!=
NULL
)
{
ret
=
compareFiles
(
temp
,
result
);
if
(
ret
)
{
fprintf
(
stderr
,
"Result for %s failed
\n
"
,
filename
);
res
=
1
;
}
}
unlink
(
temp
);
free
(
temp
);
xmlFreeDoc
(
xpathDocument
);
if
(
err
!=
NULL
)
{
ret
=
compareFileMem
(
err
,
testErrors
,
testErrorsSize
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error for %s failed
\n
"
,
filename
);
res
=
1
;
}
}
return
(
res
);
}
#endif
/* XPATH */
/************************************************************************
* *
...
...
@@ -2159,6 +2226,9 @@ testDesc testDescriptions[] = {
xptrDocTest
,
"./test/XPath/docs/*"
,
NULL
,
NULL
,
NULL
,
0
},
#endif
{
"xml:id regression tests"
,
xmlidDocTest
,
"./test/xmlid/*"
,
"result/xmlid/"
,
""
,
".err"
,
0
},
#endif
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment