Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f6e6b835
Commit
f6e6b835
authored
Dec 06, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Implement attribute iteration methods.
parent
13f12649
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
8 deletions
+61
-8
reader.c
dlls/xmllite/reader.c
+31
-6
reader.c
dlls/xmllite/tests/reader.c
+30
-2
No files found.
dlls/xmllite/reader.c
View file @
f6e6b835
...
...
@@ -113,6 +113,7 @@ typedef struct _xmlreader
DtdProcessing
dtdmode
;
UINT
line
,
pos
;
/* reader position in XML stream */
struct
list
attrs
;
/* attributes list for current node */
struct
attribute
*
attr
;
/* current attribute */
UINT
attr_count
;
}
xmlreader
;
...
...
@@ -942,14 +943,32 @@ static HRESULT WINAPI xmlreader_GetNodeType(IXmlReader* iface, XmlNodeType *node
static
HRESULT
WINAPI
xmlreader_MoveToFirstAttribute
(
IXmlReader
*
iface
)
{
FIXME
(
"(%p): stub
\n
"
,
iface
);
return
E_NOTIMPL
;
xmlreader
*
This
=
impl_from_IXmlReader
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
attr_count
)
return
S_FALSE
;
This
->
attr
=
LIST_ENTRY
(
list_head
(
&
This
->
attrs
),
struct
attribute
,
entry
);
return
S_OK
;
}
static
HRESULT
WINAPI
xmlreader_MoveToNextAttribute
(
IXmlReader
*
iface
)
{
FIXME
(
"(%p): stub
\n
"
,
iface
);
return
E_NOTIMPL
;
xmlreader
*
This
=
impl_from_IXmlReader
(
iface
);
const
struct
list
*
next
;
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
attr_count
)
return
S_FALSE
;
if
(
!
This
->
attr
)
return
IXmlReader_MoveToFirstAttribute
(
iface
);
next
=
list_next
(
&
This
->
attrs
,
&
This
->
attr
->
entry
);
if
(
next
)
This
->
attr
=
LIST_ENTRY
(
next
,
struct
attribute
,
entry
);
return
next
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
xmlreader_MoveToAttributeByName
(
IXmlReader
*
iface
,
...
...
@@ -962,8 +981,13 @@ static HRESULT WINAPI xmlreader_MoveToAttributeByName(IXmlReader* iface,
static
HRESULT
WINAPI
xmlreader_MoveToElement
(
IXmlReader
*
iface
)
{
FIXME
(
"(%p): stub
\n
"
,
iface
);
return
E_NOTIMPL
;
xmlreader
*
This
=
impl_from_IXmlReader
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
attr_count
)
return
S_FALSE
;
This
->
attr
=
NULL
;
return
S_OK
;
}
static
HRESULT
WINAPI
xmlreader_GetQualifiedName
(
IXmlReader
*
iface
,
LPCWSTR
*
qualifiedName
,
...
...
@@ -1202,6 +1226,7 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
reader
->
nodetype
=
XmlNodeType_None
;
list_init
(
&
reader
->
attrs
);
reader
->
attr_count
=
0
;
reader
->
attr
=
NULL
;
*
obj
=
&
reader
->
IXmlReader_iface
;
...
...
dlls/xmllite/tests/reader.c
View file @
f6e6b835
...
...
@@ -591,6 +591,7 @@ static void test_read_xmldeclaration(void)
HRESULT
hr
;
XmlNodeType
type
;
UINT
count
=
0
;
const
WCHAR
*
val
;
hr
=
pCreateXmlReader
(
&
IID_IXmlReader
,
(
LPVOID
*
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
...
...
@@ -611,6 +612,16 @@ static void test_read_xmldeclaration(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
count
==
0
,
"got %d
\n
"
,
count
);
/* try to move without attributes */
hr
=
IXmlReader_MoveToElement
(
reader
);
ok
(
hr
==
S_FALSE
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"got %08x
\n
"
,
hr
);
ok_pos
(
reader
,
0
,
0
,
-
1
,
-
1
,
FALSE
);
type
=
-
1
;
...
...
@@ -622,13 +633,27 @@ static void test_read_xmldeclaration(void)
ok_pos
(
reader
,
1
,
3
,
-
1
,
55
,
TRUE
);
test_read_state
(
reader
,
XmlReadState_Interactive
,
-
1
,
0
);
hr
=
IXmlReader_GetValue
(
reader
,
&
val
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
ok
(
*
val
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
val
));
/* check attributes */
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
todo_wine
ok
(
hr
==
S_OK
,
"Expected S_OK,
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok_pos
(
reader
,
1
,
7
,
-
1
,
55
,
TRUE
);
/* try to move from last attribute */
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
todo_wine
ok
(
hr
==
S_OK
,
"Expected S_OK,
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok_pos
(
reader
,
1
,
7
,
-
1
,
55
,
TRUE
);
hr
=
IXmlReader_GetAttributeCount
(
reader
,
NULL
);
...
...
@@ -644,6 +669,9 @@ todo_wine {
ok
(
count
==
1
,
"Expected 1, got %d
\n
"
,
count
);
}
hr
=
IXmlReader_MoveToElement
(
reader
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
IStream_Release
(
stream
);
IXmlReader_Release
(
reader
);
}
...
...
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