Commit dda048cf authored by Christopher Mueller's avatar Christopher Mueller Committed by Rémi Denis-Courmont

Xml: added empty element detection

Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 882e79a8
......@@ -74,6 +74,7 @@ struct xml_reader_t
const char *(*pf_next_attr) ( xml_reader_t *, const char ** );
int (*pf_use_dtd) ( xml_reader_t * );
int (*pf_is_empty) ( xml_reader_t * );
};
VLC_API xml_reader_t * xml_ReaderCreate(vlc_object_t *, stream_t *) VLC_USED;
......@@ -97,6 +98,14 @@ static inline int xml_ReaderUseDTD( xml_reader_t *reader )
return reader->pf_use_dtd( reader );
}
static inline int xml_ReaderIsEmptyElement( xml_reader_t *reader )
{
if(reader->pf_is_empty == NULL)
return -2;
return reader->pf_is_empty( reader );
}
enum {
XML_READER_NONE=0,
XML_READER_STARTELEM,
......
......@@ -62,6 +62,7 @@ vlc_module_end ()
static int ReaderNextNode( xml_reader_t *, const char ** );
static const char *ReaderNextAttr( xml_reader_t *, const char ** );
static int ReaderIsEmptyElement( xml_reader_t *);
static int ReaderUseDTD ( xml_reader_t * );
......@@ -175,6 +176,7 @@ static int ReaderOpen( vlc_object_t *p_this )
p_reader->p_sys = p_sys;
p_reader->pf_next_node = ReaderNextNode;
p_reader->pf_next_attr = ReaderNextAttr;
p_reader->pf_is_empty = ReaderIsEmptyElement;
p_reader->pf_use_dtd = ReaderUseDTD;
return VLC_SUCCESS;
......@@ -287,3 +289,8 @@ static int StreamRead( void *p_context, char *p_buffer, int i_buffer )
stream_t *s = (stream_t*)p_context;
return stream_Read( s, p_buffer, i_buffer );
}
static int ReaderIsEmptyElement( xml_reader_t *p_reader )
{
return xmlTextReaderIsEmptyElement( p_reader->p_sys->xml );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment