/usr/include/xercesc/parsers/DOMBuilderImpl.hpp is in libxerces-c2-dev 2.8.0+deb1-2build3.
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 | /*
* 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: DOMBuilderImpl.hpp 569031 2007-08-23 15:05:28Z amassari $
*
*/
#if !defined(DOMBUILDERIMPL_HPP)
#define DOMBUILDERIMPL_HPP
#include <xercesc/parsers/AbstractDOMParser.hpp>
#include <xercesc/dom/DOMBuilder.hpp>
#include <xercesc/util/XercesDefs.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class XMLEntityResolver;
class XMLResourceIdentifier;
/**
* Introduced in DOM Level 3
*
* DOMBuilderImpl provides an implementation of a DOMBuilder interface.
* A DOMBuilder instance is obtained from the DOMImplementationLS interface
* by invoking its createDOMBuilder method.
*/
class PARSERS_EXPORT DOMBuilderImpl : public AbstractDOMParser,
public DOMBuilder
{
public :
// -----------------------------------------------------------------------
// Constructors and Detructor
// -----------------------------------------------------------------------
/** @name Constructors and Destructor */
//@{
/** Construct a DOMBuilderImpl, with an optional validator
*
* Constructor with an instance of validator class to use for
* validation. If you don't provide a validator, a default one will
* be created for you in the scanner.
*
* @param gramPool Pointer to the grammar pool instance from
* external application.
* The parser does NOT own it.
*
* @param valToAdopt Pointer to the validator instance to use. The
* parser is responsible for freeing the memory.
*/
DOMBuilderImpl
(
XMLValidator* const valToAdopt = 0
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
, XMLGrammarPool* const gramPool = 0
);
/**
* Destructor
*/
virtual ~DOMBuilderImpl();
//@}
// -----------------------------------------------------------------------
// Implementation of DOMBuilder interface
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
/** @name Getter methods */
//@{
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Get a pointer to the error handler
*
* This method returns the installed error handler. If no handler
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed error handler object.
*/
DOMErrorHandler* getErrorHandler();
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Get a const pointer to the error handler
*
* This method returns the installed error handler. If no handler
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed error handler object.
*/
const DOMErrorHandler* getErrorHandler() const;
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Get a pointer to the entity resolver
*
* This method returns the installed entity resolver. If no resolver
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed entity resolver object.
*/
DOMEntityResolver* getEntityResolver();
/**
* Get a pointer to the entity resolver
*
* This method returns the installed entity resolver. If no resolver
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed entity resolver object.
*/
XMLEntityResolver* getXMLEntityResolver();
/**
* Get a const pointer to the entity resolver
*
* This method returns the installed entity resolver. If no resolver
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed entity resolver object.
*/
const XMLEntityResolver* getXMLEntityResolver() const;
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Get a const pointer to the entity resolver
*
* This method returns the installed entity resolver. If no resolver
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed entity resolver object.
*/
const DOMEntityResolver* getEntityResolver() const;
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Get a pointer to the application filter
*
* This method returns the installed application filter. If no filter
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed application filter.
*/
DOMBuilderFilter* getFilter();
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Get a const pointer to the application filter
*
* This method returns the installed application filter. If no filter
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed application filter
*/
const DOMBuilderFilter* getFilter() const;
//@}
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
/** @name Setter methods */
//@{
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Set the error handler
*
* This method allows applications to install their own error handler
* to trap error and warning messages.
*
* <i>Any previously set handler is merely dropped, since the parser
* does not own them.</i>
*
* @param handler A const pointer to the user supplied error
* handler.
*
* @see #getErrorHandler
*/
void setErrorHandler(DOMErrorHandler* const handler);
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* 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 handler A const pointer to the user supplied entity
* resolver.
*
* @see #getEntityResolver
*/
void setEntityResolver(DOMEntityResolver* const handler);
/**
* 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 handler A const pointer to the user supplied entity
* resolver.
*
* @see #getXMLEntityResolver
*/
void setXMLEntityResolver(XMLEntityResolver* const handler);
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Set the application filter
*
* When the application provides a filter, the parser will call out to
* the filter at the completion of the construction of each Element node.
* The filter implementation can choose to remove the element from the
* document being constructed (unless the element is the document element)
* or to terminate the parse early. If the document is being validated
* when it's loaded the validation happens before the filter is called.
*
* <i>Any previously set filter is merely dropped, since the parser
* does not own them.</i>
*
* @param filter A const pointer to the user supplied application
* filter.
*
* @see #getFilter
*/
void setFilter(DOMBuilderFilter* const filter);
//@}
// -----------------------------------------------------------------------
// Feature methods
// -----------------------------------------------------------------------
/** @name Feature methods */
//@{
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Set the state of a feature
*
* It is possible for a DOMBuilder to recognize a feature name but to be
* unable to set its value.
*
* @param name The feature name.
* @param state The requested state of the feature (true or false).
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the DOMBuilder recognizes the
* feature name but cannot set the requested value.
* <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
* the feature name.
*
* @see #getFeature
* @see #canSetFeature
*/
void setFeature(const XMLCh* const name, const bool state);
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Look up the value of a feature.
*
* @param name The feature name.
* @return The current state of the feature (true or false)
* @exception DOMException
* NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
* the feature name.
*
* @see #setFeature
* @see #canSetFeature
*/
bool getFeature(const XMLCh* const name) const;
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Query whether setting a feature to a specific value is supported.
*
* @param name The feature name.
* @param state The requested state of the feature (true or false).
* @return <code>true</code> if the feature could be successfully set
* to the specified value, or <code>false</code> if the feature
* is not recognized or the requested value is not supported. The
* value of the feature itself is not changed.
*
* @see #getFeature
* @see #setFeature
*/
bool canSetFeature(const XMLCh* const name, const bool state) const;
//@}
// -----------------------------------------------------------------------
// Parsing methods
// -----------------------------------------------------------------------
/** @name Parsing methods */
//@{
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Parse via an input source object
*
* This method invokes the parsing process on the XML file specified
* by the DOMInputSource parameter. This API is borrowed from the
* SAX Parser interface.
*
* @param source A const reference to the DOMInputSource object which
* points to the XML file to be parsed.
* @return If the DOMBuilder is a synchronous DOMBuilder the newly created
* and populated Document is returned. If the DOMBuilder is
* asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @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 DOMInputSource#DOMInputSource
* @see #setEntityResolver
* @see #setErrorHandler
*/
DOMDocument* parse(const DOMInputSource& source);
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Parse via a file path or URL
*
* This method invokes the parsing process on the XML file specified by
* the Unicode string parameter 'systemId'.
*
* @param systemId A const XMLCh pointer to the Unicode string which
* contains the path to the XML file to be parsed.
* @return If the DOMBuilder is a synchronous DOMBuilder the newly created
* and populated Document is returned. If the DOMBuilder is
* asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOM_DOMException A DOM exception as per DOM spec.
*
* @see #parse(DOMInputSource,...)
*/
DOMDocument* parseURI(const XMLCh* const systemId);
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Parse via a file path or URL (in the local code page)
*
* This method invokes the parsing process on the XML file specified by
* the native char* string parameter 'systemId'.
*
* @param systemId A const char pointer to a native string which
* contains the path to the XML file to be parsed.
* @return If the DOMBuilder is a synchronous DOMBuilder the newly created
* and populated Document is returned. If the DOMBuilder is
* asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOM_DOMException A DOM exception as per DOM spec.
*
* @see #parse(DOMInputSource,...)
*/
DOMDocument* parseURI(const char* const systemId);
/**
* <p><b>"Experimental - subject to change"</b></p>
*
* Parse via an input source object
*
* This method invokes the parsing process on the XML file specified
* by the DOMInputSource parameter, and inserts the content into an
* existing document at the position specified with the contextNode
* and action arguments. When parsing the input stream the context node
* is used for resolving unbound namespace prefixes.
*
* @param source A const reference to the DOMInputSource object which
* points to the XML file to be parsed.
* @param contextNode The node that is used as the context for the data
* that is being parsed. This node must be a Document
* node, a DocumentFragment node, or a node of a type
* that is allowed as a child of an element, e.g. it
* can not be an attribute node.
* @param action This parameter describes which action should be taken
* between the new set of node being inserted and the
* existing children of the context node.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the DOMBuilder doesn't support
* this method.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is
* readonly.
*/
virtual void parseWithContext
(
const DOMInputSource& source
, DOMNode* const contextNode
, const short action
);
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
/** @name Non-standard Extension */
//@{
/**
* Query the current value of a property in a DOMBuilder.
*
* The builder owns the returned pointer. The memory allocated for
* the returned pointer will be destroyed when the builder is deleted.
*
* To ensure assessiblity of the returned information after the builder
* 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
* http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties 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 DOMException
* <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
* the requested property.
*/
virtual void* getProperty(const XMLCh* const name) const;
/**
* Set the value of any property in a DOMBuilder.
* See http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties for
* the list of supported properties.
*
* It takes a void pointer as the property value. Application is required to initialize this void
* pointer to a correct type. See http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties
* 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 http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties 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 DOMException
* <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
* the requested property.
*/
virtual void setProperty(const XMLCh* const name, void* value);
/**
* Called to indicate that this DOMBuilder is no longer in use
* and that the implementation may relinquish any resources associated with it.
*
*/
virtual void release();
/** Reset the documents vector pool and release all the associated memory
* back to the system.
*
* When parsing a document using a DOM parser, all memory allocated
* for a DOM tree is associated to the DOM document.
*
* If you do multiple parse using the same DOM parser instance, then
* multiple DOM documents will be generated and saved in a vector pool.
* All these documents (and thus all the allocated memory)
* won't be deleted until the parser instance is destroyed.
*
* If you don't need these DOM documents anymore and don't want to
* destroy the DOM parser instance at this moment, then you can call this method
* to reset the document vector pool and release all the allocated memory
* back to the system.
*
* It is an error to call this method if you are in the middle of a
* parse (e.g. in the mid of a progressive parse).
*
* @exception IOException An exception from the parser if this function
* is called when a parse is in progress.
*
*/
virtual void resetDocumentPool();
/**
* 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 DOMInputSource parameter. If the 'toCache' flag
* is enabled, the parser will cache the grammars for re-use. If a grammar
* key is found in the pool, no caching of any grammar will take place.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param source A const reference to the DOMInputSource 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 chaching. 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 DOMInputSource#DOMInputSource
*/
virtual Grammar* loadGrammar(const DOMInputSource& source,
const short 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. If the 'toCache' flag
* is enabled, the parser will cache the grammars for re-use. If a grammar
* key is found in the pool, no caching of any grammar will take place.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @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 chaching. 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 short 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. If the 'toCache' flag
* is enabled, the parser will cache the grammars for re-use. If a grammar
* key is found in the pool, no caching of any grammar will take place.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @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 chaching. 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 short grammarType,
const bool toCache = false);
/**
* 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) const;
/**
* Retrieve the grammar where the root element is declared.
*
* @return Grammar where root element declared
*/
virtual Grammar* getRootGrammar() const;
/**
* 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;
/**
* Clear the cached grammar pool
*/
virtual void resetCachedGrammarPool();
/**
* 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 unsigned int getSrcOffset() const;
//@}
// -----------------------------------------------------------------------
// Implementation of the XMLErrorReporter interface.
// -----------------------------------------------------------------------
/** @name Implementation of the XMLErrorReporter interface. */
//@{
/** Handle errors reported from the parser
*
* This method is used to report back errors found while parsing the
* XML file. This method is also borrowed from the SAX specification.
* It calls the corresponding user installed Error Handler method:
* '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 DOMErrorHandler
*/
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 XMLSSize_t lineNum
, const XMLSSize_t colNum
);
/** Reset any error data before a new parse
*
* This method allows the user installed Error Handler callback to
* 'reset' itself.
*
* <b><font color="#FF0000">This method is a no-op for this DOM
* implementation.</font></b>
*/
virtual void resetErrors();
//@}
// -----------------------------------------------------------------------
// Implementation of the XMLEntityHandler interface.
// -----------------------------------------------------------------------
/** @name Implementation of the XMLEntityHandler interface. */
//@{
/** Handle an end of input source event
*
* 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 DOM
* 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);
/** Expand a system id
*
* This method allows an installed XMLEntityHandler to further
* process any system id's of enternal entities encountered in
* the XML file being parsed, such as redirection etc.
*
* <b><font color="#FF0000">This method always returns 'false'
* for this DOM 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
);
/** Reset any entity handler information
*
* This method allows the installed XMLEntityHandler to reset
* itself.
*
* <b><font color="#FF0000">This method is a no-op for this DOM
* 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. This method is also
* borrowed from the SAX specification.
*
* @deprecated This method is no longer called (the other resolveEntity one is).
*
* @param publicId A const pointer to a Unicode string representing the
* public id of the entity just parsed.
* @param systemId A const pointer to a Unicode string representing the
* system id of the entity just parsed.
* @param baseURI A const pointer to a Unicode string representing the
* base URI of the entity just parsed,
* or <code>null</code> if there is no base URI.
* @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 DOMBuilder which is
* responsible to clean up the memory.
* @see DOMEntityResolver
* @see XMLEntityHandler
*/
virtual InputSource* resolveEntity
(
const XMLCh* const publicId
, const XMLCh* const systemId
, const XMLCh* const baseURI = 0
);
/** 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
);
/** Handle a 'start input source' event
*
* 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 DOM parse
* 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);
//@}
private :
// -----------------------------------------------------------------------
// Initialize/Cleanup methods
// -----------------------------------------------------------------------
void resetParse();
// -----------------------------------------------------------------------
// Private data members
//
// fEntityResolver
// The installed DOM entity resolver, if any. Null if none.
//
// fErrorHandler
// The installed DOM error handler, if any. Null if none.
//
// fFilter
// The installed application filter, if any. Null if none.
//
// fCharsetOverridesXMLEncoding
// Indicates if the "charset-overrides-xml-encoding" is set or not
//
// fUserAdoptsDocument
// The DOMDocument ownership has been transferred to application
// If set to true, the parser does not own the document anymore
// and thus will not release its memory.
//-----------------------------------------------------------------------
bool fAutoValidation;
bool fValidation;
DOMEntityResolver* fEntityResolver;
XMLEntityResolver* fXMLEntityResolver;
DOMErrorHandler* fErrorHandler;
DOMBuilderFilter* fFilter;
bool fCharsetOverridesXMLEncoding;
bool fUserAdoptsDocument;
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
DOMBuilderImpl(const DOMBuilderImpl &);
DOMBuilderImpl & operator = (const DOMBuilderImpl &);
};
// ---------------------------------------------------------------------------
// DOMBuilderImpl: Handlers for the XMLEntityHandler interface
// ---------------------------------------------------------------------------
inline void DOMBuilderImpl::endInputSource(const InputSource&)
{
// The DOM entity resolver doesn't handle this
}
inline bool DOMBuilderImpl::expandSystemId(const XMLCh* const, XMLBuffer&)
{
// The DOM entity resolver doesn't handle this
return false;
}
inline void DOMBuilderImpl::resetEntities()
{
// Nothing to do on this one
}
inline void DOMBuilderImpl::startInputSource(const InputSource&)
{
// The DOM entity resolver doesn't handle this
}
// ---------------------------------------------------------------------------
// DOMBuilderImpl: Getter methods
// ---------------------------------------------------------------------------
inline DOMErrorHandler* DOMBuilderImpl::getErrorHandler()
{
return fErrorHandler;
}
inline const DOMErrorHandler* DOMBuilderImpl::getErrorHandler() const
{
return fErrorHandler;
}
inline DOMEntityResolver* DOMBuilderImpl::getEntityResolver()
{
return fEntityResolver;
}
inline const DOMEntityResolver* DOMBuilderImpl::getEntityResolver() const
{
return fEntityResolver;
}
inline XMLEntityResolver* DOMBuilderImpl::getXMLEntityResolver()
{
return fXMLEntityResolver;
}
inline const XMLEntityResolver* DOMBuilderImpl::getXMLEntityResolver() const
{
return fXMLEntityResolver;
}
inline DOMBuilderFilter* DOMBuilderImpl::getFilter()
{
return fFilter;
}
inline const DOMBuilderFilter* DOMBuilderImpl::getFilter() const
{
return fFilter;
}
XERCES_CPP_NAMESPACE_END
#endif
|