Call storeAtts() for all element start tags; this is necessary to
ensure attribute defaults are properly processed for all elements
(needed to do proper namespace checking, at the very least), and that
tag names are properly cooked when there's an end-element-handler but
no start-element-handler.
This causes the new tests to pass, and closes the SF tracker issue.
Error with xmlns:prefix= with namespace processing enabled.
It seems that storeAtts() has the following properties:
- when called with tagNamePtr = NULL and bindingsPtr = NULL,
it does not process attributes incl. namespace declarations
- when called with all arguments non-NULL it processes
attributes (incl. default attributes) and namespace declarations
We also have these requirements:
A) for start of element event:
1) if we have a startElementHandler:
we need to process at least default attributes,
so we must call storeAtts with all arguments non-NULL
2) if we have no startElementHandler, but we have attributes:
we need to process namespace declarations,
so we must call storeAtts with all arguments non-NULL
3) if we have no startElementHandler and no attributes:
we need to store the name (for the end element event, where
the names are compared) and call only the default handler
Note: Storing the name is a pre-requisiste for calling
storeAtts with all arguments non-NULL.
So there really is no place for calling storeAtts with
tagNamePtr = NULL and bindingsPtr = NULL.
B) for empty element event:
1) if we have a startElementHandler:
we need to process at least default attributes,
so we must call storeAtts with all arguments non-NULL
2) if we have no startElementHandler, but we have attributes:
we need to process namespace declarations,
so we must call storeAtts with all arguments non-NULL
3) if we have no startElementHandler and no attributes,
but we have an endElementHandler:
we need to store the name for calling the handler,
but we need not process any attributes (default or not)
4) if we have no start- or endElementHandler, and no attributes:
we need to call only the default handler
Given that storeAtts will now always be called with all arguments
non-NULL we could remove a few internal checks in storeAtts,
if that improves efficiency. Not sure if that is worth it.
This patch should therefore fix the problem of namespace declarations
not being processed when no startElementHandler is set, that is,
it will fix Jeremy's NS processing patch.
the default handler does not get called even when no element handlers
are called, because storeAtts() may trigger the startNamespaceDeclHandler
where the application has a chance to clear the element handlers.
This patch fixes this with one issue still open, which applies to empty elements only:
When the endElement handler is called, but not the startElementHandler,
then the default handler is not called, which causes attributes to not
be reported at all. The other alternative would be to call the default handler,
but then the element would be reported twice.
Implemented with two API additions:
1) For element declaration handler support:
XML_FreeContentModel
2) Exposing Expat's memory allocation functions:
XML_MemMalloc
XML_MemRealloc
XML_MemFree
* Changed macro for static linking from _STATIC to XML_STATIC
and modified expat.h accordingly
* Added ReadMe file to Win32 subdirectory documenting Windows builds
* Changed static build settings to create libraries with names different
from the Dll stub library libexpat(w).lib
behavior that all strings returned from Expat are affected by the XML_UNICODE
and XML_UNICODE_WCHAR_T feature-test macros, and ensure that an application
that needs to determine what type of character data is returned can do so
with reasonable ease.