Hi Luis

Its our intention to use Sun's MSV library (Multi Schema Validator) library
to allow validation of existing dom4j documents. MSV claims to support DTD,
XML Schema, Relax NG (my current favourite) as well as the old Relax Core &
TREX.

I tried to use MSV recently but hit a few problems that I've mailed the
author, Kohsuke Kawaguchi, about. Hopefully one day soon MSV will be working
fine and we'll be able to add some helper classes or methods to dom4j to
facilitate easy validation of existing dom4j documents using all the common
validation languages.

Until MSV is working properly I think Xerces is the best alternative.

James
----- Original Message -----
From: "Luis Peña" <[EMAIL PROTECTED]>
To: "'James Strachan'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, August 28, 2001 8:37 AM
Subject: RE: [dom4j-dev] Processing XMLSchema with Dom4j


> Thanks James,
>
> Your help is very useful, I'll work with it. But you are right when you
> asked about the use of the DataTypes, let me explain it:
>
> * The main objetive, of the mini-project I'm working at, is to validate
> changes in EJBs Elements that represents information that must respect a
XML
> Schema structure. The validation that I must do is, for example, if a
> Element A has a min-maxOccurs limit of Element B children and I add an
> Element B I have to validate this adding; another example, if I add an
> Element that has required Attributes I must validate it.
>
> So I don't need to validate XML, I need to validate date that must have a
> formal structure that came from a XML Schema.
>
> * Now we are working with internal methods of Xerces, but this is
> troublesome for maintainance.
>
> Again, thank you for your help.
>
> regards.
>
> -----Mensaje original-----
> De: James Strachan [mailto:[EMAIL PROTECTED]]
> Enviado el: martes, 28 de agosto de 2001 9:01
> Para: Luis Peña; [EMAIL PROTECTED]
> Asunto: Re: [dom4j-dev] Processing XMLSchema with Dom4j
>
>
> Hi Luis
>
> Right now there is no simple way to find all the DataType instances for a
> document. The current implementation works like this:-
>
> * a schema is loaded explicitly using SchemaDocumentFactory.loadSchema()
or
> via the presence of a noNamespaceSchemaLocation attribute. (the
> schemaLocation attribute should be supported shortly).
>
> * a DocumentFactory usually caches QName instances. A QName instance can
> have its own DocumentFactory instance associated with it. This is useful
for
> using a schema based factory approach - using different DocumentFactory
> instances for different named elements.
>
> * The SchemaDocumentFactory associates SchemaElementFactory instances with
> QNames found in the schema which understand the DataType requirements. A
> single SchemaElementFactory knows the data types for the attributes and
> child elements it contains.
>
> * whenever you call getData() or setData() on a Attribute or Element from
> the schema it will use the correct DataType instance to turn the object
into
> a String or a primitive data type (java.lang.Number etc.).
>
> Now I'm sure we can add the necessary code to SchemaDocumentFactory to
> extract the information you need. As a step along the way, I've added a
> helper method to DocumentFactory called
>
>     List getQNames();
>
> which returns a List of all the QName instances used by a DocumentFactory.
> This method is in CVS and the current daily build.
>
> Itereating through this list we can find all the QNames and from there
find
> all the SchemaElementFactory instances used - and so create some data
> structure of all the DataTypes used in a SchemaDocumentFactory.
>
> Does this help any? How would you like to know what the data types are? Do
> you just want all the DataTypes used or do you want them associated with
> attribute or element QNames?
>
>
> Incidentally, in the next few days the org.dom4j.schema package will move
to
> the org.dom4j.datatype package. So the classes will be called
> DatatypeDocumentFactory and DatatypeElementFactory rather than the Schema*
> equivalent.
>
> James
> ----- Original Message -----
> From: "Luis Peña" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 27, 2001 8:45 AM
> Subject: [dom4j-dev] Processing XMLSchema with Dom4j
>
>
> Hello,
>
> I want to know how can I parse a xsd document and obtain all the DataTypes
> (com.sun.tranquilo.datatype.DataType) that its contains?
>
> I was trying it with SchemaDocumentFactory but I really don't know how to
do
> it.
>
> Thank you.
>
> =====================
> Luis Peña Sánchez
> A.Q.S.
> C/ Jorge Juan, 30, 6º. MADRID
>
> [EMAIL PROTECTED]
> =====================
>
>
> _______________________________________________
> dom4j-dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dom4j-dev
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to