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



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

My mistake - merging too much into a validated parsing and forgetting it was more the parsing than the validating.

  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.

I will look into that.

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 !

It certainly seems that way :) I _can_ count on requiring someone to make suitable mods to a DTD if they extend my netperf markup language (as it were) so I guess that helps a little.

rick jones



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