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
a20d1522
Commit
a20d1522
authored
Aug 18, 2015
by
Daniel Lehman
Committed by
Alexandre Julliard
Oct 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Treat namespace as attribute in IXMLDOMElement::getAttribute.
Signed-off-by:
Daniel Lehman
<
dlehman@esri.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2fb791b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
element.c
dlls/msxml3/element.c
+23
-0
domdoc.c
dlls/msxml3/tests/domdoc.c
+51
-0
No files found.
dlls/msxml3/element.c
View file @
a20d1522
...
...
@@ -1203,7 +1203,9 @@ static HRESULT WINAPI domelem_getAttribute(
domelem
*
This
=
impl_from_IXMLDOMElement
(
iface
);
xmlNodePtr
element
;
xmlChar
*
xml_name
,
*
xml_value
=
NULL
;
xmlChar
*
local
,
*
prefix
;
HRESULT
hr
=
S_FALSE
;
xmlNsPtr
ns
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
name
),
value
);
...
...
@@ -1222,7 +1224,28 @@ static HRESULT WINAPI domelem_getAttribute(
if
(
!
xmlValidateNameValue
(
xml_name
))
hr
=
E_FAIL
;
else
{
if
((
local
=
xmlSplitQName2
(
xml_name
,
&
prefix
)))
{
if
(
xmlStrEqual
(
prefix
,
BAD_CAST
"xmlns"
))
{
ns
=
xmlSearchNs
(
element
->
doc
,
element
,
local
);
if
(
ns
)
xml_value
=
xmlStrdup
(
ns
->
href
);
}
else
{
ns
=
xmlSearchNs
(
element
->
doc
,
element
,
prefix
);
if
(
ns
)
xml_value
=
xmlGetNsProp
(
element
,
local
,
ns
->
href
);
}
xmlFree
(
prefix
);
xmlFree
(
local
);
}
else
xml_value
=
xmlGetNsProp
(
element
,
xml_name
,
NULL
);
}
heap_free
(
xml_name
);
if
(
xml_value
)
...
...
dlls/msxml3/tests/domdoc.c
View file @
a20d1522
...
...
@@ -10882,6 +10882,56 @@ static void test_getAttributeNode(void)
free_bstrs
();
}
static
void
test_getAttribute
(
void
)
{
IXMLDOMDocument
*
doc
;
IXMLDOMElement
*
elem
;
VARIANT_BOOL
v
;
VARIANT
var
;
HRESULT
hr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
hr
=
IXMLDOMDocument_loadXML
(
doc
,
_bstr_
(
szExampleXML
),
&
v
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_get_documentElement
(
doc
,
&
elem
);
EXPECT_HR
(
hr
,
S_OK
);
VariantInit
(
&
var
);
hr
=
IXMLDOMElement_getAttribute
(
elem
,
_bstr_
(
"xmlns:foo"
),
&
var
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"vt = %x
\n
"
,
V_VT
(
&
var
));
ok
(
!
lstrcmpW
(
V_BSTR
(
&
var
),
_bstr_
(
"urn:uuid:86B2F87F-ACB6-45cd-8B77-9BDB92A01A29"
)),
"wrong attr value: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
hr
=
IXMLDOMElement_getAttribute
(
elem
,
_bstr_
(
"a"
),
&
var
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"vt = %x
\n
"
,
V_VT
(
&
var
));
ok
(
!
lstrcmpW
(
V_BSTR
(
&
var
),
_bstr_
(
"attr a"
)),
"wrong attr value: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
hr
=
IXMLDOMElement_getAttribute
(
elem
,
_bstr_
(
"foo:b"
),
&
var
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"vt = %x
\n
"
,
V_VT
(
&
var
));
ok
(
!
lstrcmpW
(
V_BSTR
(
&
var
),
_bstr_
(
"attr b"
)),
"wrong attr value: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
hr
=
IXMLDOMElement_getAttribute
(
elem
,
_bstr_
(
"b"
),
&
var
);
EXPECT_HR
(
hr
,
S_FALSE
);
ok
(
V_VT
(
&
var
)
==
VT_NULL
,
"vt = %x
\n
"
,
V_VT
(
&
var
));
VariantClear
(
&
var
);
hr
=
IXMLDOMElement_getAttribute
(
elem
,
_bstr_
(
"non-existent"
),
&
var
);
EXPECT_HR
(
hr
,
S_FALSE
);
ok
(
V_VT
(
&
var
)
==
VT_NULL
,
"vt = %x
\n
"
,
V_VT
(
&
var
));
VariantClear
(
&
var
);
IXMLDOMElement_Release
(
elem
);
IXMLDOMDocument_Release
(
doc
);
free_bstrs
();
}
typedef
struct
{
DOMNodeType
type
;
const
char
*
name
;
...
...
@@ -12071,6 +12121,7 @@ START_TEST(domdoc)
test_dispex
();
test_parseerror
();
test_getAttributeNode
();
test_getAttribute
();
test_supporterrorinfo
();
test_nodeValue
();
test_get_namespaces
();
...
...
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