[Zope] XMLDocument mess
Curtis Maloney
curtis@umd.com.au
Thu, 13 Apr 2000 10:48:41 +1000
On Wed, 12 Apr 2000, Serge Stinckwich wrote:
> Hi all,
>
> i'm a bit confused with the behavior of the XMLDocument product.
>
> I have a very simple XML Document : test
>
> <?xml version="1.0"?>
> <doc>
> <p> bla bla ...</p>
> <p> bla bla ...</p>
> </doc>
>
> I've got also a DTML method view_test :
>
> <dtml-var standard_html_header>
> <h2><dtml-var title_or_id> <dtml-var document_title></h2>
>
> <dtml-with "test[0]">
>
> <dtml-in "getChildNodes()">
> <p><dtml-var absolute_url></p>
> </dtml-in>
>
> </dtml-with>
> <dtml-var standard_html_footer>
>
> I launch the view method and i expect to have 2 URLs, i've got 5 with 3 non-existent nodes ...
>
> I use the last version of XMLDocument.
>
I ran into something that might explain this when i was messing about with
XMLDocument and the tree tag.
One of the ways in which XML differs from SGML is that the whitespace between
tags IS counted. So, if you check the meta types of the objects you're
getting, you'll probably see 3 of them are the formatting space between your
tags.
Instead of getChildNodes(), try objectValues('p'), which will only return tags
of type 'p'. I use this in my current production code, and it works fine.
--
Have a better one,
Curtis.
<dtml-var standard_work_disclaimer>