Re: [xml] xmlValidateOneElement - will fill-in defaults yes?
- From: Daniel Veillard <veillard redhat com>
- To: Rick Jones <rick jones2 hp com>
- Cc: xml gnome org
- Subject: Re: [xml] xmlValidateOneElement - will fill-in defaults yes?
- Date: Tue, 24 Apr 2007 03:41:32 -0400
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
http://xmlsoft.org/html/libxml-valid.html#xmlValidGetPotentialChildren
and
http://xmlsoft.org/html/libxml-valid.html#xmlValidGetValidElements
to get the list of defaulted attributes and their value
http://xmlsoft.org/html/libxml-valid.html#xmlGetDtdQElementDesc
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 ...
http://www.freespiders.org/projects/gmlview/
but honnestly a generic editor is a daunting task, believe me !
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]