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
bf11a93b
Commit
bf11a93b
authored
Nov 01, 2010
by
Adam Martinson
Committed by
Alexandre Julliard
Nov 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Add a function to validate a tree against a schema cache.
parent
be4d0e9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
+80
-0
msxml_private.h
dlls/msxml3/msxml_private.h
+1
-0
schema.c
dlls/msxml3/schema.c
+79
-0
No files found.
dlls/msxml3/msxml_private.h
View file @
bf11a93b
...
...
@@ -197,6 +197,7 @@ extern HRESULT node_get_prefix(xmlnode*,BSTR*);
extern
HRESULT
node_get_base_name
(
xmlnode
*
,
BSTR
*
);
extern
HRESULT
DOMDocument_create_from_xmldoc
(
xmlDocPtr
xmldoc
,
IXMLDOMDocument3
**
document
);
extern
HRESULT
SchemaCache_validate_tree
(
IXMLDOMSchemaCollection2
*
iface
,
xmlNodePtr
tree
);
static
inline
BSTR
bstr_from_xmlChar
(
const
xmlChar
*
str
)
{
...
...
dlls/msxml3/schema.c
View file @
bf11a93b
...
...
@@ -611,6 +611,85 @@ static const struct IXMLDOMSchemaCollection2Vtbl schema_cache_vtbl =
schema_cache_getDeclaration
};
static
void
LIBXML2_LOG_CALLBACK
validate_error
(
void
*
ctx
,
char
const
*
msg
,
...)
{
va_list
ap
;
va_start
(
ap
,
msg
);
LIBXML2_CALLBACK_ERR
(
SchemaCache_validate_tree
,
msg
,
ap
);
va_end
(
ap
);
}
static
void
LIBXML2_LOG_CALLBACK
validate_warning
(
void
*
ctx
,
char
const
*
msg
,
...)
{
va_list
ap
;
va_start
(
ap
,
msg
);
LIBXML2_CALLBACK_WARN
(
SchemaCache_validate_tree
,
msg
,
ap
);
va_end
(
ap
);
}
#ifdef HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS
static
void
validate_serror
(
void
*
ctx
,
xmlErrorPtr
err
)
{
LIBXML2_CALLBACK_SERROR
(
SchemaCache_validate_tree
,
err
);
}
#endif
HRESULT
SchemaCache_validate_tree
(
IXMLDOMSchemaCollection2
*
iface
,
xmlNodePtr
tree
)
{
schema_cache
*
This
=
impl_from_IXMLDOMSchemaCollection2
(
iface
);
cache_entry
*
entry
;
xmlChar
const
*
ns
=
NULL
;
TRACE
(
"(%p, %p)
\n
"
,
This
,
tree
);
if
(
!
tree
)
return
E_POINTER
;
if
((
xmlNodePtr
)
tree
->
doc
==
tree
)
{
xmlNodePtr
root
=
xmlDocGetRootElement
(
tree
->
doc
);
if
(
root
&&
root
->
ns
)
ns
=
root
->
ns
->
href
;
}
else
if
(
tree
->
ns
)
{
ns
=
tree
->
ns
->
href
;
}
entry
=
xmlHashLookup
(
This
->
cache
,
ns
);
/* TODO: if the ns is not in the cache, and it's a URL,
* do we try to load from that? */
if
(
entry
)
{
if
(
entry
->
type
==
SCHEMA_TYPE_XDR
)
{
FIXME
(
"partial stub: XDR schema support not implemented
\n
"
);
return
S_OK
;
}
else
if
(
entry
->
type
==
SCHEMA_TYPE_XSD
)
{
xmlSchemaValidCtxtPtr
svctx
;
int
err
;
/* TODO: if validateOnLoad property is false,
* we probably need to validate the schema here. */
svctx
=
xmlSchemaNewValidCtxt
(
entry
->
schema
);
xmlSchemaSetValidErrors
(
svctx
,
validate_error
,
validate_warning
,
NULL
);
#ifdef HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS
xmlSchemaSetValidStructuredErrors
(
svctx
,
validate_serror
,
NULL
);
#endif
if
((
xmlNodePtr
)
tree
->
doc
==
tree
)
err
=
xmlSchemaValidateDoc
(
svctx
,
(
xmlDocPtr
)
tree
);
else
err
=
xmlSchemaValidateOneElement
(
svctx
,
tree
);
xmlSchemaFreeValidCtxt
(
svctx
);
return
err
?
S_FALSE
:
S_OK
;
}
}
return
E_FAIL
;
}
HRESULT
SchemaCache_create
(
IUnknown
*
pUnkOuter
,
void
**
ppObj
)
{
schema_cache
*
This
=
heap_alloc
(
sizeof
(
schema_cache
));
...
...
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