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
10e2d26e
Commit
10e2d26e
authored
Nov 24, 2010
by
Adam Martinson
Committed by
Alexandre Julliard
Nov 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/schema: Properly handle schema_cache_add() from a URL.
parent
54d949fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
35 deletions
+50
-35
schema.c
dlls/msxml3/schema.c
+50
-35
No files found.
dlls/msxml3/schema.c
View file @
10e2d26e
...
...
@@ -818,38 +818,6 @@ static BOOL link_datatypes(xmlDocPtr schema)
return
TRUE
;
}
static
cache_entry
*
cache_entry_from_url
(
char
const
*
url
,
xmlChar
const
*
nsURI
)
{
cache_entry
*
entry
=
heap_alloc
(
sizeof
(
cache_entry
));
xmlSchemaParserCtxtPtr
spctx
=
xmlSchemaNewParserCtxt
(
url
);
entry
->
type
=
SCHEMA_TYPE_XSD
;
entry
->
ref
=
0
;
if
(
spctx
)
{
if
((
entry
->
schema
=
Schema_parse
(
spctx
)))
{
/* TODO: if the nsURI is different from the default xmlns or targetNamespace,
* do we need to do something special here? */
xmldoc_init
(
entry
->
schema
->
doc
,
&
CLSID_DOMDocument40
);
entry
->
doc
=
entry
->
schema
->
doc
;
xmldoc_add_ref
(
entry
->
doc
);
}
else
{
heap_free
(
entry
);
entry
=
NULL
;
}
xmlSchemaFreeParserCtxt
(
spctx
);
}
else
{
FIXME
(
"schema for nsURI %s not found
\n
"
,
wine_dbgstr_a
(
url
));
heap_free
(
entry
);
entry
=
NULL
;
}
return
entry
;
}
static
cache_entry
*
cache_entry_from_xsd_doc
(
xmlDocPtr
doc
,
xmlChar
const
*
nsURI
)
{
cache_entry
*
entry
=
heap_alloc
(
sizeof
(
cache_entry
));
...
...
@@ -914,6 +882,55 @@ static cache_entry* cache_entry_from_xdr_doc(xmlDocPtr doc, xmlChar const* nsURI
return
entry
;
}
static
cache_entry
*
cache_entry_from_url
(
VARIANT
url
,
xmlChar
const
*
nsURI
)
{
cache_entry
*
entry
;
IXMLDOMDocument3
*
domdoc
=
NULL
;
xmlDocPtr
doc
=
NULL
;
HRESULT
hr
=
DOMDocument_create
(
&
CLSID_DOMDocument
,
NULL
,
(
void
**
)
&
domdoc
);
VARIANT_BOOL
b
=
VARIANT_FALSE
;
SCHEMA_TYPE
type
=
SCHEMA_TYPE_INVALID
;
if
(
hr
!=
S_OK
)
{
FIXME
(
"failed to create domdoc
\n
"
);
return
NULL
;
}
assert
(
domdoc
!=
NULL
);
assert
(
V_VT
(
&
url
)
==
VT_BSTR
);
hr
=
IXMLDOMDocument3_load
(
domdoc
,
url
,
&
b
);
if
(
hr
!=
S_OK
)
{
ERR
(
"IXMLDOMDocument3_load() returned 0x%08x
\n
"
,
hr
);
if
(
b
!=
VARIANT_TRUE
)
{
FIXME
(
"Failed to load doc at %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
url
)));
IXMLDOMDocument3_Release
(
domdoc
);
return
NULL
;
}
}
doc
=
xmlNodePtr_from_domnode
((
IXMLDOMNode
*
)
domdoc
,
XML_DOCUMENT_NODE
)
->
doc
;
type
=
schema_type_from_xmlDocPtr
(
doc
);
switch
(
type
)
{
case
SCHEMA_TYPE_XSD
:
entry
=
cache_entry_from_xsd_doc
(
doc
,
nsURI
);
break
;
case
SCHEMA_TYPE_XDR
:
entry
=
cache_entry_from_xdr_doc
(
doc
,
nsURI
);
break
;
case
SCHEMA_TYPE_INVALID
:
entry
=
NULL
;
FIXME
(
"invalid schema
\n
"
);
break
;
}
IXMLDOMDocument3_Release
(
domdoc
);
return
entry
;
}
static
HRESULT
WINAPI
schema_cache_QueryInterface
(
IXMLDOMSchemaCollection2
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
{
...
...
@@ -1056,9 +1073,7 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri
case
VT_BSTR
:
{
xmlChar
*
url
=
xmlChar_from_wchar
(
V_BSTR
(
&
var
));
cache_entry
*
entry
=
cache_entry_from_url
((
char
const
*
)
url
,
name
);
heap_free
(
url
);
cache_entry
*
entry
=
cache_entry_from_url
(
var
,
name
);
if
(
entry
)
{
...
...
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