Re: [xml] DTD Mania



On Thu, May 10, 2001 at 02:57:58PM -0400, David Allen wrote:
Apologies if this is a repeat.  I've been having problems with my mail
server, I sent this before, and never got it back.  

  well it did.

On Wed, May 09, 2001 at 06:06:40PM -0400, Daniel Veillard wrote:
On Wed, May 09, 2001 at 05:40:29PM -0400, David Allen wrote:
- Say I'm dealing with "baz.xml" and "foobar.dtd".  I encounter the
  "blargens" tag, how can I look into the DTD structure to get a list
  of tags which are valid children of "blargens"?  I'm not looking at
  rewriting the validation, but getting a list of what's valid in
  certain contexts for creating XML documents from nothing according
  to the rules of validity.

   This is defined in the valid.c module:
     http://xmlsoft.org/html/libxml-valid.html#XMLVALIDGETVALIDELEMENTS
     xmlValidGetValidElements ()

This doesn't seem like it's going to work.  The documentation says to
use xmlValidGetValidElements(NULL, node->childs, ...) in order to
prepend an element underneath 'node', and to use
xmlValidGetValidElements(node->last, NULL, ...) to append an element
underneath 'node'.

The problem is that if node has no children, then both node->childs
and node->last will be NULL, right?  If the first two args to the
function are NULL, then it always returns -1 (error).

Am I missing something or does this function work only in the case
where you already have child elements?

  yep seems this function don't allow this ... But the next function
Just below the one I pointed to seems to do exactly this !

  xmlValidGetPotentialChildren ()
  http://xmlsoft.org/html/libxml-valid.html#XMLVALIDGETPOTENTIALCHILDREN
  Build/extend a list of potential children allowed by the content tree

    you really don't want to read the doc ?

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
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]