[Expat-checkins] CVS: expat/lib expat.h,1.3,1.4 xmlparse.c,1.3,1.4
Clark Cooper
coopercc@users.sourceforge.net
Sun, 24 Sep 2000 17:59:03 -0700
Update of /cvsroot/expat/expat/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv28081/lib
Modified Files:
expat.h xmlparse.c
Log Message:
Changes for namespace triplets.
Index: expat.h
===================================================================
RCS file: /cvsroot/expat/expat/lib/expat.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** expat.h 2000/09/24 03:43:37 1.3
--- expat.h 2000/09/25 00:58:49 1.4
***************
*** 168,171 ****
--- 168,172 ----
const XML_Char *name);
+
/* s is not 0 terminated. */
typedef void (*XML_CharacterDataHandler)(void *userData,
***************
*** 390,397 ****
void
! XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler);
void
! XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler);
void
--- 391,398 ----
void
! XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
void
! XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
void
***************
*** 490,493 ****
--- 491,508 ----
markup to be passed to the default handler. */
void XML_DefaultCurrent(XML_Parser parser);
+
+ /* If do_nst is non-zero, and namespace processing is in effect, and
+ a name has a prefix (i.e. an explicit namespace qualifier) then
+ that name is returned as a triplet in a single
+ string separated by the separator character specified when the parser
+ was created: URI + sep + local_name + sep + prefix.
+
+ If do_nst is zero, then namespace information is returned in the
+ default manner (URI + sep + local_name) whether or not the names
+ has a prefix.
+ */
+
+ void
+ XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
/* This value is passed as the userData argument to callbacks. */
Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** xmlparse.c 2000/09/24 03:43:37 1.3
--- xmlparse.c 2000/09/25 00:58:49 1.4
***************
*** 363,366 ****
--- 363,367 ----
const XML_Char *m_protocolEncodingName;
int m_ns;
+ int m_ns_triplets;
void *m_unknownEncodingMem;
void *m_unknownEncodingData;
***************
*** 448,451 ****
--- 449,453 ----
#define protocolEncodingName (((Parser *)parser)->m_protocolEncodingName)
#define ns (((Parser *)parser)->m_ns)
+ #define ns_triplets (((Parser *)parser)->m_ns_triplets)
#define prologState (((Parser *)parser)->m_prologState)
#define processor (((Parser *)parser)->m_processor)
***************
*** 628,631 ****
--- 630,634 ----
#endif
ns = 0;
+ ns_triplets = 0;
poolInit(&tempPool, &(((Parser *) parser)->m_mem));
poolInit(&temp2Pool, &(((Parser *) parser)->m_mem));
***************
*** 696,699 ****
--- 699,703 ----
XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler;
ELEMENT_TYPE * oldDeclElementType = declElementType;
+
void *oldUserData = userData;
void *oldHandlerArg = handlerArg;
***************
*** 703,706 ****
--- 707,711 ----
int oldParamEntityParsing = paramEntityParsing;
#endif
+ int oldns_triplets = ns_triplets;
if (ns) {
***************
*** 747,750 ****
--- 752,756 ----
externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
+ ns_triplets = oldns_triplets;
#ifdef XML_DTD
paramEntityParsing = oldParamEntityParsing;
***************
*** 828,831 ****
--- 834,842 ----
}
+ void
+ XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {
+ ns_triplets = do_nst;
+ }
+
void XML_SetUserData(XML_Parser parser, void *p)
{
***************
*** 1986,1989 ****
--- 1997,2009 ----
return XML_ERROR_NO_MEMORY;
} while (*s++);
+ if (ns_triplets) {
+ tempPool.ptr[-1] = namespaceSeparator;
+ s = b->prefix->name;
+ do {
+ if (!poolAppendChar(&tempPool, *s))
+ return XML_ERROR_NO_MEMORY;
+ } while (*s++);
+ }
+
appAtts[i] = poolStart(&tempPool);
poolFinish(&tempPool);