Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e51ab3c0
Commit
e51ab3c0
authored
Aug 19, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Support reporting of a local name and value for attributes.
parent
36d99952
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
reader.c
dlls/xmllite/reader.c
+30
-4
reader.c
dlls/xmllite/tests/reader.c
+5
-9
No files found.
dlls/xmllite/reader.c
View file @
e51ab3c0
...
...
@@ -226,6 +226,7 @@ struct element
{
struct
list
entry
;
strval
qname
;
strval
localname
;
};
typedef
struct
...
...
@@ -437,7 +438,7 @@ static void reader_dec_depth(xmlreader *reader)
if
(
reader
->
depth
>
1
)
reader
->
depth
--
;
}
static
HRESULT
reader_push_element
(
xmlreader
*
reader
,
strval
*
qname
)
static
HRESULT
reader_push_element
(
xmlreader
*
reader
,
strval
*
qname
,
strval
*
localname
)
{
struct
element
*
elem
;
HRESULT
hr
;
...
...
@@ -451,6 +452,14 @@ static HRESULT reader_push_element(xmlreader *reader, strval *qname)
return
hr
;
}
hr
=
reader_strvaldup
(
reader
,
localname
,
&
elem
->
localname
);
if
(
FAILED
(
hr
))
{
reader_free_strvalued
(
reader
,
&
elem
->
qname
);
reader_free
(
reader
,
elem
);
return
hr
;
}
if
(
!
list_empty
(
&
reader
->
elements
))
{
hr
=
reader_inc_depth
(
reader
);
...
...
@@ -473,6 +482,7 @@ static void reader_pop_element(xmlreader *reader)
{
list_remove
(
&
elem
->
entry
);
reader_free_strvalued
(
reader
,
&
elem
->
qname
);
reader_free_strvalued
(
reader
,
&
elem
->
localname
);
reader_free
(
reader
,
elem
);
reader_dec_depth
(
reader
);
}
...
...
@@ -1524,8 +1534,7 @@ static HRESULT reader_parse_sys_literal(xmlreader *reader, strval *literal)
}
if
(
*
cur
==
quote
)
reader_skipn
(
reader
,
1
);
literal
->
str
=
start
;
literal
->
len
=
cur
-
start
;
reader_init_strvalue
(
start
,
cur
-
start
,
literal
);
TRACE
(
"%s
\n
"
,
debugstr_wn
(
start
,
cur
-
start
));
return
S_OK
;
}
...
...
@@ -1872,7 +1881,7 @@ static HRESULT reader_parse_stag(xmlreader *reader, strval *prefix, strval *loca
{
/* skip '>' */
reader_skipn
(
reader
,
1
);
return
reader_push_element
(
reader
,
qname
);
return
reader_push_element
(
reader
,
qname
,
local
);
}
hr
=
reader_parse_attribute
(
reader
);
...
...
@@ -2413,6 +2422,9 @@ static HRESULT WINAPI xmlreader_MoveToFirstAttribute(IXmlReader* iface)
if
(
!
This
->
attr_count
)
return
S_FALSE
;
This
->
attr
=
LIST_ENTRY
(
list_head
(
&
This
->
attrs
),
struct
attribute
,
entry
);
reader_set_strvalue
(
This
,
StringValue_LocalName
,
&
This
->
attr
->
localname
);
reader_set_strvalue
(
This
,
StringValue_Value
,
&
This
->
attr
->
value
);
return
S_OK
;
}
...
...
@@ -2430,7 +2442,11 @@ static HRESULT WINAPI xmlreader_MoveToNextAttribute(IXmlReader* iface)
next
=
list_next
(
&
This
->
attrs
,
&
This
->
attr
->
entry
);
if
(
next
)
{
This
->
attr
=
LIST_ENTRY
(
next
,
struct
attribute
,
entry
);
reader_set_strvalue
(
This
,
StringValue_LocalName
,
&
This
->
attr
->
localname
);
reader_set_strvalue
(
This
,
StringValue_Value
,
&
This
->
attr
->
value
);
}
return
next
?
S_OK
:
S_FALSE
;
}
...
...
@@ -2446,11 +2462,21 @@ static HRESULT WINAPI xmlreader_MoveToAttributeByName(IXmlReader* iface,
static
HRESULT
WINAPI
xmlreader_MoveToElement
(
IXmlReader
*
iface
)
{
xmlreader
*
This
=
impl_from_IXmlReader
(
iface
);
struct
element
*
elem
;
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
attr_count
)
return
S_FALSE
;
This
->
attr
=
NULL
;
/* FIXME: support other node types with 'attributes' like DTD */
elem
=
LIST_ENTRY
(
list_head
(
&
This
->
elements
),
struct
element
,
entry
);
if
(
elem
)
{
reader_set_strvalue
(
This
,
StringValue_QualifiedName
,
&
elem
->
qname
);
reader_set_strvalue
(
This
,
StringValue_LocalName
,
&
elem
->
localname
);
}
return
S_OK
;
}
...
...
dlls/xmllite/tests/reader.c
View file @
e51ab3c0
...
...
@@ -1048,18 +1048,16 @@ static void test_read_dtd(void)
str
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
lstrlenW
(
sysW
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
sysW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
}
len
=
0
;
str
=
NULL
;
hr
=
IXmlReader_GetValue
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
lstrlenW
(
sysvalW
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
sysvalW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
}
hr
=
IXmlReader_MoveToElement
(
reader
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
...
...
@@ -1067,9 +1065,10 @@ todo_wine {
str
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
lstrlenW
(
dtdnameW
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
dtdnameW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
}
len
=
0
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
...
...
@@ -1617,12 +1616,11 @@ static void test_read_attribute(void)
str
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
strlen
(
test
->
name
),
"got %u
\n
"
,
len
);
str_exp
=
a2w
(
test
->
name
);
ok
(
!
lstrcmpW
(
str
,
str_exp
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
free_str
(
str_exp
);
}
len
=
1
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
...
...
@@ -1638,13 +1636,11 @@ static void test_read_attribute(void)
str
=
NULL
;
hr
=
IXmlReader_GetValue
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
strlen
(
test
->
value
),
"got %u
\n
"
,
len
);
str_exp
=
a2w
(
test
->
value
);
ok
(
!
lstrcmpW
(
str
,
str_exp
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
free_str
(
str_exp
);
}
}
IStream_Release
(
stream
);
test
++
;
...
...
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