msxml3: Add ISAXContentHandler_endPrefix event.
This commit is contained in:
parent
93f1d070fc
commit
03f7909709
@ -72,6 +72,9 @@ typedef struct _saxlocator
|
|||||||
int line;
|
int line;
|
||||||
int column;
|
int column;
|
||||||
BOOL vbInterface;
|
BOOL vbInterface;
|
||||||
|
int nsStackSize;
|
||||||
|
int nsStackLast;
|
||||||
|
int *nsStack;
|
||||||
} saxlocator;
|
} saxlocator;
|
||||||
|
|
||||||
typedef struct _saxattributes
|
typedef struct _saxattributes
|
||||||
@ -117,6 +120,29 @@ static inline saxattributes *impl_from_ISAXAttributes( ISAXAttributes *iface )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static HRESULT namespacePush(saxlocator *locator, int ns)
|
||||||
|
{
|
||||||
|
if(locator->nsStackLast>=locator->nsStackSize)
|
||||||
|
{
|
||||||
|
int *new_stack;
|
||||||
|
|
||||||
|
new_stack = HeapReAlloc(GetProcessHeap(), 0,
|
||||||
|
locator->nsStack, locator->nsStackSize*2);
|
||||||
|
if(!new_stack) return E_OUTOFMEMORY;
|
||||||
|
locator->nsStack = new_stack;
|
||||||
|
locator->nsStackSize *= 2;
|
||||||
|
}
|
||||||
|
locator->nsStack[locator->nsStackLast++] = ns;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int namespacePop(saxlocator *locator)
|
||||||
|
{
|
||||||
|
if(locator->nsStackLast == 0) return 0;
|
||||||
|
return locator->nsStack[--locator->nsStackLast];
|
||||||
|
}
|
||||||
|
|
||||||
static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
|
static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
|
||||||
{
|
{
|
||||||
DWORD dLen;
|
DWORD dLen;
|
||||||
@ -937,7 +963,9 @@ static void libxmlStartElementNS(
|
|||||||
|
|
||||||
update_position(This, (xmlChar*)This->pParserCtxt->input->cur+1);
|
update_position(This, (xmlChar*)This->pParserCtxt->input->cur+1);
|
||||||
|
|
||||||
if(This->saxreader->contentHandler)
|
hr = namespacePush(This, nb_namespaces);
|
||||||
|
|
||||||
|
if(hr==S_OK && This->saxreader->contentHandler)
|
||||||
{
|
{
|
||||||
for(index=0; index<nb_namespaces; index++)
|
for(index=0; index<nb_namespaces; index++)
|
||||||
{
|
{
|
||||||
@ -990,10 +1018,10 @@ static void libxmlStartElementNS(
|
|||||||
SysFreeString(NamespaceUri);
|
SysFreeString(NamespaceUri);
|
||||||
SysFreeString(LocalName);
|
SysFreeString(LocalName);
|
||||||
SysFreeString(QName);
|
SysFreeString(QName);
|
||||||
|
}
|
||||||
|
|
||||||
if(hr != S_OK)
|
if(hr != S_OK)
|
||||||
format_error_message_from_id(This, hr);
|
format_error_message_from_id(This, hr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void libxmlEndElementNS(
|
static void libxmlEndElementNS(
|
||||||
@ -1002,15 +1030,18 @@ static void libxmlEndElementNS(
|
|||||||
const xmlChar *prefix,
|
const xmlChar *prefix,
|
||||||
const xmlChar *URI)
|
const xmlChar *URI)
|
||||||
{
|
{
|
||||||
BSTR NamespaceUri, LocalName, QName;
|
BSTR NamespaceUri, LocalName, QName, Prefix;
|
||||||
saxlocator *This = ctx;
|
saxlocator *This = ctx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
xmlChar *end;
|
xmlChar *end;
|
||||||
|
int nsNr, index;
|
||||||
|
|
||||||
end = This->lastCur;
|
end = This->lastCur;
|
||||||
while(*end != '<' && *(end+1) != '/') end++;
|
while(*end != '<' && *(end+1) != '/') end++;
|
||||||
update_position(This, end+2);
|
update_position(This, end+2);
|
||||||
|
|
||||||
|
nsNr = namespacePop(This);
|
||||||
|
|
||||||
if(This->saxreader->contentHandler)
|
if(This->saxreader->contentHandler)
|
||||||
{
|
{
|
||||||
NamespaceUri = bstr_from_xmlChar(URI);
|
NamespaceUri = bstr_from_xmlChar(URI);
|
||||||
@ -1033,7 +1064,26 @@ static void libxmlEndElementNS(
|
|||||||
SysFreeString(QName);
|
SysFreeString(QName);
|
||||||
|
|
||||||
if(hr != S_OK)
|
if(hr != S_OK)
|
||||||
|
{
|
||||||
format_error_message_from_id(This, hr);
|
format_error_message_from_id(This, hr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(index=This->pParserCtxt->nsNr-2;
|
||||||
|
index>=This->pParserCtxt->nsNr-nsNr*2; index-=2)
|
||||||
|
{
|
||||||
|
Prefix = bstr_from_xmlChar(This->pParserCtxt->nsTab[index]);
|
||||||
|
|
||||||
|
if(This->vbInterface)
|
||||||
|
hr = IVBSAXContentHandler_endPrefixMapping(
|
||||||
|
This->saxreader->vbcontentHandler, &Prefix);
|
||||||
|
else
|
||||||
|
hr = ISAXContentHandler_endPrefixMapping(
|
||||||
|
This->saxreader->contentHandler,
|
||||||
|
Prefix, SysStringLen(Prefix));
|
||||||
|
|
||||||
|
SysFreeString(Prefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1410,6 +1460,7 @@ static ULONG WINAPI isaxlocator_Release(
|
|||||||
SysFreeString(This->publicId);
|
SysFreeString(This->publicId);
|
||||||
if(This->systemId)
|
if(This->systemId)
|
||||||
SysFreeString(This->systemId);
|
SysFreeString(This->systemId);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->nsStack);
|
||||||
|
|
||||||
ISAXXMLReader_Release((ISAXXMLReader*)&This->saxreader->lpSAXXMLReaderVtbl);
|
ISAXXMLReader_Release((ISAXXMLReader*)&This->saxreader->lpSAXXMLReaderVtbl);
|
||||||
HeapFree( GetProcessHeap(), 0, This );
|
HeapFree( GetProcessHeap(), 0, This );
|
||||||
@ -1517,6 +1568,15 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
|
|||||||
locator->line = 0;
|
locator->line = 0;
|
||||||
locator->column = 0;
|
locator->column = 0;
|
||||||
locator->ret = S_OK;
|
locator->ret = S_OK;
|
||||||
|
locator->nsStackSize = 8;
|
||||||
|
locator->nsStackLast = 0;
|
||||||
|
locator->nsStack = HeapAlloc(GetProcessHeap(), 0, locator->nsStackSize);
|
||||||
|
if(!locator->nsStack)
|
||||||
|
{
|
||||||
|
ISAXXMLReader_Release((ISAXXMLReader*)&reader->lpSAXXMLReaderVtbl);
|
||||||
|
HeapFree(GetProcessHeap(), 0, locator);
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
*ppsaxlocator = locator;
|
*ppsaxlocator = locator;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user