[jdom-interest] XML Schema Validation

Olivier Coppel olivier.coppel at akazi.com
Tue Oct 1 07:19:45 PDT 2002


There is 2 ways to do that :

1. You can validate your document by adding some informations into your root
element of XML file (you specify the schema name into "xsi:schemaLocation"
attribute). For example :
<myrootelement xsi:schemaLocation="http://mynamespace myschema.xsd"/>.
All informations are contained into your XML file and you just have to set
in your code parser validation to "true" : parser.setValidation(true);
2. You can do all this steps by program. In this case, you don't have to
specify in your XML file the name of XSD schema. You specify the XSD schema
in your program by setting parser property. For example :
 parser.setProperty( XERCES_PROPERTIE_SCHEMA_LOCATION, propertieValue );
PropertyValue is the name of namespace and XSD schema. In this case the
namespace in you program must match targetNamespace of your XML file (Be
careful : it depends on JDOM version and parser you used)

Choose the good way for you. I've tried the 2 ways but I choose second way
because I don't want tthat the name of schema appears in XML file.

If you want more informations, send me a mail.

Bye

Olivier Coppel
mailto:olivier.coppel at akazi.com




> -----Message d'origine-----
> De : jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]De la part de
> Kevin.Bedell at sunlife.com
> Envoye : mardi 1 octobre 2002 14:48
> A : jdom-interest at jdom.org
> Objet : [jdom-interest] XML Schema Validation
>
>
>
>
> Can someone decsribe briefly the basic steps for validating XML using an
> XML Schema with JDOM?
>
> ------------------------------------------------------------------
> ---------
> This e-mail message (including attachments, if any) is intended
> for the use
> of the individual or entity to which it is addressed and may contain
> information that is privileged, proprietary , confidential and exempt from
> disclosure.  If you are not the intended recipient, you are notified that
> any dissemination, distribution or copying of this communication is
> strictly prohibited.  If you have received this communication in error,
> please notify the sender and erase this e-mail message immediately.
> ------------------------------------------------------------------
> ---------
>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yourad
> dr at yourhost.com
>




More information about the jdom-interest mailing list