Gotcha. Indeed it works with a built in DTD but would be nice to have the lookup-id-table.
Thanks, reb.
==
A goal is not always meant to be reached, it often serves simply as something to aim at. Bruce Lee
From: Rolf Ade <rolf@...> To: tdom@yahoogroups.com Sent: Friday, March 6, 2009 10:22:54 AM Subject: Re: [tdom] Re: Uset tdom from C
rebosher wrote:
> getElementById doesn't work for me.
>
> $nodeObj find "id" "idname" will get the right tag.
>
> Does getElementById needs a DTD validation? How about a schema (xsd)?
No, it doesn't need DTD validation, but of course a parsed DTD. (Note
the 'parsed', that's a hint in case you've an external DTD subset.)
This is needed because the parser needs to know which attributes are
of the attribute type ID. The name of the attribute is completely
irrelevant, its the attribute type, which makes it to an ID attribute.
Without a DTD, getElementById returns always the empty string. Provide
the correct DTD and it works pretty well.
No, there isn't xsd support.
Note, that the html parser does fill the internal lookup table used by
getElementById if it sees an attribute with the name "id" (in recent
tDOM).
If you know the name of the ID attribue, you could always get the node
with (say, the attribute name is 'id')
$doc selectNodes //*[@id='your_ id_value_ here']
though that is much lesser efficient that getElementById (with a DTD
in place), because the first does a complete tree scan and the later
uses a lookup hash table.
If you need several lookups (and still want/could not provid a DTD)
you could easily build your own lookup table at script level.
Hello, Normally, it is better to use tdom from tcl, but sometimes, for eficiency reasons, it could be interesting to use it from C. I think that it would be a...
ramsan100
ramsan@...
Jul 10, 2003 11:03 am
... I'm far from being an expert on this (like Rolf and/or Jochen are) but AFAIK, DOM tree functions are exported and there is already an DOM C-API (look into...
Right, dom.c (see dom.h) provides standard DOM inferface (here C functions). Similar, domxpat.h and domxlst.h provide XPATH and XSLT processing functions ...
getElementById doesn't work for me. $nodeObj find "id" "idname" will get the right tag. Does getElementById needs a DTD validation? How about a schema (xsd)?...
... No, it doesn't need DTD validation, but of course a parsed DTD. (Note the 'parsed', that's a hint in case you've an external DTD subset.) This is needed...
Rolf Ade
rolf@...
Mar 6, 2009 3:23 pm
Gotcha. Indeed it works with a built in DTD but would be nice to have the lookup-id-table. Thanks, reb. ==A goal is not always meant to be reached, it often...
... Well, it also works with an external DTD, if you prefer that. In that case, you've to provide an -externalentitycommand as URI resolver. In other words,...
Rolf Ade
rolf@...
Mar 6, 2009 11:50 pm
The DTD is alright as a hydra for the XML data-structure. But we often times skip it in our amateurish approach to data and yet have it as well formed...
... I'm not sure, I understand the question. Do you ask for DTD validation? If yes, look at the tnc extension (which is bundled with the distribution). ... I...