[jdom-interest] Validation with jdom?

Kohler, Holger Holger.Kohler at dsto.defence.gov.au
Wed Jul 25 19:37:22 PDT 2001


Hello,

I tried to get validation to work with jdom-b7 and Xerces-J 1.4.1 and
failed. I'm assuming from your email that you used the xerces.jar included
with the jdom-b7 install. Has anyone successfully used a schema based on the
2-May-2001 spec? eg:

    <?xml version="1.0" encoding="UTF-8" ?>
    <eBrief xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="schema_url_or_file.xsd">
    ...

Holger Kohler

-----Original Message-----
From: Miguel Angel Medina Lopez [mailto:mamedina at logic-factory.com]
Sent: Saturday, 30 June 2001 6:23 PM
To: Brett McLaughlin; jdom-interest at jdom.org
Subject: Re: [jdom-interest] Validation with jdom?


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
>

_______________________________________________
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