/usr/include/xercesc/parsers/SAX2XMLReaderImpl.hpp is in libxerces-c-dev 3.2.0+debian-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: SAX2XMLReaderImpl.hpp 932889 2010-04-11 13:10:10Z borisk $
*/
#if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLREADERIMPL_HPP)
#define XERCESC_INCLUDE_GUARD_SAX2XMLREADERIMPL_HPP
#include <xercesc/parsers/SAXParser.hpp>
#include <xercesc/sax/Parser.hpp>
#include <xercesc/framework/XMLBuffer.hpp>
#include <xercesc/internal/VecAttributesImpl.hpp>
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/util/RefStackOf.hpp>
#include <xercesc/util/SecurityManager.hpp>
#include <xercesc/util/ValueStackOf.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class ContentHandler;
class LexicalHandler;
class DeclHandler;
class GrammarResolver;
class XMLGrammarPool;
class XMLResourceIdentifier;
class PSVIHandler;
/**
* This class implements the SAX2 'XMLReader' interface and should be
* used by applications wishing to parse the XML files using SAX2.
* It allows the client program to install SAX2 handlers for event
* callbacks.
*
* <p>It can be used to instantiate a validating or non-validating
* parser, by setting a member flag.</p>
*
* we basically re-use the existing SAX1 parser code, but provide a
* new implementation of XMLContentHandler that raises the new
* SAX2 style events
*
*/
class PARSERS_EXPORT SAX2XMLReaderImpl :
public XMemory
, public SAX2XMLReader
, public XMLDocumentHandler
, public XMLErrorReporter
, public XMLEntityHandler
, public DocTypeHandler
{
public :
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
/** @name Constructors and Destructor */
//@{
/** The default constructor */
SAX2XMLReaderImpl(
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
, XMLGrammarPool* const gramPool = 0
);
/** The destructor */
~SAX2XMLReaderImpl() ;
//@}
//-----------------------------------------------------------------------
// Implementation of SAX2XMLReader Interface
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// The XMLReader interface
//-----------------------------------------------------------------------
/** @name Implementation of SAX 2.0 XMLReader interface's. */
//@{
/**
* This method returns the installed content handler.
*
* @return A pointer to the installed content handler object.
*/
virtual ContentHandler* getContentHandler() const ;
/**
* This method returns the installed DTD handler.
*
* @return A pointer to the installed DTD handler object.
*/
virtual DTDHandler* getDTDHandler() const ;
/**
* This method returns the installed entity resolver.
*
* @return A pointer to the installed entity resolver object.
*/
virtual EntityResolver* getEntityResolver() const ;
/**
* This method returns the installed entity resolver.
*
* @return A pointer to the installed entity resolver object.
*/
virtual XMLEntityResolver* getXMLEntityResolver() const ;
/**
* This method returns the installed error handler.
*
* @return A pointer to the installed error handler object.
*/
virtual ErrorHandler* getErrorHandler() const ;
/**
* This method returns the installed PSVI handler.
*
* @return A pointer to the installed PSVI handler object.
*/
virtual PSVIHandler* getPSVIHandler() const ;
/**
* Query the current state of any feature in a SAX2 XMLReader.
*
* @param name The unique identifier (URI) of the feature being set.
* @return The current state of the feature.
* @exception SAXNotRecognizedException If the requested feature is not known.
*/
virtual bool getFeature(const XMLCh* const name) const ;
/**
* Query the current value of a property in a SAX2 XMLReader.
*
* The parser owns the returned pointer. The memory allocated for
* the returned pointer will be destroyed when the parser is deleted.
*
* To ensure accessibility of the returned information after the parser
* is deleted, callers need to copy and store the returned information
* somewhere else; otherwise you may get unexpected result. Since the returned
* pointer is a generic void pointer, see the SAX2 Programming Guide to learn
* exactly what type of property value each property returns for replication.
*
* @param name The unique identifier (URI) of the property being set.
* @return The current value of the property. The pointer spans the same
* life-time as the parser. A null pointer is returned if nothing
* was specified externally.
* @exception SAXNotRecognizedException If the requested property is not known.
*/
virtual void* getProperty(const XMLCh* const name) const ;
/**
* Allow an application to register a document event handler.
*
* If the application does not register a document handler, all
* document events reported by the SAX parser will be silently
* ignored (this is the default behaviour implemented by
* HandlerBase).
*
* Applications may register a new or different handler in the
* middle of a parse, and the SAX parser must begin using the new
* handler immediately.
*
* @param handler The document handler.
* @see DocumentHandler#DocumentHandler
* @see HandlerBase#HandlerBase
*/
virtual void setContentHandler(ContentHandler* const handler) ;
/**
* Allow an application to register a DTD event handler.
*
* If the application does not register a DTD handler, all DTD
* events reported by the SAX parser will be silently ignored (this
* is the default behaviour implemented by HandlerBase).
*
* Applications may register a new or different handler in the middle
* of a parse, and the SAX parser must begin using the new handler
* immediately.
*
* @param handler The DTD handler.
* @see DTDHandler#DTDHandler
* @see HandlerBase#HandlerBase
*/
virtual void setDTDHandler(DTDHandler* const handler) ;
/**
* Allow an application to register a custom entity resolver.
*
* If the application does not register an entity resolver, the
* SAX parser will resolve system identifiers and open connections
* to entities itself (this is the default behaviour implemented in
* DefaultHandler).
*
* Applications may register a new or different entity resolver
* in the middle of a parse, and the SAX parser must begin using
* the new resolver immediately.
*
* <i>Any previously set entity resolver is merely dropped, since the parser
* does not own them. If both setEntityResolver and setXMLEntityResolver
* are called, then the last one is used.</i>
*
* @param resolver The object for resolving entities.
* @see EntityResolver#EntityResolver
* @see DefaultHandler#DefaultHandler
*/
virtual void setEntityResolver(EntityResolver* const resolver) ;
/** Set the entity resolver
*
* This method allows applications to install their own entity
* resolver. By installing an entity resolver, the applications
* can trap and potentially redirect references to external
* entities.
*
* <i>Any previously set entity resolver is merely dropped, since the parser
* does not own them. If both setEntityResolver and setXMLEntityResolver
* are called, then the last one is used.</i>
*
* @param resolver A const pointer to the user supplied entity
* resolver.
*
* @see #getXMLEntityResolver
*/
virtual void setXMLEntityResolver(XMLEntityResolver* const resolver) ;
/**
* Allow an application to register an error event handler.
*
* If the application does not register an error event handler,
* all error events reported by the SAX parser will be silently
* ignored, except for fatalError, which will throw a SAXException
* (this is the default behaviour implemented by HandlerBase).
*
* Applications may register a new or different handler in the
* middle of a parse, and the SAX parser must begin using the new
* handler immediately.
*
* @param handler The error handler.
* @see ErrorHandler#ErrorHandler
* @see SAXException#SAXException
* @see HandlerBase#HandlerBase
*/
virtual void setErrorHandler(ErrorHandler* const handler) ;
/**
* This method installs the user specified PSVI handler on
* the parser.
*
* @param handler A pointer to the PSVI handler to be called
* when the parser comes across 'PSVI' events
* as per the schema specification.
*/
virtual void setPSVIHandler(PSVIHandler* const handler);
/**
* Set the state of any feature in a SAX2 XMLReader.
* Supported features in SAX2 for xerces-c are:
* <br>(See the SAX2 Programming Guide for detail description).
*
* <br>http://xml.org/sax/features/validation (default: false)
* <br>http://xml.org/sax/features/namespaces (default: true)
* <br>http://xml.org/sax/features/namespace-prefixes (default: false)
* <br>http://apache.org/xml/features/validation/dynamic (default: false)
* <br>http://apache.org/xml/features/validation/reuse-grammar (default: false)
* <br>http://apache.org/xml/features/validation/schema (default: true)
* <br>http://apache.org/xml/features/validation/schema-full-checking (default: false)
* <br>http://apache.org/xml/features/validating/load-schema (default: true)
* <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)
* <br>http://apache.org/xml/features/continue-after-fatal-error (default: false)
* <br>http://apache.org/xml/features/validation-error-as-fatal (default: false)
*
* @param name The unique identifier (URI) of the feature.
* @param value The requested state of the feature (true or false).
* @exception SAXNotRecognizedException If the requested feature is not known.
* @exception SAXNotSupportedException Feature modification is not supported during parse
*
*/
virtual void setFeature(const XMLCh* const name, const bool value) ;
/**
* Set the value of any property in a SAX2 XMLReader.
* Supported properties in SAX2 for xerces-c are:
* <br>(See the SAX2 Programming Guide for detail description).
*
* <br>http://apache.org/xml/properties/schema/external-schemaLocation
* <br>http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation.
*
* It takes a void pointer as the property value. Application is required to initialize this void
* pointer to a correct type. See the SAX2 Programming Guide
* to learn exactly what type of property value each property expects for processing.
* Passing a void pointer that was initialized with a wrong type will lead to unexpected result.
* If the same property is set more than once, the last one takes effect.
*
* @param name The unique identifier (URI) of the property being set.
* @param value The requested value for the property. See
* the SAX2 Programming Guide to learn
* exactly what type of property value each property expects for processing.
* Passing a void pointer that was initialized with a wrong type will lead
* to unexpected result.
* @exception SAXNotRecognizedException If the requested property is not known.
* @exception SAXNotSupportedException Property modification is not supported during parse
*/
virtual void setProperty(const XMLCh* const name, void* value) ;
/**
* Parse an XML document.
*
* The application can use this method to instruct the SAX parser
* to begin parsing an XML document from any valid input
* source (a character stream, a byte stream, or a URI).
*
* Applications may not invoke this method while a parse is in
* progress (they should create a new Parser instead for each
* additional XML document). Once a parse is complete, an
* application may reuse the same Parser object, possibly with a
* different input source.
*
* @param source The input source for the top-level of the
* XML document.
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @see InputSource#InputSource
* @see #setEntityResolver
* @see #setDTDHandler
* @see #setDocumentHandler
* @see #setErrorHandler
*/
virtual void parse
(
const InputSource& source
) ;
/**
* Parse an XML document from a system identifier (URI).
*
* This method is a shortcut for the common case of reading a
* document from a system identifier. It is the exact equivalent
* of the following:
*
* parse(new URLInputSource(systemId));
*
* If the system identifier is a URL, it must be fully resolved
* by the application before it is passed to the parser.
*
* @param systemId The system identifier (URI).
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @see #parse(InputSource)
*/
virtual void parse
(
const XMLCh* const systemId
) ;
/**
* Parse an XML document from a system identifier (URI).
*
* This method is a shortcut for the common case of reading a
* document from a system identifier. It is the exact equivalent
* of the following:
*
* parse(new URLInputSource(systemId));
*
* If the system identifier is a URL, it must be fully resolved
* by the application before it is passed to the parser.
*
* @param systemId The system identifier (URI).
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @see #parse(InputSource)
*/
virtual void parse
(
const char* const systemId
) ;
//@}
// -----------------------------------------------------------------------
// SAX 2.0-ext
// -----------------------------------------------------------------------
/** @name SAX 2.0-ext */
//@{
/**
* This method returns the installed declaration handler.
*
* @return A pointer to the installed declaration handler object.
*/
virtual DeclHandler* getDeclarationHandler() const ;
/**
* This method returns the installed lexical handler.
*
* @return A pointer to the installed lexical handler object.
*/
virtual LexicalHandler* getLexicalHandler() const ;
/**
* Allow an application to register a declaration event handler.
*
* If the application does not register a declaration handler,
* all events reported by the SAX parser will be silently
* ignored. (this is the default behaviour implemented by DefaultHandler).
*
* Applications may register a new or different handler in the
* middle of a parse, and the SAX parser must begin using the new
* handler immediately.
*
* @param handler The DTD declaration handler.
* @see DeclHandler#DeclHandler
* @see SAXException#SAXException
* @see DefaultHandler#DefaultHandler
*/
virtual void setDeclarationHandler(DeclHandler* const handler) ;
/**
* Allow an application to register a lexical event handler.
*
* If the application does not register a lexical handler,
* all events reported by the SAX parser will be silently
* ignored. (this is the default behaviour implemented by HandlerBase).
*
* Applications may register a new or different handler in the
* middle of a parse, and the SAX parser must begin using the new
* handler immediately.
*
* @param handler The error handler.
* @see LexicalHandler#LexicalHandler
* @see SAXException#SAXException
* @see HandlerBase#HandlerBase
*/
virtual void setLexicalHandler(LexicalHandler* const handler) ;
//@}
// -----------------------------------------------------------------------
// Getter Methods
// -----------------------------------------------------------------------
/** @name Getter Methods (Xerces-C specific) */
//@{
/**
* This method is used to get the current validator.
*
* <b>SAX2XMLReader assumes responsibility for the validator. It will be
* deleted when the XMLReader is destroyed.</b>
*
* @return A pointer to the validator. An application should not deleted
* the object returned.
*
*/
virtual XMLValidator* getValidator() const ;
//@}
/** Get error count from the last parse operation.
*
* This method returns the error count from the last parse
* operation. Note that this count is actually stored in the
* scanner, so this method simply returns what the
* scanner reports.
*
* @return number of errors encountered during the latest
* parse operation.
*/
virtual XMLSize_t getErrorCount() const ;
/**
* This method returns the state of the parser's
* exit-on-First-Fatal-Error flag.
*
* <p>Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error"
* which indicates the opposite state.</p>
*
* @return true, if the parser is currently configured to
* exit on the first fatal error, false otherwise.
*
* @see #setExitOnFirstFatalError
* @see #getFeature
*/
virtual bool getExitOnFirstFatalError() const ;
/**
* This method returns the state of the parser's
* validation-constraint-fatal flag.
*
* <p>Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal"
* which means the same thing.
*
* @return true, if the parser is currently configured to
* set validation constraint errors as fatal, false
* otherwise.
*
* @see #setValidationContraintFatal
* @see #getFeature
*/
virtual bool getValidationConstraintFatal() const ;
/**
* Retrieve the grammar that is associated with the specified namespace key
*
* @param nameSpaceKey Namespace key
* @return Grammar associated with the Namespace key.
*/
virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey);
/**
* Retrieve the grammar where the root element is declared.
*
* @return Grammar where root element declared
*/
virtual Grammar* getRootGrammar();
/**
* Returns the string corresponding to a URI id from the URI string pool.
*
* @param uriId id of the string in the URI string pool.
* @return URI string corresponding to the URI id.
*/
virtual const XMLCh* getURIText(unsigned int uriId) const;
/**
* Returns the current src offset within the input source.
* To be used only while parsing is in progress.
*
* @return offset within the input source
*/
virtual XMLFilePos getSrcOffset() const;
//@}
// -----------------------------------------------------------------------
// Setter Methods
// -----------------------------------------------------------------------
/** @name Setter Methods (Xerces-C specific) */
//@{
/**
* This method is used to set a validator.
*
* <b>SAX2XMLReader assumes responsibility for the validator. It will be
* deleted when the XMLReader is destroyed.</b>
*
* @param valueToAdopt A pointer to the validator that the reader should use.
*
*/
virtual void setValidator(XMLValidator* valueToAdopt) ;
/**
* This method allows users to set the parser's behaviour when it
* encounters the first fatal error. If set to true, the parser
* will exit at the first fatal error. If false, then it will
* report the error and continue processing.
*
* <p>The default value is 'true' and the parser exits on the
* first fatal error.</p>
*
* <p>Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error"
* which has the opposite behaviour.</p>
*
* <p>If both the feature above and this function are used, the latter takes effect.</p>
*
* @param newState The value specifying whether the parser should
* continue or exit when it encounters the first
* fatal error.
*
* @see #getExitOnFirstFatalError
* @see #setFeature
*/
virtual void setExitOnFirstFatalError(const bool newState) ;
/**
* This method allows users to set the parser's behaviour when it
* encounters a validation constraint error. If set to true, and the
* the parser will treat validation error as fatal and will exit depends on the
* state of "getExitOnFirstFatalError". If false, then it will
* report the error and continue processing.
*
* Note: setting this true does not mean the validation error will be printed with
* the word "Fatal Error". It is still printed as "Error", but the parser
* will exit if "setExitOnFirstFatalError" is set to true.
*
* <p>The default value is 'false'.</p>
*
* <p>Or you can set the feature "http://apache.org/xml/features/validation-error-as-fatal"
* which means the same thing.</p>
*
* <p>If both the feature above and this function are used, the latter takes effect.</p>
*
* @param newState If true, the parser will exit if "setExitOnFirstFatalError"
* is set to true.
*
* @see #getValidationConstraintFatal
* @see #setExitOnFirstFatalError
* @see #setFeature
*/
virtual void setValidationConstraintFatal(const bool newState) ;
//@}
// -----------------------------------------------------------------------
// Progressive scan methods
// -----------------------------------------------------------------------
/** @name Progressive scan methods */
//@{
/** Begin a progressive parse operation
*
* This method is used to start a progressive parse on a XML file.
* To continue parsing, subsequent calls must be to the parseNext
* method.
*
* It scans through the prolog and returns a token to be used on
* subsequent scanNext() calls. If the return value is true, then the
* token is legal and ready for further use. If it returns false, then
* the scan of the prolog failed and the token is not going to work on
* subsequent scanNext() calls.
*
* @param systemId A pointer to a Unicode string representing the path
* to the XML file to be parsed.
* @param toFill A token maintaing state information to maintain
* internal consistency between invocation of 'parseNext'
* calls.
*
* @return 'true', if successful in parsing the prolog. It indicates the
* user can go ahead with parsing the rest of the file. It
* returns 'false' to indicate that the parser could parse the
* prolog (which means the token will not be valid.)
*
* @see #parseNext
* @see #parseFirst(char*,...)
* @see #parseFirst(InputSource&,...)
*/
virtual bool parseFirst
(
const XMLCh* const systemId
, XMLPScanToken& toFill
) ;
/** Begin a progressive parse operation
*
* This method is used to start a progressive parse on a XML file.
* To continue parsing, subsequent calls must be to the parseNext
* method.
*
* It scans through the prolog and returns a token to be used on
* subsequent scanNext() calls. If the return value is true, then the
* token is legal and ready for further use. If it returns false, then
* the scan of the prolog failed and the token is not going to work on
* subsequent scanNext() calls.
*
* @param systemId A pointer to a regular native string representing
* the path to the XML file to be parsed.
* @param toFill A token maintaing state information to maintain
* internal consistency between invocation of 'parseNext'
* calls.
*
* @return 'true', if successful in parsing the prolog. It indicates the
* user can go ahead with parsing the rest of the file. It
* returns 'false' to indicate that the parser could not parse
* the prolog.
*
* @see #parseNext
* @see #parseFirst(XMLCh*,...)
* @see #parseFirst(InputSource&,...)
*/
virtual bool parseFirst
(
const char* const systemId
, XMLPScanToken& toFill
) ;
/** Begin a progressive parse operation
*
* This method is used to start a progressive parse on a XML file.
* To continue parsing, subsequent calls must be to the parseNext
* method.
*
* It scans through the prolog and returns a token to be used on
* subsequent scanNext() calls. If the return value is true, then the
* token is legal and ready for further use. If it returns false, then
* the scan of the prolog failed and the token is not going to work on
* subsequent scanNext() calls.
*
* @param source A const reference to the InputSource object which
* points to the XML file to be parsed.
* @param toFill A token maintaing state information to maintain
* internal consistency between invocation of 'parseNext'
* calls.
*
* @return 'true', if successful in parsing the prolog. It indicates the
* user can go ahead with parsing the rest of the file. It
* returns 'false' to indicate that the parser could not parse
* the prolog.
*
* @see #parseNext
* @see #parseFirst(XMLCh*,...)
* @see #parseFirst(char*,...)
*/
virtual bool parseFirst
(
const InputSource& source
, XMLPScanToken& toFill
) ;
/** Continue a progressive parse operation
*
* This method is used to continue with progressive parsing of
* XML files started by a call to 'parseFirst' method.
*
* It parses the XML file and stops as soon as it comes across
* a XML token (as defined in the XML specification). Relevant
* callback handlers are invoked as required by the SAX
* specification.
*
* @param token A token maintaing state information to maintain
* internal consistency between invocation of 'parseNext'
* calls.
*
* @return 'true', if successful in parsing the next XML token.
* It indicates the user can go ahead with parsing the rest
* of the file. It returns 'false' to indicate that the parser
* could not find next token as per the XML specification
* production rule.
*
* @see #parseFirst(XMLCh*,...)
* @see #parseFirst(char*,...)
* @see #parseFirst(InputSource&,...)
*/
virtual bool parseNext(XMLPScanToken& token) ;
/** Reset the parser after a progressive parse
*
* If a progressive parse loop exits before the end of the document
* is reached, the parser has no way of knowing this. So it will leave
* open any files or sockets or memory buffers that were in use at
* the time that the parse loop exited.
*
* The next parse operation will cause these open files and such to
* be closed, but the next parse operation might occur at some unknown
* future point. To avoid this problem, you should reset the parser if
* you exit the loop early.
*
* If you exited because of an error, then this cleanup will be done
* for you. Its only when you exit the file prematurely of your own
* accord, because you've found what you wanted in the file most
* likely.
*
* @param token A token maintaing state information to maintain
* internal consistency between invocation of 'parseNext'
* calls.
*/
virtual void parseReset(XMLPScanToken& token) ;
//@}
// -----------------------------------------------------------------------
// Implementation of the grammar preparsing interface
// -----------------------------------------------------------------------
/** @name Implementation of Grammar preparsing interface's. */
//@{
/**
* Preparse schema grammar (XML Schema, DTD, etc.) via an input source
* object.
*
* This method invokes the preparsing process on a schema grammar XML
* file specified by the SAX InputSource parameter.
*
*
* @param source A const reference to the SAX InputSource object which
* points to the schema grammar file to be preparsed.
* @param grammarType The grammar type (Schema or DTD).
* @param toCache If <code>true</code>, we cache the preparsed grammar,
* otherwise, no caching. Default is <code>false</code>.
* @return The preparsed schema grammar object (SchemaGrammar or
* DTDGrammar). That grammar object is owned by the parser.
*
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOMException A DOM exception as per DOM spec.
*
* @see InputSource#InputSource
*/
virtual Grammar* loadGrammar(const InputSource& source,
const Grammar::GrammarType grammarType,
const bool toCache = false);
/**
* Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
*
* This method invokes the preparsing process on a schema grammar XML
* file specified by the file path parameter.
*
*
* @param systemId A const XMLCh pointer to the Unicode string which
* contains the path to the XML grammar file to be
* preparsed.
* @param grammarType The grammar type (Schema or DTD).
* @param toCache If <code>true</code>, we cache the preparsed grammar,
* otherwise, no caching. Default is <code>false</code>.
* @return The preparsed schema grammar object (SchemaGrammar or
* DTDGrammar). That grammar object is owned by the parser.
*
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOMException A DOM exception as per DOM spec.
*/
virtual Grammar* loadGrammar(const XMLCh* const systemId,
const Grammar::GrammarType grammarType,
const bool toCache = false);
/**
* Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
*
* This method invokes the preparsing process on a schema grammar XML
* file specified by the file path parameter.
*
*
* @param systemId A const char pointer to a native string which contains
* the path to the XML grammar file to be preparsed.
* @param grammarType The grammar type (Schema or DTD).
* @param toCache If <code>true</code>, we cache the preparsed grammar,
* otherwise, no caching. Default is <code>false</code>.
* @return The preparsed schema grammar object (SchemaGrammar or
* DTDGrammar). That grammar object is owned by the parser.
*
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOMException A DOM exception as per DOM spec.
*/
virtual Grammar* loadGrammar(const char* const systemId,
const Grammar::GrammarType grammarType,
const bool toCache = false);
/**
* Clear the cached grammar pool
*/
virtual void resetCachedGrammarPool();
/** Set maximum input buffer size
*
* This method allows users to limit the size of buffers used in parsing
* XML character data. The effect of setting this size is to limit the
* size of a ContentHandler::characters() call.
*
* The parser's default input buffer size is 1 megabyte.
*
* @param bufferSize The maximum input buffer size
*/
virtual void setInputBufferSize(const XMLSize_t bufferSize);
//@}
// -----------------------------------------------------------------------
// Advanced document handler list maintenance methods
// -----------------------------------------------------------------------
/** @name Advanced document handler list maintenance methods */
//@{
/**
* This method installs the specified 'advanced' document callback
* handler, thereby allowing the user to customize the processing,
* if they choose to do so. Any number of advanced callback handlers
* maybe installed.
*
* <p>The methods in the advanced callback interface represent
* Xerces-C extensions. There is no specification for this interface.</p>
*
* @param toInstall A pointer to the users advanced callback handler.
*
* @see #removeAdvDocHandler
*/
virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) ;
/**
* This method removes the 'advanced' document handler callback from
* the underlying parser scanner. If no handler is installed, advanced
* callbacks are not invoked by the scanner.
* @param toRemove A pointer to the advanced callback handler which
* should be removed.
*
* @see #installAdvDocHandler
*/
virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) ;
//@}
// -----------------------------------------------------------------------
// Implementation of the XMLDocumentHandler interface
// -----------------------------------------------------------------------
/** @name Implementation of the XMLDocumentHandler Interface. */
//@{
/**
* This method is used to report all the characters scanned
* by the parser. The driver will invoke the 'characters'
* method of the user installed SAX Document Handler.
*
* <p>If any advanced callback handlers are installed, the
* corresponding 'docCharacters' method will also be invoked.</p>
*
* @param chars A const pointer to a Unicode string representing the
* character data.
* @param length The length of the Unicode string returned in 'chars'.
* @param cdataSection A flag indicating if the characters represent
* content from the CDATA section.
* @see DocumentHandler#characters
*/
virtual void docCharacters
(
const XMLCh* const chars
, const XMLSize_t length
, const bool cdataSection
);
/**
* This method is used to report any comments scanned by the parser.
* This method is a no-op unless, unless an advanced callback handler
* is installed, in which case the corresponding 'docComment' method
* is invoked.
*
* @param comment A const pointer to a null terminated Unicode
* string representing the comment text.
*/
virtual void docComment
(
const XMLCh* const comment
);
/**
* This method is used to report any PI scanned by the parser.
*
* <p>Any PI's occurring before any 'content' are not reported
* to any SAX handler as per the specification. However, all
* PI's within content are reported via the SAX Document Handler's
* 'processingInstruction' method.
*
* <p>If any advanced callback handlers are installed, the
* corresponding 'docPI' method will be invoked.</p>
*
* @param target A const pointer to a Unicode string representing the
* target of the PI declaration.
* @param data A const pointer to a Unicode string representing the
* data of the PI declaration. See the PI production rule
* in the XML specification for details.
*
* @see DocumentHandler#processingInstruction
*/
virtual void docPI
(
const XMLCh* const target
, const XMLCh* const data
);
/**
* This method is used to indicate the end of root element
* was just scanned by the parser. Corresponding 'endDocument'
* method of the user installed SAX Document Handler will also
* be invoked.
*
* <p>In addition, if any advanced callback handlers are installed,
* the corresponding 'endDocument' method is invoked.</p>
*
* @see DocumentHandler#endDocument
*/
virtual void endDocument();
/**
* This method is used to indicate the end tag of an element.
* The driver will invoke the corresponding 'endElement' method of
* the SAX Document Handler interface.
*
* <p>If any advanced callback handlers are installed, the
* corresponding 'endElement' method is also invoked.</p>
*
* @param elemDecl A const reference to the object containing element
* declaration information.
* @param urlId An id referring to the namespace prefix, if
* namespaces setting is switched on.
* @param isRoot A flag indicating whether this element was the
* root element.
* @param elemPrefix A const pointer to a Unicode string containing
* the namespace prefix for this element. Applicable
* only when namespace processing is enabled.
* @see DocumentHandler#endElement
*/
virtual void endElement
(
const XMLElementDecl& elemDecl
, const unsigned int urlId
, const bool isRoot
, const XMLCh* const elemPrefix=0
);
/**
* This method is used to indicate that an end of an entity reference
* was just scanned.
*
* <p>If any advanced callback handlers are installed, the
* corresponding 'endEntityReference' method is invoked.</p>
*
* @param entDecl A const reference to the object containing the
* entity declaration information.
*/
virtual void endEntityReference
(
const XMLEntityDecl& entDecl
);
/**
* This method is used to report all the whitespace characters,
* which are determined to be 'ignorable'. This distinction
* between characters is only made, if validation is enabled.
* Corresponding 'ignorableWhitespace' method of the user installed
* SAX Document Handler interface is called.
*
* <p>Any whitespace before content is not reported to the SAX
* Document Handler method, as per the SAX specification.
* However, if any advanced callback handlers are installed, the
* corresponding 'ignorableWhitespace' method is invoked.</p>
*
* @param chars A const pointer to a Unicode string representing the
* ignorable whitespace character data.
* @param length The length of the Unicode string 'chars'.
* @param cdataSection A flag indicating if the characters represent
* content from the CDATA section.
* @see DocumentHandler#ignorableWhitespace
*/
virtual void ignorableWhitespace
(
const XMLCh* const chars
, const XMLSize_t length
, const bool cdataSection
);
/**
* This method allows the user installed Document Handler and
* any advanced callback handlers to 'reset' themselves.
*/
virtual void resetDocument();
/**
* This method is used to report the start of the parsing process.
* The corresponding user installed SAX Document Handler's method
* 'startDocument' is invoked.
*
* <p>If any advanced callback handlers are installed, then the
* corresponding 'startDocument' method is also called.</p>
*
* @see DocumentHandler#startDocument
*/
virtual void startDocument();
/**
* This method is used to report the start of an element. It is
* called at the end of the element, by which time all attributes
* specified are also parsed. The corresponding user installed
* SAX Document Handler's method 'startElement' is invoked.
*
* <p>If any advanced callback handlers are installed, then the
* corresponding 'startElement' method is also called.</p>
*
* @param elemDecl A const reference to the object containing element
* declaration information.
* @param urlId An id referring to the namespace prefix, if
* namespaces setting is switched on.
* @param elemPrefix A const pointer to a Unicode string containing
* the namespace prefix for this element. Applicable
* only when namespace processing is enabled.
* @param attrList A const reference to the object containing the
* list of attributes just scanned for this element.
* @param attrCount A count of number of attributes in the list
* specified by the parameter 'attrList'.
* @param isEmpty A flag indicating whether this is an empty element
* or not.
* @param isRoot A flag indicating whether this element was the
* root element.
* @see DocumentHandler#startElement
*/
virtual void startElement
(
const XMLElementDecl& elemDecl
, const unsigned int urlId
, const XMLCh* const elemPrefix
, const RefVectorOf<XMLAttr>& attrList
, const XMLSize_t attrCount
, const bool isEmpty
, const bool isRoot
);
/**
* This method is used to indicate the start of an entity reference.
*
* <p>If any advanced callback handlers are installed, the
* corresponding 'endEntityReference' method is invoked.</p>
*
* @param entDecl A const reference to the object containing the
* entity declaration information.
*/
virtual void startEntityReference
(
const XMLEntityDecl& entDecl
);
/**
* This method is used to report the XML decl scanned by the parser.
* Refer to the XML specification to see the meaning of parameters.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param versionStr A const pointer to a Unicode string representing
* version string value.
* @param encodingStr A const pointer to a Unicode string representing
* the encoding string value.
* @param standaloneStr A const pointer to a Unicode string
* representing the standalone string value.
* @param actualEncodingStr A const pointer to a Unicode string
* representing the actual encoding string
* value.
*/
virtual void XMLDecl
(
const XMLCh* const versionStr
, const XMLCh* const encodingStr
, const XMLCh* const standaloneStr
, const XMLCh* const actualEncodingStr
);
//@}
// -----------------------------------------------------------------------
// Implementation of the XMLErrorReporter interface
// -----------------------------------------------------------------------
/** @name Implementation of the XMLErrorReporter Interface. */
//@{
/**
* This method is used to report back errors found while parsing the
* XML file. The driver will call the corresponding user installed
* SAX Error Handler methods: 'fatal', 'error', 'warning' depending
* on the severity of the error. This classification is defined by
* the XML specification.
*
* @param errCode An integer code for the error.
* @param msgDomain A const pointer to an Unicode string representing
* the message domain to use.
* @param errType An enumeration classifying the severity of the error.
* @param errorText A const pointer to an Unicode string representing
* the text of the error message.
* @param systemId A const pointer to an Unicode string representing
* the system id of the XML file where this error
* was discovered.
* @param publicId A const pointer to an Unicode string representing
* the public id of the XML file where this error
* was discovered.
* @param lineNum The line number where the error occurred.
* @param colNum The column number where the error occurred.
* @see ErrorHandler
*/
virtual void error
(
const unsigned int errCode
, const XMLCh* const msgDomain
, const XMLErrorReporter::ErrTypes errType
, const XMLCh* const errorText
, const XMLCh* const systemId
, const XMLCh* const publicId
, const XMLFileLoc lineNum
, const XMLFileLoc colNum
);
/**
* This method allows the user installed Error Handler
* callback to 'reset' itself.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
*/
virtual void resetErrors();
//@}
// -----------------------------------------------------------------------
// Implementation of the XMLEntityHandler interface
// -----------------------------------------------------------------------
/** @name Implementation of the XMLEntityHandler Interface. */
//@{
/**
* This method is used to indicate the end of parsing of an external
* entity file.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param inputSource A const reference to the InputSource object
* which points to the XML file being parsed.
* @see InputSource
*/
virtual void endInputSource(const InputSource& inputSource);
/**
* This method allows an installed XMLEntityHandler to further
* process any system id's of external entities encountered in
* the XML file being parsed, such as redirection etc.
*
* <b><font color="#FF0000">This method always returns 'false'
* for this SAX driver implementation.</font></b>
*
* @param systemId A const pointer to an Unicode string representing
* the system id scanned by the parser.
* @param toFill A pointer to a buffer in which the application
* processed system id is stored.
* @return 'true', if any processing is done, 'false' otherwise.
*/
virtual bool expandSystemId
(
const XMLCh* const systemId
, XMLBuffer& toFill
);
/**
* This method allows the installed XMLEntityHandler to reset
* itself.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*/
virtual void resetEntities();
/** Resolve a public/system id
*
* This method allows a user installed entity handler to further
* process any pointers to external entities. The applications can
* implement 'redirection' via this callback.
*
* @param resourceIdentifier An object containing the type of
* resource to be resolved and the associated data members
* corresponding to this type.
* @return The value returned by the user installed resolveEntity
* method or NULL otherwise to indicate no processing was done.
* The returned InputSource is owned by the parser which is
* responsible to clean up the memory.
* @see XMLEntityHandler
* @see XMLEntityResolver
*/
virtual InputSource* resolveEntity
(
XMLResourceIdentifier* resourceIdentifier
);
/**
* This method is used to indicate the start of parsing an
* external entity file.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param inputSource A const reference to the InputSource object
* which points to the external entity
* being parsed.
*/
virtual void startInputSource(const InputSource& inputSource);
//@}
// -----------------------------------------------------------------------
// Implementation of the Deprecated DocTypeHandler Interface
// -----------------------------------------------------------------------
/** @name Implementation of the deprecated DocTypeHandler Interface */
//@{
/**
* This method is used to report an attribute definition.
*
* <b><font color="#FF0000">This method is a no-op for this SAX
* driver implementation.</font></b>
*
* @param elemDecl A const reference to the object containing information
* about the element whose attribute definition was just
* parsed.
* @param attDef A const reference to the object containing information
* attribute definition.
* @param ignore The flag indicating whether this attribute definition
* was ignored by the parser or not.
*/
virtual void attDef
(
const DTDElementDecl& elemDecl
, const DTDAttDef& attDef
, const bool ignoring
);
/**
* This method is used to report a comment occurring within the DTD.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param comment A const pointer to a Unicode string representing the
* text of the comment just parsed.
*/
virtual void doctypeComment
(
const XMLCh* const comment
);
/**
* This method is used to report the DOCTYPE declaration.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param elemDecl A const reference to the object containing information
* about the root element definition declaration of the
* XML document being parsed.
* @param publicId A const pointer to a Unicode string representing the
* public id of the DTD file.
* @param systemId A const pointer to a Unicode string representing the
* system id of the DTD file.
* @param hasIntSubset A flag indicating if this XML file contains any
* internal subset.
* @param hasExtSubset A flag indicating if this XML file contains any
* external subset. Default is false.
*/
virtual void doctypeDecl
(
const DTDElementDecl& elemDecl
, const XMLCh* const publicId
, const XMLCh* const systemId
, const bool hasIntSubset
, const bool hasExtSubset = false
);
/**
* This method is used to report any PI declarations
* occurring inside the DTD definition block.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param target A const pointer to a Unicode string representing the
* target of the PI declaration.
* @param data A const pointer to a Unicode string representing the
* data of the PI declaration. See the PI production rule
* in the XML specification for details.
*/
virtual void doctypePI
(
const XMLCh* const target
, const XMLCh* const data
);
/**
* This method is used to report any whitespaces
* occurring inside the DTD definition block.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param chars A const pointer to a Unicode string representing the
* whitespace characters.
* @param length The length of the whitespace Unicode string.
*/
virtual void doctypeWhitespace
(
const XMLCh* const chars
, const XMLSize_t length
);
/**
* This method is used to report an element declarations
* successfully scanned by the parser.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param decl A const reference to the object containing element
* declaration information.
* @param isIgnored The flag indicating whether this definition was
* ignored by the parser or not.
*/
virtual void elementDecl
(
const DTDElementDecl& decl
, const bool isIgnored
);
/**
* This method is used to report the end of an attribute
* list declaration for an element.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param elemDecl A const reference to the object containing element
* declaration information.
*/
virtual void endAttList
(
const DTDElementDecl& elemDecl
);
/**
* This method is used to report the end of the internal subset.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*/
virtual void endIntSubset();
/**
* This method is used to report the end of the external subset.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*/
virtual void endExtSubset();
/**
* This method is used to report any entity declarations.
* For unparsed entities, this driver will invoke the
* SAX DTDHandler::unparsedEntityDecl callback.
*
* @param entityDecl A const reference to the object containing
* the entity declaration information.
* @param isPEDecl The flag indicating whether this was a
* parameter entity declaration or not.
* @param isIgnored The flag indicating whether this definition
* was ignored by the parser or not.
*
* @see DTDHandler#unparsedEntityDecl
*/
virtual void entityDecl
(
const DTDEntityDecl& entityDecl
, const bool isPEDecl
, const bool isIgnored
);
/**
* This method allows the user installed DTD handler to
* reset itself.
*/
virtual void resetDocType();
/**
* This method is used to report any notation declarations.
* If there is a user installed DTDHandler, then the driver will
* invoke the SAX DTDHandler::notationDecl callback.
*
* @param notDecl A const reference to the object containing the notation
* declaration information.
* @param isIgnored The flag indicating whether this definition was ignored
* by the parser or not.
*
* @see DTDHandler#notationDecl
*/
virtual void notationDecl
(
const XMLNotationDecl& notDecl
, const bool isIgnored
);
/**
* This method is used to indicate the start of an element's attribute
* list declaration.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param elemDecl A const reference to the object containing element
* declaration information.
*/
virtual void startAttList
(
const DTDElementDecl& elemDecl
);
/**
* This method is used indicate the start of the internal subset.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*/
virtual void startIntSubset();
/**
* This method is used indicate the start of the external subset.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*/
virtual void startExtSubset();
/**
* This method is used to report the TextDecl. Refer to the XML
* specification for the syntax of a TextDecl.
*
* <b><font color="#FF0000">This method is a no-op for this SAX driver
* implementation.</font></b>
*
* @param versionStr A const pointer to a Unicode string representing
* the version number of the 'version' clause.
* @param encodingStr A const pointer to a Unicode string representing
* the encoding name of the 'encoding' clause.
*/
virtual void TextDecl
(
const XMLCh* const versionStr
, const XMLCh* const encodingStr
);
//@}
private :
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
SAX2XMLReaderImpl(const SAX2XMLReaderImpl&);
SAX2XMLReaderImpl& operator=(const SAX2XMLReaderImpl&);
// -----------------------------------------------------------------------
// Initialize/Cleanup methods
// -----------------------------------------------------------------------
void initialize();
void cleanUp();
void resetInProgress();
// -----------------------------------------------------------------------
// Private data members
//
// fAttrList
// A temporary implementation of the basic SAX2 Attributes
// interface. We use this one over and over on each startElement
// event to allow SAX-like access to the element attributes.
//
// fDocHandler
// The installed SAX content handler, if any. Null if none.
//
// fnamespacePrefix
// Indicates whether the namespace-prefix feature is on or off.
//
// fautoValidation
// Indicates whether automatic validation is on or off
//
// fValidation
// Indicates whether the 'validation' core features is on or off
//
// fReuseGrammar
// Tells the parser whether it should reuse the grammar or not.
// If true, there cannot be any internal subset.
//
// fPrefixesStorage
// the namespace prefixes will be allocated from this pool
//
// fPrefixes
// A Stack of the current namespace prefixes that need calls to
// endPrefixMapping
//
// fPrefixCounts
// A Stack of the number of prefixes that need endPrefixMapping
// calls for that element
//
// fDTDHandler
// The installed SAX DTD handler, if any. Null if none.
//
// fElemDepth
// This is used to track the element nesting depth, so that we can
// know when we are inside content. This is so we can ignore char
// data outside of content.
//
// fEntityResolver
// The installed SAX entity handler, if any. Null if none.
//
// fErrorHandler
// The installed SAX error handler, if any. Null if none.
//
// fLexicalHandler
// The installed SAX lexical handler, if any. Null if none.
//
// fDecllHandler
// The installed SAX declaration handler, if any. Null if none.
//
// fAdvDHCount
// fAdvDHList
// fAdvDHListSize
// This is an array of pointers to XMLDocumentHandlers, which is
// how we see installed advanced document handlers. There will
// usually not be very many at all, so a simple array is used
// instead of a collection, for performance. It will grow if needed,
// but that is unlikely.
//
// The count is how many handlers are currently installed. The size
// is how big the array itself is (for expansion purposes.) When
// count == size, is time to expand.
//
// fParseInProgress
// This flag is set once a parse starts. It is used to prevent
// multiple entrance or reentrance of the parser.
//
// fScanner
// The scanner being used by this parser. It is created internally
// during construction.
//
// fHasExternalSubset
// Indicate if the document has external DTD subset.
//
// fGrammarPool
// The grammar pool passed from external application (through derivatives).
// which could be 0, not owned.
//
// -----------------------------------------------------------------------
bool fNamespacePrefix;
bool fAutoValidation;
bool fValidation;
bool fParseInProgress;
bool fHasExternalSubset;
XMLSize_t fElemDepth;
XMLSize_t fAdvDHCount;
XMLSize_t fAdvDHListSize;
VecAttributesImpl fAttrList ;
ContentHandler* fDocHandler ;
RefVectorOf<XMLAttr>* fTempAttrVec ;
XMLStringPool* fPrefixesStorage ;
ValueStackOf<unsigned int>* fPrefixes ;
ValueStackOf<XMLSize_t>* fPrefixCounts ;
XMLBuffer* fTempQName;
DTDHandler* fDTDHandler;
EntityResolver* fEntityResolver;
XMLEntityResolver* fXMLEntityResolver;
ErrorHandler* fErrorHandler;
PSVIHandler* fPSVIHandler;
LexicalHandler* fLexicalHandler;
DeclHandler* fDeclHandler;
XMLDocumentHandler** fAdvDHList;
XMLScanner* fScanner;
GrammarResolver* fGrammarResolver;
XMLStringPool* fURIStringPool;
XMLValidator* fValidator;
MemoryManager* fMemoryManager;
XMLGrammarPool* fGrammarPool;
// -----------------------------------------------------------------------
// internal function used to set the state of the parser
// -----------------------------------------------------------------------
void setValidationScheme(const ValSchemes newScheme);
void setDoNamespaces(const bool newState);
bool getDoNamespaces() const;
void setDoSchema(const bool newState);
bool getDoSchema() const;
};
// ---------------------------------------------------------------------------
// SAX2XMLReader: Getter methods
// ---------------------------------------------------------------------------
inline ContentHandler* SAX2XMLReaderImpl::getContentHandler() const
{
return fDocHandler;
}
inline DTDHandler* SAX2XMLReaderImpl::getDTDHandler() const
{
return fDTDHandler ;
}
inline EntityResolver* SAX2XMLReaderImpl::getEntityResolver() const
{
return fEntityResolver;
}
inline XMLEntityResolver* SAX2XMLReaderImpl::getXMLEntityResolver() const
{
return fXMLEntityResolver;
}
inline ErrorHandler* SAX2XMLReaderImpl::getErrorHandler() const
{
return fErrorHandler;
}
inline PSVIHandler* SAX2XMLReaderImpl::getPSVIHandler() const
{
return fPSVIHandler;
}
inline LexicalHandler* SAX2XMLReaderImpl::getLexicalHandler() const
{
return fLexicalHandler;
}
inline DeclHandler* SAX2XMLReaderImpl::getDeclarationHandler() const
{
return fDeclHandler;
}
inline bool SAX2XMLReaderImpl::getExitOnFirstFatalError() const
{
return fScanner->getExitOnFirstFatal();
}
inline bool SAX2XMLReaderImpl::getValidationConstraintFatal() const
{
return fScanner->getValidationConstraintFatal();
}
inline Grammar* SAX2XMLReaderImpl::getRootGrammar()
{
return fScanner->getRootGrammar();
}
inline const XMLCh* SAX2XMLReaderImpl::getURIText(unsigned int uriId) const
{
return fScanner->getURIText(uriId);
}
inline XMLFilePos SAX2XMLReaderImpl::getSrcOffset() const
{
return fScanner->getSrcOffset();
}
XERCES_CPP_NAMESPACE_END
#endif
|