You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Dalia, Keith A - TOS-DITT1" <ka...@bpa.gov> on 2001/02/23 18:53:31 UTC

xsd validation

I'm new to xerces.  I'm trying to validate an instance doc using xml-schema.

Am I on the right track:

DOMParser parser = new DOMParser();
        
        try
        {
            parser.setFeature("http://xml.org/sax/features/validation",
true);
            parser.parse("gi.xml");

            
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }


In my xml file I have added:
<?xml version = "1.0" encoding = "UTF-8"?>
<GenerationAccounts xmlns:xsi =
"http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation
= "GenInfo.xsd">

Per xerces documentation.

When I run the code it doesn't do anthing.

I just can't find enough documentation on it.


Keith


Re: xsd validation

Posted by Michael Duffy <du...@yahoo.com>.
Keith:

I had EXACTLY the same problem.  Look at the note from
Alex Neth dated 22-Feb-2001 and follow the JAXP API as
he laid it out and write an ErrorHandler for yourself.
 That will get you an exception if you give it an
invalid document. - MOD


--- "Dalia, Keith A - TOS-DITT1" <ka...@bpa.gov>
wrote:
> I'm new to xerces.  I'm trying to validate an
> instance doc using xml-schema.
> 
> Am I on the right track:
> 
> DOMParser parser = new DOMParser();
>         
>         try
>         {
>            
>
parser.setFeature("http://xml.org/sax/features/validation",
> true);
>             parser.parse("gi.xml");
> 
>             
>         }
>         catch (IOException ioe)
>         {
>             ioe.printStackTrace();
>         }
> 
> 
> In my xml file I have added:
> <?xml version = "1.0" encoding = "UTF-8"?>
> <GenerationAccounts xmlns:xsi =
> "http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation
> = "GenInfo.xsd">
> 
> Per xerces documentation.
> 
> When I run the code it doesn't do anthing.
> 
> I just can't find enough documentation on it.
> 
> 
> Keith
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-j-user-help@xml.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/