Hi Christian,

Thank you for your reply.

Christian Schuhegger wrote:

> Your proposal to expose the validated values in the ItemPSVI classes
> sounds like a very good idea to me. Perhaps it is possible to extend the
> internal data representation classes like the XDecimal to return actual
> Java object representations of the basic types in parallel to extend the
> ItemPSVI interfaces?

I believe the ItemPSVI interface should have only one method that
returns an Object representing the actual value. Given that, you will
need to have bunch of instanceof checks in your code to be able to cast
to the internal Xerces representation, i.e. XDecimal, and then get a
Java decimal (a method could be defined on XDecimal). Are you fine with
this solution?

There are couple of alternative solutions, so if you want to discuss it
lets do it on the xerces-j-dev mailing list.


> While I am just writing this e-mail I would also like to ask if there is
> a way to perform partial validation of XML documents? I mean, I have
> only seen a normalizeDocument() method on the Document class, but what I
> would like to be able to do is to validate parts of a document below the
> document root, too. Is there a way to achieve that? Or is this feature
> perhaps planned for a future release?

See email below.

Thank you,
-- 
Elena Litani / IBM Toronto


-------- Original Message --------
Subject: Re: How to validate an element rather than the whole xml
document
Date: Thu, 25 Sep 2003 11:40:46 -0400
From: Elena Litani <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
References: <[EMAIL PROTECTED]>

> I need to validate an element aganist schema rather than the 
> whole document.

Currently, it is not possible to revalidate a singe element within the
DOM tree. 
The best way of achieving what you want is using DOM Level 3
normalizeDocument that allows to revalidate a document in memory [1].
You can setup the schema on the <key> element using xsi:schemaLocation
attributes and register your own error handler that will ignore errors
for <SOAPENV:Envelope>, <SOAPBODY:Body> elements (the validator will
complain that declaration for those is not found). 

If you really want to revalidate a single node.. you can create a new
document, use adoptNode to move a single element you want to revalidate
to a new document, use DOM L3 normalizeDocument on the new document to
revalidate just that single node. Then, if needed, you can use adoptNode
again to move back the element to the original document.

 
[1] http://xml.apache.org/xerces2-j/faq-dom.html#faq-7

Hope it helps,
-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
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]

Reply via email to