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
4fb5872b
Commit
4fb5872b
authored
Apr 20, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Support 'namespace-prefixes' feature.
parent
474791fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
24 deletions
+102
-24
saxreader.c
dlls/msxml3/saxreader.c
+24
-19
saxreader.c
dlls/msxml3/tests/saxreader.c
+78
-5
No files found.
dlls/msxml3/saxreader.c
View file @
4fb5872b
...
...
@@ -1160,9 +1160,13 @@ static HRESULT SAXAttributes_populate(saxlocator *locator,
static
const
WCHAR
xmlnsW
[]
=
{
'x'
,
'm'
,
'l'
,
'n'
,
's'
,
0
};
struct
_attributes
*
attrs
;
int
index
;
int
i
;
/* skip namespace definitions */
if
((
locator
->
saxreader
->
features
&
NamespacePrefixes
)
==
0
)
nb_namespaces
=
0
;
locator
->
nb_attributes
=
nb_namespaces
+
nb_attributes
;
locator
->
nb_attributes
=
nb_namespaces
+
nb_attributes
;
if
(
locator
->
nb_attributes
>
locator
->
attributesSize
)
{
attrs
=
heap_realloc
(
locator
->
attributes
,
sizeof
(
struct
_attributes
)
*
locator
->
nb_attributes
*
2
);
...
...
@@ -1178,31 +1182,31 @@ static HRESULT SAXAttributes_populate(saxlocator *locator,
attrs
=
locator
->
attributes
;
}
for
(
index
=
0
;
index
<
nb_namespaces
;
index
++
)
for
(
i
=
0
;
i
<
nb_namespaces
;
i
++
)
{
attrs
[
nb_attributes
+
i
ndex
].
szLocalname
=
SysAllocStringLen
(
NULL
,
0
);
attrs
[
nb_attributes
+
i
ndex
].
szURI
=
locator
->
namespaceUri
;
attrs
[
nb_attributes
+
i
ndex
].
szValue
=
bstr_from_xmlChar
(
xmlNamespaces
[
2
*
index
+
1
]);
if
(
!
xmlNamespaces
[
2
*
i
ndex
])
attrs
[
nb_attributes
+
i
ndex
].
szQName
=
SysAllocString
(
xmlnsW
);
attrs
[
nb_attributes
+
i
].
szLocalname
=
SysAllocStringLen
(
NULL
,
0
);
attrs
[
nb_attributes
+
i
].
szURI
=
locator
->
namespaceUri
;
attrs
[
nb_attributes
+
i
].
szValue
=
bstr_from_xmlChar
(
xmlNamespaces
[
2
*
i
+
1
]);
if
(
!
xmlNamespaces
[
2
*
i
])
attrs
[
nb_attributes
+
i
].
szQName
=
SysAllocString
(
xmlnsW
);
else
attrs
[
nb_attributes
+
i
ndex
].
szQName
=
QName_from_xmlChar
(
xmlns
,
xmlNamespaces
[
2
*
index
]);
attrs
[
nb_attributes
+
i
].
szQName
=
QName_from_xmlChar
(
xmlns
,
xmlNamespaces
[
2
*
i
]);
}
for
(
index
=
0
;
index
<
nb_attributes
;
index
++
)
for
(
i
=
0
;
i
<
nb_attributes
;
i
++
)
{
static
const
xmlChar
xmlA
[]
=
"xml"
;
if
(
xmlStrEqual
(
xmlAttributes
[
i
ndex
*
5
+
1
],
xmlA
))
attrs
[
i
ndex
].
szURI
=
bstr_from_xmlChar
(
xmlAttributes
[
index
*
5
+
2
]);
if
(
xmlStrEqual
(
xmlAttributes
[
i
*
5
+
1
],
xmlA
))
attrs
[
i
].
szURI
=
bstr_from_xmlChar
(
xmlAttributes
[
i
*
5
+
2
]);
else
attrs
[
i
ndex
].
szURI
=
find_element_uri
(
locator
,
xmlAttributes
[
index
*
5
+
2
]);
attrs
[
i
].
szURI
=
find_element_uri
(
locator
,
xmlAttributes
[
i
*
5
+
2
]);
attrs
[
i
ndex
].
szLocalname
=
bstr_from_xmlChar
(
xmlAttributes
[
index
*
5
]);
attrs
[
i
ndex
].
szValue
=
bstr_from_xmlCharN
(
xmlAttributes
[
index
*
5
+
3
],
xmlAttributes
[
i
ndex
*
5
+
4
]
-
xmlAttributes
[
index
*
5
+
3
]);
attrs
[
i
ndex
].
szQName
=
QName_from_xmlChar
(
xmlAttributes
[
index
*
5
+
1
],
xmlAttributes
[
i
ndex
*
5
]);
attrs
[
i
].
szLocalname
=
bstr_from_xmlChar
(
xmlAttributes
[
i
*
5
]);
attrs
[
i
].
szValue
=
bstr_from_xmlCharN
(
xmlAttributes
[
i
*
5
+
3
],
xmlAttributes
[
i
*
5
+
4
]
-
xmlAttributes
[
i
*
5
+
3
]);
attrs
[
i
].
szQName
=
QName_from_xmlChar
(
xmlAttributes
[
i
*
5
+
1
],
xmlAttributes
[
i
*
5
]);
}
return
S_OK
;
...
...
@@ -2849,7 +2853,8 @@ static HRESULT WINAPI saxxmlreader_putFeature(
/* accepted cases */
if
((
feature
==
ExternalGeneralEntities
&&
value
==
VARIANT_FALSE
)
||
(
feature
==
ExternalParameterEntities
&&
value
==
VARIANT_FALSE
)
||
feature
==
Namespaces
)
feature
==
Namespaces
||
feature
==
NamespacePrefixes
)
{
return
set_feature_value
(
This
,
feature
,
value
);
}
...
...
dlls/msxml3/tests/saxreader.c
View file @
4fb5872b
...
...
@@ -787,6 +787,50 @@ static struct call_entry content_handler_test_attributes_alternate_6[] = {
{
CH_ENDTEST
}
};
/* 'namespaces' is on, 'namespace-prefixes' if off */
static
struct
attribute_entry
ch_attributes_no_prefix
[]
=
{
{
"prefix_test"
,
"arg1"
,
"test:arg1"
,
"arg1"
},
{
""
,
"arg2"
,
"arg2"
,
"arg2"
},
{
"prefix_test"
,
"ar3"
,
"test:ar3"
,
"arg3"
},
{
NULL
}
};
static
struct
call_entry
content_handler_test_attributes_alt_no_prefix
[]
=
{
{
CH_PUTDOCUMENTLOCATOR
,
1
,
0
,
S_OK
},
{
CH_STARTDOCUMENT
,
1
,
22
,
S_OK
},
{
CH_STARTPREFIXMAPPING
,
2
,
95
,
S_OK
,
"test"
,
"prefix_test"
},
{
CH_STARTPREFIXMAPPING
,
2
,
95
,
S_OK
,
""
,
"prefix"
},
{
CH_STARTELEMENT
,
2
,
95
,
S_OK
,
"prefix"
,
"document"
,
"document"
,
ch_attributes_no_prefix
},
{
CH_CHARACTERS
,
3
,
1
,
S_OK
,
"
\n
"
},
{
CH_STARTPREFIXMAPPING
,
3
,
24
,
S_OK
,
"p"
,
"test"
},
{
CH_STARTELEMENT
,
3
,
24
,
S_OK
,
"prefix"
,
"node1"
,
"node1"
,
NULL
},
{
CH_ENDELEMENT
,
3
,
24
,
S_OK
,
"prefix"
,
"node1"
,
"node1"
},
{
CH_ENDPREFIXMAPPING
,
3
,
24
,
S_OK
,
"p"
},
{
CH_ENDELEMENT
,
3
,
35
,
S_OK
,
"prefix"
,
"document"
,
"document"
},
{
CH_ENDPREFIXMAPPING
,
3
,
35
,
S_OK
,
"test"
},
{
CH_ENDPREFIXMAPPING
,
3
,
35
,
S_OK
,
""
},
{
CH_ENDDOCUMENT
,
4
,
0
,
S_OK
},
{
CH_ENDTEST
}
};
static
struct
call_entry
content_handler_test_attributes_no_prefix
[]
=
{
{
CH_PUTDOCUMENTLOCATOR
,
0
,
0
,
S_OK
},
{
CH_STARTDOCUMENT
,
0
,
0
,
S_OK
},
{
CH_STARTPREFIXMAPPING
,
2
,
96
,
S_OK
,
"test"
,
"prefix_test"
},
{
CH_STARTPREFIXMAPPING
,
2
,
96
,
S_OK
,
""
,
"prefix"
},
{
CH_STARTELEMENT
,
2
,
96
,
S_OK
,
"prefix"
,
"document"
,
"document"
,
ch_attributes_no_prefix
},
{
CH_CHARACTERS
,
2
,
96
,
S_OK
,
"
\n
"
},
{
CH_STARTPREFIXMAPPING
,
3
,
25
,
S_OK
,
"p"
,
"test"
},
{
CH_STARTELEMENT
,
3
,
25
,
S_OK
,
"prefix"
,
"node1"
,
"node1"
,
NULL
},
{
CH_ENDELEMENT
,
3
,
25
,
S_OK
,
"prefix"
,
"node1"
,
"node1"
},
{
CH_ENDPREFIXMAPPING
,
3
,
25
,
S_OK
,
"p"
},
{
CH_ENDELEMENT
,
3
,
27
,
S_OK
,
"prefix"
,
"document"
,
"document"
},
{
CH_ENDPREFIXMAPPING
,
3
,
27
,
S_OK
,
""
},
{
CH_ENDPREFIXMAPPING
,
3
,
27
,
S_OK
,
"test"
},
{
CH_ENDDOCUMENT
,
0
,
0
},
{
CH_ENDTEST
}
};
static
struct
attribute_entry
xmlspace_attrs
[]
=
{
{
"http://www.w3.org/XML/1998/namespace"
,
"space"
,
"xml:space"
,
"preserve"
},
{
NULL
}
...
...
@@ -1765,12 +1809,12 @@ static void test_saxreader(void)
static
const
CHAR
testXmlA
[]
=
"test.xml"
;
static
const
WCHAR
testXmlW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'.'
,
'x'
,
'm'
,
'l'
,
0
};
IXMLDOMDocument
*
doc
;
BSTR
str
;
VARIANT_BOOL
v
;
while
(
table
->
clsid
)
{
struct
call_entry
*
test_seq
;
BSTR
str
;
if
(
!
is_clsid_supported
(
table
->
clsid
,
reader_support_data
))
{
...
...
@@ -1967,6 +2011,7 @@ static void test_saxreader(void)
str
=
SysAllocString
(
szSimpleXML
);
hr
=
IXMLDOMDocument_loadXML
(
doc
,
str
,
&
v
);
EXPECT_HR
(
hr
,
S_OK
);
SysFreeString
(
str
);
V_VT
(
&
var
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
var
)
=
(
IUnknown
*
)
doc
;
...
...
@@ -2031,15 +2076,42 @@ static void test_saxreader(void)
hr
=
ISAXXMLReader_parse
(
reader
,
var
);
EXPECT_HR
(
hr
,
S_OK
);
ok_sequence
(
sequences
,
CONTENT_HANDLER_INDEX
,
test_seq
,
"content test attributes"
,
TRUE
);
hr
=
ISAXXMLReader_putFeature
(
reader
,
_bstr_
(
"http://xml.org/sax/features/namespaces"
),
VARIANT_TRUE
);
EXPECT_HR
(
hr
,
S_OK
);
/* switch off 'namespace-prefixes' feature */
hr
=
ISAXXMLReader_putFeature
(
reader
,
_bstr_
(
"http://xml.org/sax/features/namespace-prefixes"
),
VARIANT_FALSE
);
EXPECT_HR
(
hr
,
S_OK
);
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
size
.
QuadPart
=
strlen
(
test_attributes
);
IStream_SetSize
(
stream
,
size
);
IStream_Write
(
stream
,
test_attributes
,
strlen
(
test_attributes
),
&
written
);
pos
.
QuadPart
=
0
;
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_SET
,
NULL
);
V_VT
(
&
var
)
=
VT_UNKNOWN
|
VT_DISPATCH
;
V_UNKNOWN
(
&
var
)
=
(
IUnknown
*
)
stream
;
if
(
IsEqualGUID
(
table
->
clsid
,
&
CLSID_SAXXMLReader40
)
||
IsEqualGUID
(
table
->
clsid
,
&
CLSID_SAXXMLReader60
))
{
test_seq
=
content_handler_test_attributes_alt_no_prefix
;
}
else
test_seq
=
content_handler_test_attributes_no_prefix
;
set_expected_seq
(
test_seq
);
hr
=
ISAXXMLReader_parse
(
reader
,
var
);
EXPECT_HR
(
hr
,
S_OK
);
ok_sequence
(
sequences
,
CONTENT_HANDLER_INDEX
,
test_seq
,
"content test attributes"
,
FALSE
);
hr
=
ISAXXMLReader_putFeature
(
reader
,
_bstr_
(
"http://xml.org/sax/features/namespace-prefixes"
),
VARIANT_TRUE
);
EXPECT_HR
(
hr
,
S_OK
);
ISAXXMLReader_Release
(
reader
);
table
++
;
}
return
;
ISAXXMLReader_Release
(
reader
);
SysFreeString
(
str
);
free_bstrs
();
}
...
...
@@ -2161,6 +2233,7 @@ static const struct feature_ns_entry_t feature_ns_entry_data[] = {
static
const
char
*
feature_names
[]
=
{
"http://xml.org/sax/features/namespaces"
,
"http://xml.org/sax/features/namespace-prefixes"
,
0
};
...
...
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