You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Bagepalli, Kiran" <kb...@informatica.com> on 2003/03/25 00:33:50 UTC
Validating DOM
Is there a way for me to validate the DOM content while building.
Essentially I am interested in element and attribute content only. Does the
value for the elements adhere to the schema. Things like default
values/restrictive datatypes etc. Is there anyway I could get to a
XMLElementDecl and call a validate given a value string.
I do not want to validate at the end and say the whole document is not
valid. I want to say it is not valid while building.
I am not interested in the complicated content spec but atleast the values
should be correct.
Thanks
Kiran
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Validating DOM
Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hey Kiran,
If you are just interested in validating simple types then this is
possible. Form the schema grammar you can do something like:
DatatypeValidatorFactory *dtvf = _schemaGrammar->getDatatypeRegistry();
then you can look DatatypeValidators up by:
DatatypeValidator *dtv = dtvf->getDatatypeValidator(typeName);
where typeName is uri,typename (except int he case in inbuilt schema
types where it is just typename).
From this you can call dtv->validate(XMLChContent);
hope this helps.
Gareth
On Mon, 24 Mar 2003, Bagepalli, Kiran wrote:
> Is there a way for me to validate the DOM content while building.
> Essentially I am interested in element and attribute content only. Does the
> value for the elements adhere to the schema. Things like default
> values/restrictive datatypes etc. Is there anyway I could get to a
> XMLElementDecl and call a validate given a value string.
>
> I do not want to validate at the end and say the whole document is not
> valid. I want to say it is not valid while building.
> I am not interested in the complicated content spec but atleast the values
> should be correct.
>
> Thanks
> Kiran
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
--
Gareth Reakes, Head of Product Development +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Validating DOM
Posted by Erik Rydgren <er...@mandarinen.se>.
Xerces validates the document while parsing. So it does by default the thing
you ask for.
But if you need more validation then can be described in a schema then you
might try this.
Parse the file with SAX. The internal validator validates each element
against the schema before calling the SAX eventhandler.
In the eventhandler do your extended validations.
If valid, add the element to a document tree (hence build your own
DOMDocument with the standard DOMDocument API)
Regards
Erik Rydgren
Mandarinen systems AB
Sweden
-----Original Message-----
From: Bagepalli, Kiran [mailto:kbagepalli@informatica.com]
Sent: den 25 mars 2003 00:34
To: 'xerces-c-dev@xml.apache.org'
Subject: Validating DOM
Is there a way for me to validate the DOM content while building.
Essentially I am interested in element and attribute content only. Does the
value for the elements adhere to the schema. Things like default
values/restrictive datatypes etc. Is there anyway I could get to a
XMLElementDecl and call a validate given a value string.
I do not want to validate at the end and say the whole document is not
valid. I want to say it is not valid while building.
I am not interested in the complicated content spec but atleast the values
should be correct.
Thanks
Kiran
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org