You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by sade <ya...@yahoo.com> on 2007/04/02 09:50:07 UTC

Forcing schema checking (and ignore what's written in XML)

Hello,

My server gets an XML as inputs from its clients. Part
of the security checks are schema validations (to see
that the XML is valid).

Therefore, I need a to perform schema regardless what
is written in teh document.

What I did is the following:

1. Loaded a cacheed schema via parser.LoadSchema()
2. Set an external schema location

Doing that helped me to verify the XML only if it
explicitly includes the namespace and schema (xmlns,
xsi:schemaLocation).

>From security reasons I would like to ignore any
namespace/schemaLocation that was specified in teh XML
and use only my pre-defined XSD.

Does anyone has any suggestions? 
How can I tell Xerces-C to ignore the
namespaceds/schemas that are writtens in the XML and
use pre-determined ones?

regaeds,
Yair



 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

Re: Forcing schema checking (and ignore what's written in XML)

Posted by sade <ya...@yahoo.com>.
Hi Alberto,

That exactly what I did, however if a reference to a
schema exists in the XML file Xerces will also try to
resolve it.

How can I tell Xerces to ignore any schema reference
that is written in the XML and use only the
external-schema?

Thanks,
Yair
--- Alberto Massari <am...@datadirect.com> wrote:

> Hi Yair,
> You should use
>
setExternalSchemaLocation/setExternalNoNamespaceSchemaLocation
> 
> Alberto
> 
> At 00.50 02/04/2007 -0700, sade wrote:
> >Hello,
> >
> >My server gets an XML as inputs from its clients.
> Part
> >of the security checks are schema validations (to
> see
> >that the XML is valid).
> >
> >Therefore, I need a to perform schema regardless
> what
> >is written in teh document.
> >
> >What I did is the following:
> >
> >1. Loaded a cacheed schema via parser.LoadSchema()
> >2. Set an external schema location
> >
> >Doing that helped me to verify the XML only if it
> >explicitly includes the namespace and schema
> (xmlns,
> >xsi:schemaLocation).
> >
> > From security reasons I would like to ignore any
> >namespace/schemaLocation that was specified in teh
> XML
> >and use only my pre-defined XSD.
> >
> >Does anyone has any suggestions?
> >How can I tell Xerces-C to ignore the
> >namespaceds/schemas that are writtens in the XML
> and
> >use pre-determined ones?
> >
> >regaeds,
> >Yair
> 
> 




 
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

Re: Forcing schema checking (and ignore what's written in XML)

Posted by Alberto Massari <am...@datadirect.com>.
Hi Yair,
You should use setExternalSchemaLocation/setExternalNoNamespaceSchemaLocation

Alberto

At 00.50 02/04/2007 -0700, sade wrote:
>Hello,
>
>My server gets an XML as inputs from its clients. Part
>of the security checks are schema validations (to see
>that the XML is valid).
>
>Therefore, I need a to perform schema regardless what
>is written in teh document.
>
>What I did is the following:
>
>1. Loaded a cacheed schema via parser.LoadSchema()
>2. Set an external schema location
>
>Doing that helped me to verify the XML only if it
>explicitly includes the namespace and schema (xmlns,
>xsi:schemaLocation).
>
> From security reasons I would like to ignore any
>namespace/schemaLocation that was specified in teh XML
>and use only my pre-defined XSD.
>
>Does anyone has any suggestions?
>How can I tell Xerces-C to ignore the
>namespaceds/schemas that are writtens in the XML and
>use pre-determined ones?
>
>regaeds,
>Yair