diff --git a/expat/gennmtab/gennmtab.c b/expat/gennmtab/gennmtab.c index 95a35eac730a..5ca453e42d49 100644 --- a/expat/gennmtab/gennmtab.c +++ b/expat/gennmtab/gennmtab.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/expat/xmlparse/xmlparse.c b/expat/xmlparse/xmlparse.c index 072176c7ca2d..d9df3a8ecf6e 100644 --- a/expat/xmlparse/xmlparse.c +++ b/expat/xmlparse/xmlparse.c @@ -300,6 +300,8 @@ typedef struct { XML_StartCdataSectionHandler m_startCdataSectionHandler; XML_EndCdataSectionHandler m_endCdataSectionHandler; XML_DefaultHandler m_defaultHandler; + XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; + XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; XML_NotationDeclHandler m_notationDeclHandler; XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; @@ -364,6 +366,8 @@ typedef struct { #define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler) #define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler) #define defaultHandler (((Parser *)parser)->m_defaultHandler) +#define startDoctypeDeclHandler (((Parser *)parser)->m_startDoctypeDeclHandler) +#define endDoctypeDeclHandler (((Parser *)parser)->m_endDoctypeDeclHandler) #define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler) #define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler) #define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler) @@ -452,6 +456,8 @@ XML_Parser XML_ParserCreate(const XML_Char *encodingName) startCdataSectionHandler = 0; endCdataSectionHandler = 0; defaultHandler = 0; + startDoctypeDeclHandler = 0; + endDoctypeDeclHandler = 0; unparsedEntityDeclHandler = 0; notationDeclHandler = 0; startNamespaceDeclHandler = 0; @@ -496,6 +502,7 @@ XML_Parser XML_ParserCreate(const XML_Char *encodingName) namespaceSeparator = '!'; #ifdef XML_DTD parentParser = 0; + paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; #endif ns = 0; poolInit(&tempPool); @@ -764,6 +771,14 @@ void XML_SetDefaultHandlerExpand(XML_Parser parser, defaultExpandInternalEntities = 1; } +void XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end) +{ + startDoctypeDeclHandler = start; + endDoctypeDeclHandler = end; +} + void XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { @@ -1953,13 +1968,11 @@ enum XML_Error doIgnoreSection(XML_Parser parser, tok = XmlIgnoreSectionTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { -#ifdef XML_DTD case XML_TOK_IGNORE_SECT: if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; return XML_ERROR_NONE; -#endif /* XML_DTD */ case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; @@ -2198,6 +2211,16 @@ doProlog(XML_Parser parser, enum XML_Error result = processXmlDecl(parser, 0, s, next); if (result != XML_ERROR_NONE) return result; + enc = encoding; + } + break; + case XML_ROLE_DOCTYPE_NAME: + if (startDoctypeDeclHandler) { + const XML_Char *name = poolStoreString(&tempPool, enc, s, next); + if (!name) + return XML_ERROR_NO_MEMORY; + startDoctypeDeclHandler(handlerArg, name); + poolClear(&tempPool); } break; #ifdef XML_DTD @@ -2206,6 +2229,7 @@ doProlog(XML_Parser parser, enum XML_Error result = processXmlDecl(parser, 1, s, next); if (result != XML_ERROR_NONE) return result; + enc = encoding; } break; #endif /* XML_DTD */ @@ -2255,6 +2279,8 @@ doProlog(XML_Parser parser, && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; } + if (endDoctypeDeclHandler) + endDoctypeDeclHandler(handlerArg); break; case XML_ROLE_INSTANCE_START: processor = contentProcessor; @@ -2598,7 +2624,8 @@ doProlog(XML_Parser parser, case XML_TOK_PARAM_ENTITY_REF: break; default: - reportDefault(parser, enc, s, next); + if (role != XML_ROLE_IGNORE_SECT) + reportDefault(parser, enc, s, next); } } s = next; diff --git a/expat/xmlparse/xmlparse.h b/expat/xmlparse/xmlparse.h index c5885122927f..284c31775e54 100644 --- a/expat/xmlparse/xmlparse.h +++ b/expat/xmlparse/xmlparse.h @@ -137,6 +137,15 @@ typedef void (*XML_DefaultHandler)(void *userData, const XML_Char *s, int len); +/* This is called for the start of the DOCTYPE declaration when the +name of the DOCTYPE is encountered. */ +typedef void (*XML_StartDoctypeDeclHandler)(void *userData, + const XML_Char *doctypeName); + +/* This is called for the start of the DOCTYPE declaration when the +closing > is encountered, but after processing any external subset. */ +typedef void (*XML_EndDoctypeDeclHandler)(void *userData); + /* This is called for a declaration of an unparsed (NDATA) entity. The base argument is whatever was set by XML_SetBase. The entityName, systemId and notationName arguments will never be null. @@ -308,6 +317,11 @@ void XMLPARSEAPI XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); +void XMLPARSEAPI +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); + void XMLPARSEAPI XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); @@ -410,7 +424,6 @@ so longer as the parser has not yet been freed. The new parser is completely independent and may safely be used in a separate thread. The handlers and userData are initialized from the parser argument. Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */ - XML_Parser XMLPARSEAPI XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, diff --git a/expat/xmltok/asciitab.h b/expat/xmltok/asciitab.h index 500ff66cfa7a..8a8a2dd388dd 100644 --- a/expat/xmltok/asciitab.h +++ b/expat/xmltok/asciitab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/expat/xmltok/dllmain.c b/expat/xmltok/dllmain.c index f508a452268d..deb7fafc81a7 100644 --- a/expat/xmltok/dllmain.c +++ b/expat/xmltok/dllmain.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #define STRICT 1 diff --git a/expat/xmltok/iasciitab.h b/expat/xmltok/iasciitab.h index c9ca02b71e41..333d6bb779da 100644 --- a/expat/xmltok/iasciitab.h +++ b/expat/xmltok/iasciitab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/expat/xmltok/latin1tab.h b/expat/xmltok/latin1tab.h index 378697512e69..48609aa8f9fa 100644 --- a/expat/xmltok/latin1tab.h +++ b/expat/xmltok/latin1tab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/expat/xmltok/utf8tab.h b/expat/xmltok/utf8tab.h index 57ff8074c164..a38fe624e882 100644 --- a/expat/xmltok/utf8tab.h +++ b/expat/xmltok/utf8tab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ diff --git a/expat/xmltok/xmldef.h b/expat/xmltok/xmldef.h index 2cb9c51e9e43..dfc4139ebff0 100644 --- a/expat/xmltok/xmldef.h +++ b/expat/xmltok/xmldef.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include @@ -41,7 +51,9 @@ Contributor(s): /* This file can be used for any definitions needed in particular environments. */ -#ifdef MOZILLA +/*** + * Mozilla specific defines listed below + */ #include "nspr.h" #define malloc(x) PR_Malloc(x) @@ -50,8 +62,6 @@ particular environments. */ #define free(x) PR_Free(x) #define int int32 -#endif /* MOZILLA */ - /* Enable Unicode string processing in expat */ #define XML_UNICODE @@ -59,4 +69,3 @@ particular environments. */ #ifndef XML_DTD #define XML_DTD 1 #endif - diff --git a/expat/xmltok/xmltok_impl.h b/expat/xmltok/xmltok_impl.h index 4c65254567e7..e72b225c8381 100644 --- a/expat/xmltok/xmltok_impl.h +++ b/expat/xmltok/xmltok_impl.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ enum { diff --git a/expat/xmlwf/codepage.c b/expat/xmlwf/codepage.c index b8d89e9c79c2..ac7c3e95796d 100644 --- a/expat/xmlwf/codepage.c +++ b/expat/xmlwf/codepage.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include "codepage.h" diff --git a/expat/xmlwf/codepage.h b/expat/xmlwf/codepage.h index 94c66f563f7a..bd8eba019f9e 100644 --- a/expat/xmlwf/codepage.h +++ b/expat/xmlwf/codepage.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ int codepageMap(int cp, int *map); diff --git a/expat/xmlwf/filemap.h b/expat/xmlwf/filemap.h index 60a1f6775eca..d4e9b59887e1 100644 --- a/expat/xmlwf/filemap.h +++ b/expat/xmlwf/filemap.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ diff --git a/expat/xmlwf/readfilemap.c b/expat/xmlwf/readfilemap.c index cfdfa2a7974c..c9bbb243e3ba 100644 --- a/expat/xmlwf/readfilemap.c +++ b/expat/xmlwf/readfilemap.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/expat/xmlwf/unixfilemap.c b/expat/xmlwf/unixfilemap.c index 1207d12b92ff..0ff677d59a78 100644 --- a/expat/xmlwf/unixfilemap.c +++ b/expat/xmlwf/unixfilemap.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/expat/xmlwf/win32filemap.c b/expat/xmlwf/win32filemap.c index 587fe28c2a6e..acbc62740eba 100644 --- a/expat/xmlwf/win32filemap.c +++ b/expat/xmlwf/win32filemap.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #define STRICT 1 diff --git a/expat/xmlwf/xmlfile.c b/expat/xmlwf/xmlfile.c index 954c77ff391a..d15d1a5e1c31 100644 --- a/expat/xmlwf/xmlfile.c +++ b/expat/xmlwf/xmlfile.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/expat/xmlwf/xmlfile.h b/expat/xmlwf/xmlfile.h index adfac5a45d47..5a1af2e49cc1 100644 --- a/expat/xmlwf/xmlfile.h +++ b/expat/xmlwf/xmlfile.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #define XML_MAP_FILE 01 diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c index 746c58124056..1297a0c0b5bb 100644 --- a/expat/xmlwf/xmlwf.c +++ b/expat/xmlwf/xmlwf.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include @@ -32,7 +42,9 @@ Contributor(s): #include #endif -#define NSSEP T('#') +/* This ensures proper sorting. */ + +#define NSSEP T('\001') static void characterData(void *userData, const XML_Char *s, int len) { @@ -48,6 +60,11 @@ static void characterData(void *userData, const XML_Char *s, int len) case T('>'): fputts(T(">"), fp); break; +#ifdef W3C14N + case 13: + fputts(T(" "), fp); + break; +#else case T('"'): fputts(T("""), fp); break; @@ -56,6 +73,7 @@ static void characterData(void *userData, const XML_Char *s, int len) case 13: ftprintf(fp, T("&#%d;"), *s); break; +#endif default: puttc(*s, fp); break; @@ -63,6 +81,53 @@ static void characterData(void *userData, const XML_Char *s, int len) } } +static void attributeValue(FILE *fp, const XML_Char *s) +{ + puttc(T('='), fp); + puttc(T('"'), fp); + for (;;) { + switch (*s) { + case 0: + case NSSEP: + puttc(T('"'), fp); + return; + case T('&'): + fputts(T("&"), fp); + break; + case T('<'): + fputts(T("<"), fp); + break; + case T('"'): + fputts(T("""), fp); + break; +#ifdef W3C14N + case 9: + fputts(T(" "), fp); + break; + case 10: + fputts(T(" "), fp); + break; + case 13: + fputts(T(" "), fp); + break; +#else + case T('>'): + fputts(T(">"), fp); + break; + case 9: + case 10: + case 13: + ftprintf(fp, T("&#%d;"), *s); + break; +#endif + default: + puttc(*s, fp); + break; + } + s++; + } +} + /* Lexicographically comparing UTF-8 encoded attribute values, is equivalent to lexicographically comparing based on the character number. */ @@ -88,10 +153,7 @@ static void startElement(void *userData, const XML_Char *name, const XML_Char ** while (*atts) { puttc(T(' '), fp); fputts(*atts++, fp); - puttc(T('='), fp); - puttc(T('"'), fp); - characterData(userData, *atts, tcslen(*atts)); - puttc(T('"'), fp); + attributeValue(fp, *atts); atts++; } puttc(T('>'), fp); @@ -106,6 +168,17 @@ static void endElement(void *userData, const XML_Char *name) puttc(T('>'), fp); } +static int nsattcmp(const void *p1, const void *p2) +{ + const XML_Char *att1 = *(const XML_Char **)p1; + const XML_Char *att2 = *(const XML_Char **)p2; + int sep1 = (tcsrchr(att1, NSSEP) != 0); + int sep2 = (tcsrchr(att1, NSSEP) != 0); + if (sep1 != sep2) + return sep1 - sep2; + return tcscmp(att1, att2); +} + static void startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) { int nAtts; @@ -117,16 +190,15 @@ static void startElementNS(void *userData, const XML_Char *name, const XML_Char sep = tcsrchr(name, NSSEP); if (sep) { - fputts(T("ns0:"), fp); + fputts(T("n1:"), fp); fputts(sep + 1, fp); - fputts(T(" xmlns:ns0=\""), fp); - characterData(userData, name, sep - name); - puttc(T('"'), fp); - nsi = 1; + fputts(T(" xmlns:n1"), fp); + attributeValue(fp, name); + nsi = 2; } else { fputts(name, fp); - nsi = 0; + nsi = 1; } p = atts; @@ -134,24 +206,22 @@ static void startElementNS(void *userData, const XML_Char *name, const XML_Char ++p; nAtts = (p - atts) >> 1; if (nAtts > 1) - qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); + qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp); while (*atts) { name = *atts++; sep = tcsrchr(name, NSSEP); + puttc(T(' '), fp); if (sep) { - ftprintf(fp, T(" xmlns:ns%d=\""), nsi); - characterData(userData, name, sep - name); - puttc(T('"'), fp); - name = sep + 1; - ftprintf(fp, T(" ns%d:"), nsi++); + ftprintf(fp, T("n%d:"), nsi); + fputts(sep + 1, fp); } else - puttc(T(' '), fp); - fputts(name, fp); - puttc(T('='), fp); - puttc(T('"'), fp); - characterData(userData, *atts, tcslen(*atts)); - puttc(T('"'), fp); + fputts(name, fp); + attributeValue(fp, *atts); + if (sep) { + ftprintf(fp, T(" xmlns:n%d"), nsi++); + attributeValue(fp, name); + } atts++; } puttc(T('>'), fp); @@ -165,7 +235,7 @@ static void endElementNS(void *userData, const XML_Char *name) puttc(T('/'), fp); sep = tcsrchr(name, NSSEP); if (sep) { - fputts(T("ns0:"), fp); + fputts(T("n1:"), fp); fputts(sep + 1, fp); } else @@ -173,6 +243,8 @@ static void endElementNS(void *userData, const XML_Char *name) puttc(T('>'), fp); } +#ifndef W3C14N + static void processingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { FILE *fp = userData; @@ -185,6 +257,8 @@ static void processingInstruction(void *userData, const XML_Char *target, const puttc(T('>'), fp); } +#endif /* not W3C14N */ + static void defaultCharacterData(XML_Parser parser, const XML_Char *s, int len) { XML_DefaultCurrent(parser); @@ -235,8 +309,9 @@ void metaLocation(XML_Parser parser) if (uri) ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri); ftprintf(XML_GetUserData(parser), - T(" byte=\"%ld\" line=\"%d\" col=\"%d\""), + T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""), XML_GetCurrentByteIndex(parser), + XML_GetCurrentByteCount(parser), XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser)); } @@ -257,6 +332,8 @@ static void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts) { FILE *fp = XML_GetUserData(parser); + const XML_Char **specifiedAttsEnd + = atts + 2*XML_GetSpecifiedAttributeCount(parser); ftprintf(fp, T("\n"), fp); + if (atts >= specifiedAttsEnd) + fputts(T("\" defaulted=\"yes\"/>\n"), fp); + else + fputts(T("\"/>\n"), fp); } while (*(atts += 2)); fputts(T("\n"), fp); } @@ -332,13 +412,31 @@ void metaCharacterData(XML_Parser parser, const XML_Char *s, int len) fputts(T("/>\n"), fp); } +static +void metaStartDoctypeDecl(XML_Parser parser, const XML_Char *doctypeName) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static +void metaEndDoctypeDecl(XML_Parser parser) +{ + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + static void metaUnparsedEntityDecl(XML_Parser parser, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName) { FILE *fp = XML_GetUserData(parser); ftprintf(fp, T(" 1) - i++; - else + j = 0; + break; + case T('\0'): + if (j > 1) { + i++; + j = 0; + break; + } + /* fall through */ + default: usage(argv[0]); + } } if (i == argc) usage(argv[0]); @@ -538,6 +664,9 @@ int tmain(int argc, XML_Char **argv) parser = XML_ParserCreateNS(encoding, NSSEP); else parser = XML_ParserCreate(encoding); + if (requireStandalone) + XML_SetNotStandaloneHandler(parser, notStandalone); + XML_SetParamEntityParsing(parser, paramEntityParsing); if (outputType == 't') { /* This is for doing timings; this gives a more realistic estimate of the parsing time. */ @@ -576,6 +705,7 @@ int tmain(int argc, XML_Char **argv) XML_SetCommentHandler(parser, metaComment); XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection); XML_SetCharacterDataHandler(parser, metaCharacterData); + XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, metaEndDoctypeDecl); XML_SetUnparsedEntityDeclHandler(parser, metaUnparsedEntityDecl); XML_SetNotationDeclHandler(parser, metaNotationDecl); XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl); @@ -594,7 +724,9 @@ int tmain(int argc, XML_Char **argv) else XML_SetElementHandler(parser, startElement, endElement); XML_SetCharacterDataHandler(parser, characterData); +#ifndef W3C14N XML_SetProcessingInstructionHandler(parser, processingInstruction); +#endif /* not W3C14N */ break; } } diff --git a/parser/expat/lib/asciitab.h b/parser/expat/lib/asciitab.h index 500ff66cfa7a..8a8a2dd388dd 100644 --- a/parser/expat/lib/asciitab.h +++ b/parser/expat/lib/asciitab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/parser/expat/lib/dllmain.c b/parser/expat/lib/dllmain.c index f508a452268d..deb7fafc81a7 100644 --- a/parser/expat/lib/dllmain.c +++ b/parser/expat/lib/dllmain.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #define STRICT 1 diff --git a/parser/expat/lib/iasciitab.h b/parser/expat/lib/iasciitab.h index c9ca02b71e41..333d6bb779da 100644 --- a/parser/expat/lib/iasciitab.h +++ b/parser/expat/lib/iasciitab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/parser/expat/lib/latin1tab.h b/parser/expat/lib/latin1tab.h index 378697512e69..48609aa8f9fa 100644 --- a/parser/expat/lib/latin1tab.h +++ b/parser/expat/lib/latin1tab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/parser/expat/lib/utf8tab.h b/parser/expat/lib/utf8tab.h index 57ff8074c164..a38fe624e882 100644 --- a/parser/expat/lib/utf8tab.h +++ b/parser/expat/lib/utf8tab.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ diff --git a/parser/expat/lib/xmldef.h b/parser/expat/lib/xmldef.h index 2cb9c51e9e43..dfc4139ebff0 100644 --- a/parser/expat/lib/xmldef.h +++ b/parser/expat/lib/xmldef.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include @@ -41,7 +51,9 @@ Contributor(s): /* This file can be used for any definitions needed in particular environments. */ -#ifdef MOZILLA +/*** + * Mozilla specific defines listed below + */ #include "nspr.h" #define malloc(x) PR_Malloc(x) @@ -50,8 +62,6 @@ particular environments. */ #define free(x) PR_Free(x) #define int int32 -#endif /* MOZILLA */ - /* Enable Unicode string processing in expat */ #define XML_UNICODE @@ -59,4 +69,3 @@ particular environments. */ #ifndef XML_DTD #define XML_DTD 1 #endif - diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c index 072176c7ca2d..d9df3a8ecf6e 100644 --- a/parser/expat/lib/xmlparse.c +++ b/parser/expat/lib/xmlparse.c @@ -300,6 +300,8 @@ typedef struct { XML_StartCdataSectionHandler m_startCdataSectionHandler; XML_EndCdataSectionHandler m_endCdataSectionHandler; XML_DefaultHandler m_defaultHandler; + XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; + XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; XML_NotationDeclHandler m_notationDeclHandler; XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; @@ -364,6 +366,8 @@ typedef struct { #define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler) #define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler) #define defaultHandler (((Parser *)parser)->m_defaultHandler) +#define startDoctypeDeclHandler (((Parser *)parser)->m_startDoctypeDeclHandler) +#define endDoctypeDeclHandler (((Parser *)parser)->m_endDoctypeDeclHandler) #define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler) #define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler) #define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler) @@ -452,6 +456,8 @@ XML_Parser XML_ParserCreate(const XML_Char *encodingName) startCdataSectionHandler = 0; endCdataSectionHandler = 0; defaultHandler = 0; + startDoctypeDeclHandler = 0; + endDoctypeDeclHandler = 0; unparsedEntityDeclHandler = 0; notationDeclHandler = 0; startNamespaceDeclHandler = 0; @@ -496,6 +502,7 @@ XML_Parser XML_ParserCreate(const XML_Char *encodingName) namespaceSeparator = '!'; #ifdef XML_DTD parentParser = 0; + paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; #endif ns = 0; poolInit(&tempPool); @@ -764,6 +771,14 @@ void XML_SetDefaultHandlerExpand(XML_Parser parser, defaultExpandInternalEntities = 1; } +void XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end) +{ + startDoctypeDeclHandler = start; + endDoctypeDeclHandler = end; +} + void XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { @@ -1953,13 +1968,11 @@ enum XML_Error doIgnoreSection(XML_Parser parser, tok = XmlIgnoreSectionTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { -#ifdef XML_DTD case XML_TOK_IGNORE_SECT: if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; return XML_ERROR_NONE; -#endif /* XML_DTD */ case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; @@ -2198,6 +2211,16 @@ doProlog(XML_Parser parser, enum XML_Error result = processXmlDecl(parser, 0, s, next); if (result != XML_ERROR_NONE) return result; + enc = encoding; + } + break; + case XML_ROLE_DOCTYPE_NAME: + if (startDoctypeDeclHandler) { + const XML_Char *name = poolStoreString(&tempPool, enc, s, next); + if (!name) + return XML_ERROR_NO_MEMORY; + startDoctypeDeclHandler(handlerArg, name); + poolClear(&tempPool); } break; #ifdef XML_DTD @@ -2206,6 +2229,7 @@ doProlog(XML_Parser parser, enum XML_Error result = processXmlDecl(parser, 1, s, next); if (result != XML_ERROR_NONE) return result; + enc = encoding; } break; #endif /* XML_DTD */ @@ -2255,6 +2279,8 @@ doProlog(XML_Parser parser, && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; } + if (endDoctypeDeclHandler) + endDoctypeDeclHandler(handlerArg); break; case XML_ROLE_INSTANCE_START: processor = contentProcessor; @@ -2598,7 +2624,8 @@ doProlog(XML_Parser parser, case XML_TOK_PARAM_ENTITY_REF: break; default: - reportDefault(parser, enc, s, next); + if (role != XML_ROLE_IGNORE_SECT) + reportDefault(parser, enc, s, next); } } s = next; diff --git a/parser/expat/lib/xmlparse.h b/parser/expat/lib/xmlparse.h index c5885122927f..284c31775e54 100644 --- a/parser/expat/lib/xmlparse.h +++ b/parser/expat/lib/xmlparse.h @@ -137,6 +137,15 @@ typedef void (*XML_DefaultHandler)(void *userData, const XML_Char *s, int len); +/* This is called for the start of the DOCTYPE declaration when the +name of the DOCTYPE is encountered. */ +typedef void (*XML_StartDoctypeDeclHandler)(void *userData, + const XML_Char *doctypeName); + +/* This is called for the start of the DOCTYPE declaration when the +closing > is encountered, but after processing any external subset. */ +typedef void (*XML_EndDoctypeDeclHandler)(void *userData); + /* This is called for a declaration of an unparsed (NDATA) entity. The base argument is whatever was set by XML_SetBase. The entityName, systemId and notationName arguments will never be null. @@ -308,6 +317,11 @@ void XMLPARSEAPI XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); +void XMLPARSEAPI +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); + void XMLPARSEAPI XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); @@ -410,7 +424,6 @@ so longer as the parser has not yet been freed. The new parser is completely independent and may safely be used in a separate thread. The handlers and userData are initialized from the parser argument. Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */ - XML_Parser XMLPARSEAPI XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, diff --git a/parser/expat/lib/xmltok_impl.h b/parser/expat/lib/xmltok_impl.h index 4c65254567e7..e72b225c8381 100644 --- a/parser/expat/lib/xmltok_impl.h +++ b/parser/expat/lib/xmltok_impl.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ enum { diff --git a/parser/expat/xmlwf/codepage.c b/parser/expat/xmlwf/codepage.c index b8d89e9c79c2..ac7c3e95796d 100644 --- a/parser/expat/xmlwf/codepage.c +++ b/parser/expat/xmlwf/codepage.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include "codepage.h" diff --git a/parser/expat/xmlwf/codepage.h b/parser/expat/xmlwf/codepage.h index 94c66f563f7a..bd8eba019f9e 100644 --- a/parser/expat/xmlwf/codepage.h +++ b/parser/expat/xmlwf/codepage.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ int codepageMap(int cp, int *map); diff --git a/parser/expat/xmlwf/filemap.h b/parser/expat/xmlwf/filemap.h index 60a1f6775eca..d4e9b59887e1 100644 --- a/parser/expat/xmlwf/filemap.h +++ b/parser/expat/xmlwf/filemap.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ diff --git a/parser/expat/xmlwf/readfilemap.c b/parser/expat/xmlwf/readfilemap.c index cfdfa2a7974c..c9bbb243e3ba 100644 --- a/parser/expat/xmlwf/readfilemap.c +++ b/parser/expat/xmlwf/readfilemap.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/parser/expat/xmlwf/unixfilemap.c b/parser/expat/xmlwf/unixfilemap.c index 1207d12b92ff..0ff677d59a78 100644 --- a/parser/expat/xmlwf/unixfilemap.c +++ b/parser/expat/xmlwf/unixfilemap.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/parser/expat/xmlwf/win32filemap.c b/parser/expat/xmlwf/win32filemap.c index 587fe28c2a6e..acbc62740eba 100644 --- a/parser/expat/xmlwf/win32filemap.c +++ b/parser/expat/xmlwf/win32filemap.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #define STRICT 1 diff --git a/parser/expat/xmlwf/xmlfile.c b/parser/expat/xmlwf/xmlfile.c index 954c77ff391a..d15d1a5e1c31 100644 --- a/parser/expat/xmlwf/xmlfile.c +++ b/parser/expat/xmlwf/xmlfile.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include diff --git a/parser/expat/xmlwf/xmlfile.h b/parser/expat/xmlwf/xmlfile.h index adfac5a45d47..5a1af2e49cc1 100644 --- a/parser/expat/xmlwf/xmlfile.h +++ b/parser/expat/xmlwf/xmlfile.h @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #define XML_MAP_FILE 01 diff --git a/parser/expat/xmlwf/xmlwf.c b/parser/expat/xmlwf/xmlwf.c index 746c58124056..1297a0c0b5bb 100644 --- a/parser/expat/xmlwf/xmlwf.c +++ b/parser/expat/xmlwf/xmlwf.c @@ -1,6 +1,6 @@ /* The contents of this file are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use this file except in +Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ @@ -12,10 +12,20 @@ under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998 +Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): + +Alternatively, the contents of this file may be used under the terms +of the GNU General Public License (the "GPL"), in which case the +provisions of the GPL are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of +the GPL and not to allow others to use your version of this file under +the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the +GPL. If you do not delete the provisions above, a recipient may use +your version of this file under either the MPL or the GPL. */ #include @@ -32,7 +42,9 @@ Contributor(s): #include #endif -#define NSSEP T('#') +/* This ensures proper sorting. */ + +#define NSSEP T('\001') static void characterData(void *userData, const XML_Char *s, int len) { @@ -48,6 +60,11 @@ static void characterData(void *userData, const XML_Char *s, int len) case T('>'): fputts(T(">"), fp); break; +#ifdef W3C14N + case 13: + fputts(T(" "), fp); + break; +#else case T('"'): fputts(T("""), fp); break; @@ -56,6 +73,7 @@ static void characterData(void *userData, const XML_Char *s, int len) case 13: ftprintf(fp, T("&#%d;"), *s); break; +#endif default: puttc(*s, fp); break; @@ -63,6 +81,53 @@ static void characterData(void *userData, const XML_Char *s, int len) } } +static void attributeValue(FILE *fp, const XML_Char *s) +{ + puttc(T('='), fp); + puttc(T('"'), fp); + for (;;) { + switch (*s) { + case 0: + case NSSEP: + puttc(T('"'), fp); + return; + case T('&'): + fputts(T("&"), fp); + break; + case T('<'): + fputts(T("<"), fp); + break; + case T('"'): + fputts(T("""), fp); + break; +#ifdef W3C14N + case 9: + fputts(T(" "), fp); + break; + case 10: + fputts(T(" "), fp); + break; + case 13: + fputts(T(" "), fp); + break; +#else + case T('>'): + fputts(T(">"), fp); + break; + case 9: + case 10: + case 13: + ftprintf(fp, T("&#%d;"), *s); + break; +#endif + default: + puttc(*s, fp); + break; + } + s++; + } +} + /* Lexicographically comparing UTF-8 encoded attribute values, is equivalent to lexicographically comparing based on the character number. */ @@ -88,10 +153,7 @@ static void startElement(void *userData, const XML_Char *name, const XML_Char ** while (*atts) { puttc(T(' '), fp); fputts(*atts++, fp); - puttc(T('='), fp); - puttc(T('"'), fp); - characterData(userData, *atts, tcslen(*atts)); - puttc(T('"'), fp); + attributeValue(fp, *atts); atts++; } puttc(T('>'), fp); @@ -106,6 +168,17 @@ static void endElement(void *userData, const XML_Char *name) puttc(T('>'), fp); } +static int nsattcmp(const void *p1, const void *p2) +{ + const XML_Char *att1 = *(const XML_Char **)p1; + const XML_Char *att2 = *(const XML_Char **)p2; + int sep1 = (tcsrchr(att1, NSSEP) != 0); + int sep2 = (tcsrchr(att1, NSSEP) != 0); + if (sep1 != sep2) + return sep1 - sep2; + return tcscmp(att1, att2); +} + static void startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) { int nAtts; @@ -117,16 +190,15 @@ static void startElementNS(void *userData, const XML_Char *name, const XML_Char sep = tcsrchr(name, NSSEP); if (sep) { - fputts(T("ns0:"), fp); + fputts(T("n1:"), fp); fputts(sep + 1, fp); - fputts(T(" xmlns:ns0=\""), fp); - characterData(userData, name, sep - name); - puttc(T('"'), fp); - nsi = 1; + fputts(T(" xmlns:n1"), fp); + attributeValue(fp, name); + nsi = 2; } else { fputts(name, fp); - nsi = 0; + nsi = 1; } p = atts; @@ -134,24 +206,22 @@ static void startElementNS(void *userData, const XML_Char *name, const XML_Char ++p; nAtts = (p - atts) >> 1; if (nAtts > 1) - qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); + qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp); while (*atts) { name = *atts++; sep = tcsrchr(name, NSSEP); + puttc(T(' '), fp); if (sep) { - ftprintf(fp, T(" xmlns:ns%d=\""), nsi); - characterData(userData, name, sep - name); - puttc(T('"'), fp); - name = sep + 1; - ftprintf(fp, T(" ns%d:"), nsi++); + ftprintf(fp, T("n%d:"), nsi); + fputts(sep + 1, fp); } else - puttc(T(' '), fp); - fputts(name, fp); - puttc(T('='), fp); - puttc(T('"'), fp); - characterData(userData, *atts, tcslen(*atts)); - puttc(T('"'), fp); + fputts(name, fp); + attributeValue(fp, *atts); + if (sep) { + ftprintf(fp, T(" xmlns:n%d"), nsi++); + attributeValue(fp, name); + } atts++; } puttc(T('>'), fp); @@ -165,7 +235,7 @@ static void endElementNS(void *userData, const XML_Char *name) puttc(T('/'), fp); sep = tcsrchr(name, NSSEP); if (sep) { - fputts(T("ns0:"), fp); + fputts(T("n1:"), fp); fputts(sep + 1, fp); } else @@ -173,6 +243,8 @@ static void endElementNS(void *userData, const XML_Char *name) puttc(T('>'), fp); } +#ifndef W3C14N + static void processingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { FILE *fp = userData; @@ -185,6 +257,8 @@ static void processingInstruction(void *userData, const XML_Char *target, const puttc(T('>'), fp); } +#endif /* not W3C14N */ + static void defaultCharacterData(XML_Parser parser, const XML_Char *s, int len) { XML_DefaultCurrent(parser); @@ -235,8 +309,9 @@ void metaLocation(XML_Parser parser) if (uri) ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri); ftprintf(XML_GetUserData(parser), - T(" byte=\"%ld\" line=\"%d\" col=\"%d\""), + T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""), XML_GetCurrentByteIndex(parser), + XML_GetCurrentByteCount(parser), XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser)); } @@ -257,6 +332,8 @@ static void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts) { FILE *fp = XML_GetUserData(parser); + const XML_Char **specifiedAttsEnd + = atts + 2*XML_GetSpecifiedAttributeCount(parser); ftprintf(fp, T("\n"), fp); + if (atts >= specifiedAttsEnd) + fputts(T("\" defaulted=\"yes\"/>\n"), fp); + else + fputts(T("\"/>\n"), fp); } while (*(atts += 2)); fputts(T("\n"), fp); } @@ -332,13 +412,31 @@ void metaCharacterData(XML_Parser parser, const XML_Char *s, int len) fputts(T("/>\n"), fp); } +static +void metaStartDoctypeDecl(XML_Parser parser, const XML_Char *doctypeName) +{ + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static +void metaEndDoctypeDecl(XML_Parser parser) +{ + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + static void metaUnparsedEntityDecl(XML_Parser parser, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName) { FILE *fp = XML_GetUserData(parser); ftprintf(fp, T(" 1) - i++; - else + j = 0; + break; + case T('\0'): + if (j > 1) { + i++; + j = 0; + break; + } + /* fall through */ + default: usage(argv[0]); + } } if (i == argc) usage(argv[0]); @@ -538,6 +664,9 @@ int tmain(int argc, XML_Char **argv) parser = XML_ParserCreateNS(encoding, NSSEP); else parser = XML_ParserCreate(encoding); + if (requireStandalone) + XML_SetNotStandaloneHandler(parser, notStandalone); + XML_SetParamEntityParsing(parser, paramEntityParsing); if (outputType == 't') { /* This is for doing timings; this gives a more realistic estimate of the parsing time. */ @@ -576,6 +705,7 @@ int tmain(int argc, XML_Char **argv) XML_SetCommentHandler(parser, metaComment); XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection); XML_SetCharacterDataHandler(parser, metaCharacterData); + XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, metaEndDoctypeDecl); XML_SetUnparsedEntityDeclHandler(parser, metaUnparsedEntityDecl); XML_SetNotationDeclHandler(parser, metaNotationDecl); XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl); @@ -594,7 +724,9 @@ int tmain(int argc, XML_Char **argv) else XML_SetElementHandler(parser, startElement, endElement); XML_SetCharacterDataHandler(parser, characterData); +#ifndef W3C14N XML_SetProcessingInstructionHandler(parser, processingInstruction); +#endif /* not W3C14N */ break; } }