Hello Aleksander, Hmm, yes, I guess you're right using the element as DocumentElement. Hadn't thought about it like that. This still leaves me with the problem of validating types though.
Tools like the excellent Castor require one to know the Schema at compile time, unfortunately. Cheers, Jos On Fri, 19 Nov 2004 10:24:55 -0800, Aleksandar Milanovic <[EMAIL PROTECTED]> wrote: > Jos, > > If your element is global, why do you need that additional document element? > Why not make your element a document element? > > Validation can also be done using data binding tools such as Castor. > > > > Alex > > Quoting Jos van den Oever <[EMAIL PROTECTED]>: > > > Hello Aleksander, > > > > Actually, what I'm doing is using elements in a DOM with a substitute > > and meaningless Document and DocumentElement. I'm doing this because > > WSDL specifies the datatypes on the level of element or Schema type. > > One of the problems however is that the DocumentElement can be > > validated too. If it's restriction says it needs an <a/> and a <b/> > > element, then the document will not validate without both. For simple > > situations, I could add a dummy element, but this is not possible with > > more comples Schemas. > > > > You are right about the local definitions. I am talking about global > > elements and global types. Very simple example: how can I validate an > > attribute as a 'xs:float'? Beforehand I know not what Schema I will > > get and what data. The data I get happens to be (or should be) type > > 'xs:float' according to the dynamically loaded Schema. How do I > > validate it? > > > > Cheers, Jos > > > > > > On Fri, 19 Nov 2004 09:50:12 -0800, Aleksandar Milanovic > > <[EMAIL PROTECTED]> wrote: > > > I know of a work-around. If the element is global, you can create a new > > copy > > > of that element and its child elements by using importNode and then append > > the > > > new copy to a new document which you can validate. > > > > > > If the element is locally defined, then I think that validation is > > meaningless > > > because the local element has no meaning without its context. > > > > > > Take my words with caution though. I am not an XML Schema expert. > > > > > > Alex > > > > > > > > > > > > Quoting Jos van den Oever <[EMAIL PROTECTED]>: > > > > > > > Hello Ramin, > > > > > > > > I have to deal with XML Schema's that are defined elsewhere. > > > > > > > > Imagine a document with two required elements <a/> and <b/>. I don't > > > > have <a/> but only <b/>. Now I want to now if <b/> is valid, even > > > > though the complete document is not valid, because <a/> lacks. > > > > > > > > If XSModel wasn't readonly, I could make a ripped version of a given > > > > Schema and use that for validation. It wouldn't be very > > > > straightforward though. > > > > > > > > Cheers, Jos > > > > > > > > On Fri, 19 Nov 2004 12:03:16 -0500, [EMAIL PROTECTED] > > > > <[EMAIL PROTECTED]> wrote: > > > > > > > > > > In your XML schema, just define the rule for that one element. > > > > > > > > > > Cheers, > > > > > -ramin > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "Jos van den Oever" <[EMAIL PROTECTED]> > > > > > > > > > > 11/19/2004 11:59 AM > > > > > > > > > > Please respond to > > > > > [EMAIL PROTECTED]; Please respond to > > > > > "Jos van den Oever" <[EMAIL PROTECTED]> > > > > > > > > > > > > > > > To [EMAIL PROTECTED] > > > > > > > > > > cc > > > > > > > > > > Subject validate a single element > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hello all, > > > > > > > > > > Is it possible to validate only parts of an XML document with Xerces? > > This > > > > > > > > > would be useful in Web Services were data typing is done by > > > > > specifying > > XML > > > > > > > > > Schema single types or elements. > > > > > > > > > > Cheers, Jos > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]