Re: [xml] validating node attributes against a DTD

On Tue, Feb 14, 2006 at 01:46:37PM -0800, Osawa, Daniel K wrote:

I need to remove invalid attributes from my XML tree and would like to
use the following function:
int xmlValidateAttributeDecl (xmlValidCtxtPtr ctxt, 
xmlDocPtr doc, 
xmlAttributePtr attr)

  You're confused, this is used to validate an 
declaration in a DTD. an xmlAttributePtr is not a pointer to an
attribute on an element but a pointer to an attribute declaration
on a DTD.

I have the xmlValidCtxtPtr, xmlDocPtr, and an xmlNodePtr at my disposal.
I would like to iterate through the list of xmlAttrPtrs provided by the
xmlNodePtr, and run xmlValidateAttributeDecl on each attribute so that I
can remove any invalid attributes I come across.  

  The function doing some of it is xmlValidateOneAttribute(), but attribute
validity also mean that all required attributes must be present and that
won't cover it.


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]