[JDEV] *Real* element.h usage doc

Jeremie jer at jeremie.com
Sun May 2 11:24:35 CDT 1999


Everything else looks happy, here's a quickie note:

> Since it is fairly common to have tags which only have one unbroken
> CDATA section, a shortcut method is provided that retrieves the CDATA
> in one call:
> 
> 	char* nickname = element_get_child_cdata(root_tag, "nick"); 
> 	/* nickname == "mellow" */
> 
> This searches the root_tag for an element by the name of "nick" and
> sees if it (the element named "nick") has a CDATA as the first child. 

Just as an FYI:

	<tag>this is some text</tag>

Can(and often does) get parsed by Expat into:

	Element "tag"
		CDATA "this is som"
		CDATA "e "
		CDATA "text"

It will break a string into multiple CDATA sections, this is just a normal
part of sream-based XML processing...

All it requires is for element_get_child_cdata() to have a bit more smarts
:)

Jer




More information about the JDev mailing list