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
2a8552a9
Commit
2a8552a9
authored
Aug 27, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implement xmldecl-version property for a reader.
parent
240d1e4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
2 deletions
+67
-2
saxreader.c
dlls/msxml3/saxreader.c
+20
-0
saxreader.c
dlls/msxml3/tests/saxreader.c
+47
-2
No files found.
dlls/msxml3/saxreader.c
View file @
2a8552a9
...
...
@@ -209,6 +209,7 @@ typedef struct
BOOL
isParsing
;
struct
bstrpool
pool
;
saxreader_feature
features
;
BSTR
xmldecl_version
;
MSXML_VERSION
version
;
}
saxreader
;
...
...
@@ -334,6 +335,9 @@ static inline int saxreader_has_handler(const saxlocator *locator, enum saxhandl
static
const
WCHAR
PropertyCharsetW
[]
=
{
'c'
,
'h'
,
'a'
,
'r'
,
's'
,
'e'
,
't'
,
0
};
static
const
WCHAR
PropertyXmlDeclVersionW
[]
=
{
'x'
,
'm'
,
'l'
,
'd'
,
'e'
,
'c'
,
'l'
,
'-'
,
'v'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
PropertyDeclHandlerW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'x'
,
'm'
,
'l'
,
'.'
,
'o'
,
'r'
,
'g'
,
'/'
,
's'
,
'a'
,
'x'
,
'/'
,
'p'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'i'
,
'e'
,
's'
,
'/'
,
...
...
@@ -1311,6 +1315,13 @@ static void libxmlStartDocument(void *ctx)
This
->
column
++
;
}
/* store version value, declaration has to contain version attribute */
if
(
This
->
pParserCtxt
->
standalone
!=
-
1
)
{
SysFreeString
(
This
->
saxreader
->
xmldecl_version
);
This
->
saxreader
->
xmldecl_version
=
bstr_from_xmlChar
(
This
->
pParserCtxt
->
version
);
}
if
(
saxreader_has_handler
(
This
,
SAXContentHandler
))
{
if
(
This
->
vbInterface
)
...
...
@@ -2654,6 +2665,13 @@ static HRESULT internal_getProperty(const saxreader* This, const WCHAR *prop, VA
return
S_OK
;
}
if
(
!
memcmp
(
PropertyXmlDeclVersionW
,
prop
,
sizeof
(
PropertyXmlDeclVersionW
)))
{
V_VT
(
value
)
=
VT_BSTR
;
V_BSTR
(
value
)
=
SysAllocString
(
This
->
xmldecl_version
);
return
S_OK
;
}
FIXME
(
"(%p)->(%s) unsupported property
\n
"
,
This
,
debugstr_w
(
prop
));
return
E_NOTIMPL
;
...
...
@@ -2725,6 +2743,7 @@ static ULONG WINAPI saxxmlreader_Release(
IUnknown_Release
(
iface
->
vbhandler
);
}
SysFreeString
(
This
->
xmldecl_version
);
free_bstr_pool
(
&
This
->
pool
);
release_dispex
(
&
This
->
dispex
);
...
...
@@ -3214,6 +3233,7 @@ HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *outer, LPVOID *ppOb
reader
->
ref
=
1
;
memset
(
reader
->
saxhandlers
,
0
,
sizeof
(
reader
->
saxhandlers
));
reader
->
isParsing
=
FALSE
;
reader
->
xmldecl_version
=
NULL
;
reader
->
pool
.
pool
=
NULL
;
reader
->
pool
.
index
=
0
;
reader
->
pool
.
len
=
0
;
...
...
dlls/msxml3/tests/saxreader.c
View file @
2a8552a9
...
...
@@ -557,7 +557,7 @@ static const CHAR szUtf8XML[] =
static
const
char
utf8xml2
[]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
standalone=
\"
no
\"
?>
\r\n
"
;
static
const
CHAR
testXML
[]
=
static
const
char
testXML
[]
=
"<?xml version=
\"
1.0
\"
?>
\n
"
"<BankAccount>
\n
"
" <Number>1234</Number>
\n
"
...
...
@@ -2247,6 +2247,7 @@ static void test_saxreader_properties(void)
const
struct
saxreader_props_test_t
*
ptr
=
props_test_data
;
ISAXXMLReader
*
reader
;
HRESULT
hr
;
VARIANT
v
;
hr
=
CoCreateInstance
(
&
CLSID_SAXXMLReader
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_ISAXXMLReader
,
(
void
**
)
&
reader
);
...
...
@@ -2257,7 +2258,6 @@ static void test_saxreader_properties(void)
while
(
ptr
->
prop_name
)
{
VARIANT
v
;
LONG
ref
;
init_saxlexicalhandler
(
&
lexicalhandler
,
S_OK
);
...
...
@@ -2356,9 +2356,54 @@ static void test_saxreader_properties(void)
ok
(
V_UNKNOWN
(
&
v
)
!=
NULL
,
"got %p
\n
"
,
V_UNKNOWN
(
&
v
));
ptr
++
;
free_bstrs
();
}
ISAXXMLReader_Release
(
reader
);
if
(
!
is_clsid_supported
(
&
CLSID_SAXXMLReader40
,
reader_support_data
))
return
;
hr
=
CoCreateInstance
(
&
CLSID_SAXXMLReader40
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_ISAXXMLReader
,
(
void
**
)
&
reader
);
EXPECT_HR
(
hr
,
S_OK
);
/* xmldecl-version property */
V_VT
(
&
v
)
=
VT_EMPTY
;
V_BSTR
(
&
v
)
=
(
void
*
)
0xdeadbeef
;
hr
=
ISAXXMLReader_getProperty
(
reader
,
_bstr_
(
"xmldecl-version"
),
&
v
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
v
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
v
));
ok
(
V_BSTR
(
&
v
)
==
NULL
,
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
v
)));
/* stream without declaration */
V_VT
(
&
v
)
=
VT_BSTR
;
V_BSTR
(
&
v
)
=
_bstr_
(
"<element></element>"
);
hr
=
ISAXXMLReader_parse
(
reader
,
v
);
EXPECT_HR
(
hr
,
S_OK
);
V_VT
(
&
v
)
=
VT_EMPTY
;
V_BSTR
(
&
v
)
=
(
void
*
)
0xdeadbeef
;
hr
=
ISAXXMLReader_getProperty
(
reader
,
_bstr_
(
"xmldecl-version"
),
&
v
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
v
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
v
));
ok
(
V_BSTR
(
&
v
)
==
NULL
,
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
v
)));
/* stream with declaration */
V_VT
(
&
v
)
=
VT_BSTR
;
V_BSTR
(
&
v
)
=
_bstr_
(
"<?xml version=
\"
1.0
\"
?><element></element>"
);
hr
=
ISAXXMLReader_parse
(
reader
,
v
);
EXPECT_HR
(
hr
,
S_OK
);
V_VT
(
&
v
)
=
VT_EMPTY
;
V_BSTR
(
&
v
)
=
(
void
*
)
0xdeadbeef
;
hr
=
ISAXXMLReader_getProperty
(
reader
,
_bstr_
(
"xmldecl-version"
),
&
v
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
v
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
v
));
ok
(
!
lstrcmpW
(
V_BSTR
(
&
v
),
_bstr_
(
"1.0"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
v
)));
VariantClear
(
&
v
);
ISAXXMLReader_Release
(
reader
);
free_bstrs
();
}
...
...
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