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
bdb9ba77
Commit
bdb9ba77
authored
Apr 11, 2001
by
Daniel Veillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- tree.c: fixed xmlStringGetNodeList() to handle charrefs
- result/wml.xml: resulted in a small output change Daniel
parent
d2f3ec78
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
53 deletions
+111
-53
ChangeLog
ChangeLog
+5
-0
result/wml.xml
result/wml.xml
+1
-1
tree.c
tree.c
+105
-52
No files found.
ChangeLog
View file @
bdb9ba77
Wed Apr 11 13:26:34 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* tree.c: fixed xmlStringGetNodeList() to handle charrefs
* result/wml.xml: resulted in a small output change
Wed Apr 11 09:47:55 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* tree.c: xmlNewDoc was missing the charset initialization
...
...
result/wml.xml
View file @
bdb9ba77
...
...
@@ -3,7 +3,7 @@
<wml>
<card
id=
"card1"
title=
"Rubriques 75008"
>
<p>
<a
href=
"rubmenu.asp?CP=75008&
#38
;RB=01"
>
Cin
é
ma
</a><br/>
<a
href=
"rubmenu.asp?CP=75008&
amp
;RB=01"
>
Cin
é
ma
</a><br/>
</p>
</card>
...
...
tree.c
View file @
bdb9ba77
...
...
@@ -36,6 +36,7 @@
#include <libxml/entities.h>
#include <libxml/valid.h>
#include <libxml/xmlerror.h>
#include <libxml/parserInternals.h>
xmlNsPtr
xmlNewReconciliedNs
(
xmlDocPtr
doc
,
xmlNodePtr
tree
,
xmlNsPtr
ns
);
...
...
@@ -57,9 +58,6 @@ static int xmlCompressMode = 0;
static
int
xmlCheckDTD
=
1
;
int
xmlSaveNoEmptyTags
=
0
;
#define IS_BLANK(c) \
(((c) == '\n') || ((c) == '\r') || ((c) == '\t') || ((c) == ' '))
#define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) { \
xmlNodePtr ulccur = (n)->children; \
if (ulccur == NULL) { \
...
...
@@ -646,11 +644,10 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
q
=
cur
;
while
(
*
cur
!=
0
)
{
/* TODO: attributes can inherits & ...
if ((*cur == '&') && (cur[1] == '#')) {
int val =
} else */
if
(
*
cur
==
'&'
)
{
if
(
cur
[
0
]
==
'&'
)
{
int
charval
=
0
;
xmlChar
tmp
;
/*
* Save the current text.
*/
...
...
@@ -669,55 +666,113 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
}
}
}
/*
* Read the entity string
*/
cur
++
;
q
=
cur
;
while
((
*
cur
!=
0
)
&&
(
*
cur
!=
';'
))
cur
++
;
if
(
*
cur
==
0
)
{
#ifdef DEBUG_TREE
xmlGenericError
(
xmlGenericErrorContext
,
"xmlStringGetNodeList: unterminated entity %30s
\n
"
,
q
);
#endif
return
(
ret
);
}
if
(
cur
!=
q
)
{
if
((
cur
[
1
]
==
'#'
)
&&
(
cur
[
2
]
==
'x'
))
{
cur
+=
3
;
tmp
=
*
cur
;
while
(
tmp
!=
';'
)
{
/* Non input consuming loop */
if
((
tmp
>=
'0'
)
&&
(
tmp
<=
'9'
))
charval
=
charval
*
16
+
(
tmp
-
'0'
);
else
if
((
tmp
>=
'a'
)
&&
(
tmp
<=
'f'
))
charval
=
charval
*
16
+
(
tmp
-
'a'
)
+
10
;
else
if
((
tmp
>=
'A'
)
&&
(
tmp
<=
'F'
))
charval
=
charval
*
16
+
(
tmp
-
'A'
)
+
10
;
else
{
xmlGenericError
(
xmlGenericErrorContext
,
"xmlStringGetNodeList: incharvalid hexadecimal charvalue
\n
"
);
charval
=
0
;
break
;
}
cur
++
;
tmp
=
*
cur
;
}
if
(
tmp
==
';'
)
cur
++
;
q
=
cur
;
}
else
if
(
cur
[
1
]
==
'#'
)
{
cur
+=
2
;
tmp
=
*
cur
;
while
(
tmp
!=
';'
)
{
/* Non input consuming loops */
if
((
tmp
>=
'0'
)
&&
(
tmp
<=
'9'
))
charval
=
charval
*
10
+
(
tmp
-
'0'
);
else
{
xmlGenericError
(
xmlGenericErrorContext
,
"xmlStringGetNodeList: incharvalid decimal charvalue
\n
"
);
charval
=
0
;
break
;
}
cur
++
;
tmp
=
*
cur
;
}
if
(
tmp
==
';'
)
cur
++
;
q
=
cur
;
}
else
{
/*
*
Predefined entities don't generate nodes
*
Read the entity string
*/
val
=
xmlStrndup
(
q
,
cur
-
q
)
;
ent
=
xmlGetDocEntity
(
doc
,
val
)
;
if
((
ent
!=
NULL
)
&&
(
ent
->
etype
==
XML_INTERNAL_PREDEFINED_ENTITY
)
)
{
if
(
last
==
NULL
)
{
node
=
xmlNewDocText
(
doc
,
ent
->
content
);
last
=
ret
=
node
;
}
else
xmlNodeAddContent
(
last
,
ent
->
conten
t
);
}
else
{
cur
++
;
q
=
cur
;
while
((
*
cur
!=
0
)
&&
(
*
cur
!=
';'
))
cur
++
;
if
(
*
cur
==
0
)
{
#ifdef DEBUG_TREE
xmlGenericError
(
xmlGenericErrorContext
,
"xmlStringGetNodeList: unterminated entity %30s
\n
"
,
q
)
;
#endif
return
(
re
t
);
}
if
(
cur
!=
q
)
{
/*
*
C
re
ate a new REFERENCE_REF
node
*
P
re
defined entities don't generate
node
s
*/
node
=
xmlNewReference
(
doc
,
val
);
if
(
node
==
NULL
)
{
if
(
val
!=
NULL
)
xmlFree
(
val
);
return
(
ret
);
val
=
xmlStrndup
(
q
,
cur
-
q
);
ent
=
xmlGetDocEntity
(
doc
,
val
);
if
((
ent
!=
NULL
)
&&
(
ent
->
etype
==
XML_INTERNAL_PREDEFINED_ENTITY
))
{
if
(
last
==
NULL
)
{
node
=
xmlNewDocText
(
doc
,
ent
->
content
);
last
=
ret
=
node
;
}
else
xmlNodeAddContent
(
last
,
ent
->
content
);
}
else
{
/*
* Create a new REFERENCE_REF node
*/
node
=
xmlNewReference
(
doc
,
val
);
if
(
node
==
NULL
)
{
if
(
val
!=
NULL
)
xmlFree
(
val
);
return
(
ret
);
}
if
(
last
==
NULL
)
{
last
=
ret
=
node
;
}
else
{
last
=
xmlAddNextSibling
(
last
,
node
);
}
}
if
(
last
==
NULL
)
xmlFree
(
val
);
}
cur
++
;
q
=
cur
;
}
if
(
charval
!=
0
)
{
xmlChar
buf
[
10
];
int
len
;
len
=
xmlCopyCharMultiByte
(
buf
,
charval
);
buf
[
len
]
=
0
;
node
=
xmlNewDocText
(
doc
,
buf
);
if
(
node
!=
NULL
)
{
if
(
last
==
NULL
)
{
last
=
ret
=
node
;
else
{
last
->
next
=
node
;
node
->
prev
=
last
;
last
=
node
;
}
else
{
last
=
xmlAddNextSibling
(
last
,
node
);
}
}
xmlFree
(
val
);
charval
=
0
;
}
cur
++
;
q
=
cur
;
}
else
}
else
cur
++
;
}
if
(
cur
!=
q
)
{
...
...
@@ -729,12 +784,10 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
}
else
{
node
=
xmlNewDocTextLen
(
doc
,
q
,
cur
-
q
);
if
(
node
==
NULL
)
return
(
ret
);
if
(
last
==
NULL
)
if
(
last
==
NULL
)
{
last
=
ret
=
node
;
else
{
last
->
next
=
node
;
node
->
prev
=
last
;
last
=
node
;
}
else
{
last
=
xmlAddNextSibling
(
last
,
node
);
}
}
}
...
...
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