[jdom-interest] Validation with jdom?

Miguel Angel Medina Lopez mamedina at logic-factory.com
Sat Jun 30 01:22:58 PDT 2001


Hi:
 I have tried the same example with the beta7 of JDOM and its work fine to
validate XML document against schemas.
 The code to validate is the next:

After you create a instante of SAXBuilder with validate to true, you must
indicate the schema in your XML file and the validation is automatic when
you call method buid of SAXBuilder object. You indicate the schema URL with
the nexy line at top of your XML document.

<?xml version="1.0"?>
<ROOT xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
                     xsi:noNamespaceSchemaLocation="schema_url_or_file.xsd">

If you create the document with the JDOM API methods, you must write the
next lines to include this attribute to the document:

        root = new Element("ROOT");
        root.addAttribute(new
Attribute("noNamespaceSchemaLocation","schema_url_or_file.xsd",Namespace.get
Namespace("xsi","http://www.w3.org/1999/XMLSchema-instance")));

        doc = new Document(root);

I hope this help you

-------------------------------------------------------------
Miguel Ángel Medina López
Logic Factory: www.logic-factory.com
Granada - España


----- Original Message -----
From: "Brett McLaughlin" <brett at newInstance.com>
To: <jdom-interest at jdom.org>
Sent: Friday, July 20, 2001 2:14 AM
Subject: Re: [jdom-interest] Validation with jdom?


> >  I validate xml document against schemas with JDOM. The next samples is
> with
> > beta6 and I don't know if work with beta 7.
>
> Can you try this with beta 7? There have been a lot of improvements.
>
> Thanks
>
> ---
> Brett McLaughlin
> Enhydra Strategist:   http://www.enhydra.org
> Lutris Technologies: http://www.lutris.com
> O'Reilly Author:       http://www.newInstance.com
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>




More information about the jdom-interest mailing list