Re: [xml] xmlValidateOneElement - will fill-in defaults yes?

On Mon, Apr 23, 2007 at 03:24:38PM -0700, Rick Jones wrote:
Another chapter in my sputtering netperf4 development :)

I want to enable the users of netperf4 to build-up a configuration from 
an interactive netperf4 session without having to go-out and run an 
external XML editor to create config files.  To that end, I want to be 
adding elements to a config doc for which I have a DTD.  I don't want 
the netperf4 main code to be _particularly_ aware of all the attributes 
etc for elements so it can still manipulate added test types.

So, if I add a node (eg "test" in netperf DTD entity names FWIW) and if 
I call xmlValidateOneElement() against that node, will all the defaults 
from the DTD get filled-in automagically?

  Hum, no. Validation will not change the document, if it was doing that
I would get killed immediatly by angry users...
  I don't think we have at the tree level a way to automatically add
defaulted attributes, this is something usually done at parsing time.
  You may be interested in

 to get the list of defaulted attributes and their value
and then walk the xmlAttributePtr attributes list and check defaultValue.

ultimately, I'll want to do something similar involving a GTK gui but 
one step at a time...

  you could look at MlView for inspiration ...
but honnestly a generic editor is a daunting task, believe me !


Red Hat Virtualization group
Daniel Veillard      | virtualization library
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]