PageRenderTime 54ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/ATF2/control-software/epics-3.14.8/extensions/src/ChannelArchiver/ThirdParty/xerces-c-src2_4_0/src/xercesc/internal/WFXMLScanner.cpp

http://atf2flightsim.googlecode.com/
C++ | 1863 lines | 1233 code | 202 blank | 428 comment | 272 complexity | 0ef386fc20d60e24eb5ea78c005547f0 MD5 | raw file
Possible License(s): BSD-2-Clause, LGPL-2.0, IPL-1.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. * Copyright (c) 2002,2003 The Apache Software Foundation. All rights
  5. * reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. *
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the
  17. * distribution.
  18. *
  19. * 3. The end-user documentation included with the redistribution,
  20. * if any, must include the following acknowledgment:
  21. * "This product includes software developed by the
  22. * Apache Software Foundation (http://www.apache.org/)."
  23. * Alternately, this acknowledgment may appear in the software itself,
  24. * if and wherever such third-party acknowledgments normally appear.
  25. *
  26. * 4. The names "Xerces" and "Apache Software Foundation" must
  27. * not be used to endorse or promote products derived from this
  28. * software without prior written permission. For written
  29. * permission, please contact apache\@apache.org.
  30. *
  31. * 5. Products derived from this software may not be called "Apache",
  32. * nor may "Apache" appear in their name, without prior written
  33. * permission of the Apache Software Foundation.
  34. *
  35. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46. * SUCH DAMAGE.
  47. * ====================================================================
  48. *
  49. * This software consists of voluntary contributions made by many
  50. * individuals on behalf of the Apache Software Foundation, and was
  51. * originally based on software copyright (c) 1999, International
  52. * Business Machines, Inc., http://www.ibm.com . For more information
  53. * on the Apache Software Foundation, please see
  54. * <http://www.apache.org/>.
  55. */
  56. /*
  57. * $Id: WFXMLScanner.cpp,v 1.1.1.1 2009/03/14 06:42:19 whitegr Exp $
  58. */
  59. // ---------------------------------------------------------------------------
  60. // Includes
  61. // ---------------------------------------------------------------------------
  62. #include <xercesc/internal/WFXMLScanner.hpp>
  63. #include <xercesc/util/Janitor.hpp>
  64. #include <xercesc/util/RuntimeException.hpp>
  65. #include <xercesc/util/UnexpectedEOFException.hpp>
  66. #include <xercesc/sax/InputSource.hpp>
  67. #include <xercesc/framework/XMLDocumentHandler.hpp>
  68. #include <xercesc/framework/XMLEntityHandler.hpp>
  69. #include <xercesc/framework/XMLPScanToken.hpp>
  70. #include <xercesc/framework/XMLValidityCodes.hpp>
  71. #include <xercesc/internal/EndOfEntityException.hpp>
  72. #include <xercesc/util/OutOfMemoryException.hpp>
  73. XERCES_CPP_NAMESPACE_BEGIN
  74. // ---------------------------------------------------------------------------
  75. // WFXMLScanner: Constructors and Destructor
  76. // ---------------------------------------------------------------------------
  77. WFXMLScanner::WFXMLScanner( XMLValidator* const valToAdopt
  78. , GrammarResolver* const grammarResolver
  79. , MemoryManager* const manager) :
  80. XMLScanner(valToAdopt, grammarResolver, manager)
  81. , fElementIndex(0)
  82. , fElements(0)
  83. , fEntityTable(0)
  84. , fAttrNameHashList(0)
  85. , fAttrNSList(0)
  86. , fElementLookup(0)
  87. {
  88. try
  89. {
  90. commonInit();
  91. }
  92. catch(const OutOfMemoryException&)
  93. {
  94. throw;
  95. }
  96. catch(...)
  97. {
  98. cleanUp();
  99. throw;
  100. }
  101. }
  102. WFXMLScanner::WFXMLScanner( XMLDocumentHandler* const docHandler
  103. , DocTypeHandler* const docTypeHandler
  104. , XMLEntityHandler* const entityHandler
  105. , XMLErrorReporter* const errHandler
  106. , XMLValidator* const valToAdopt
  107. , GrammarResolver* const grammarResolver
  108. , MemoryManager* const manager) :
  109. XMLScanner(docHandler, docTypeHandler, entityHandler, errHandler, valToAdopt, grammarResolver, manager)
  110. , fElementIndex(0)
  111. , fElements(0)
  112. , fEntityTable(0)
  113. , fAttrNameHashList(0)
  114. , fAttrNSList(0)
  115. , fElementLookup(0)
  116. {
  117. try
  118. {
  119. commonInit();
  120. }
  121. catch(const OutOfMemoryException&)
  122. {
  123. throw;
  124. }
  125. catch(...)
  126. {
  127. cleanUp();
  128. throw;
  129. }
  130. }
  131. WFXMLScanner::~WFXMLScanner()
  132. {
  133. cleanUp();
  134. }
  135. // ---------------------------------------------------------------------------
  136. // XMLScanner: Getter methods
  137. // ---------------------------------------------------------------------------
  138. NameIdPool<DTDEntityDecl>* WFXMLScanner::getEntityDeclPool()
  139. {
  140. return 0;
  141. }
  142. const NameIdPool<DTDEntityDecl>* WFXMLScanner::getEntityDeclPool() const
  143. {
  144. return 0;
  145. }
  146. // ---------------------------------------------------------------------------
  147. // WFXMLScanner: Main entry point to scan a document
  148. // ---------------------------------------------------------------------------
  149. void WFXMLScanner::scanDocument(const InputSource& src)
  150. {
  151. // Bump up the sequence id for this parser instance. This will invalidate
  152. // any previous progressive scan tokens.
  153. fSequenceId++;
  154. try
  155. {
  156. // Reset the scanner and its plugged in stuff for a new run. This
  157. // resets all the data structures, creates the initial reader and
  158. // pushes it on the stack, and sets up the base document path.
  159. scanReset(src);
  160. // If we have a document handler, then call the start document
  161. if (fDocHandler)
  162. fDocHandler->startDocument();
  163. // Scan the prolog part, which is everything before the root element
  164. // including the DTD subsets.
  165. scanProlog();
  166. // If we got to the end of input, then its not a valid XML file.
  167. // Else, go on to scan the content.
  168. if (fReaderMgr.atEOF())
  169. {
  170. emitError(XMLErrs::EmptyMainEntity);
  171. }
  172. else
  173. {
  174. // Scan content, and tell it its not an external entity
  175. if (scanContent(false))
  176. {
  177. // That went ok, so scan for any miscellaneous stuff
  178. if (!fReaderMgr.atEOF())
  179. scanMiscellaneous();
  180. }
  181. }
  182. // If we have a document handler, then call the end document
  183. if (fDocHandler)
  184. fDocHandler->endDocument();
  185. // Reset the reader manager to close all files, sockets, etc...
  186. fReaderMgr.reset();
  187. }
  188. // NOTE:
  189. //
  190. // In all of the error processing below, the emitError() call MUST come
  191. // before the flush of the reader mgr, or it will fail because it tries
  192. // to find out the position in the XML source of the error.
  193. catch(const XMLErrs::Codes)
  194. {
  195. // This is a 'first fatal error' type exit, so reset and fall through
  196. fReaderMgr.reset();
  197. }
  198. catch(const XMLValid::Codes)
  199. {
  200. // This is a 'first fatal error' type exit, so reset and fall through
  201. fReaderMgr.reset();
  202. }
  203. catch(const XMLException& excToCatch)
  204. {
  205. // Emit the error and catch any user exception thrown from here. Make
  206. // sure in all cases we flush the reader manager.
  207. fInException = true;
  208. try
  209. {
  210. if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning)
  211. emitError
  212. (
  213. XMLErrs::XMLException_Warning
  214. , excToCatch.getType()
  215. , excToCatch.getMessage()
  216. );
  217. else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal)
  218. emitError
  219. (
  220. XMLErrs::XMLException_Fatal
  221. , excToCatch.getType()
  222. , excToCatch.getMessage()
  223. );
  224. else
  225. emitError
  226. (
  227. XMLErrs::XMLException_Error
  228. , excToCatch.getType()
  229. , excToCatch.getMessage()
  230. );
  231. }
  232. catch(const OutOfMemoryException&)
  233. {
  234. throw;
  235. }
  236. catch(...)
  237. {
  238. // Flush the reader manager and rethrow user's error
  239. fReaderMgr.reset();
  240. throw;
  241. }
  242. // If it returned, then reset the reader manager and fall through
  243. fReaderMgr.reset();
  244. }
  245. catch(const OutOfMemoryException&)
  246. {
  247. throw;
  248. }
  249. catch(...)
  250. {
  251. // Reset and rethrow
  252. fReaderMgr.reset();
  253. throw;
  254. }
  255. }
  256. bool WFXMLScanner::scanNext(XMLPScanToken& token)
  257. {
  258. // Make sure this token is still legal
  259. if (!isLegalToken(token))
  260. ThrowXML(RuntimeException, XMLExcepts::Scan_BadPScanToken);
  261. // Find the next token and remember the reader id
  262. unsigned int orgReader;
  263. XMLTokens curToken;
  264. bool retVal = true;
  265. try
  266. {
  267. while (true)
  268. {
  269. // We have to handle any end of entity exceptions that happen here.
  270. // We could be at the end of X nested entities, each of which will
  271. // generate an end of entity exception as we try to move forward.
  272. try
  273. {
  274. curToken = senseNextToken(orgReader);
  275. break;
  276. }
  277. catch(const EndOfEntityException& toCatch)
  278. {
  279. // Send an end of entity reference event
  280. if (fDocHandler)
  281. fDocHandler->endEntityReference(toCatch.getEntity());
  282. }
  283. }
  284. if (curToken == Token_CharData)
  285. {
  286. scanCharData(fCDataBuf);
  287. }
  288. else if (curToken == Token_EOF)
  289. {
  290. if (!fElemStack.isEmpty())
  291. {
  292. const ElemStack::StackElem* topElem = fElemStack.popTop();
  293. emitError
  294. (
  295. XMLErrs::EndedWithTagsOnStack
  296. , topElem->fThisElement->getFullName()
  297. );
  298. }
  299. retVal = false;
  300. }
  301. else
  302. {
  303. // Its some sort of markup
  304. bool gotData = true;
  305. switch(curToken)
  306. {
  307. case Token_CData :
  308. // Make sure we are within content
  309. if (fElemStack.isEmpty())
  310. emitError(XMLErrs::CDATAOutsideOfContent);
  311. scanCDSection();
  312. break;
  313. case Token_Comment :
  314. scanComment();
  315. break;
  316. case Token_EndTag :
  317. scanEndTag(gotData);
  318. break;
  319. case Token_PI :
  320. scanPI();
  321. break;
  322. case Token_StartTag :
  323. if (fDoNamespaces)
  324. scanStartTagNS(gotData);
  325. else
  326. scanStartTag(gotData);
  327. break;
  328. default :
  329. fReaderMgr.skipToChar(chOpenAngle);
  330. break;
  331. }
  332. if (orgReader != fReaderMgr.getCurrentReaderNum())
  333. emitError(XMLErrs::PartialMarkupInEntity);
  334. // If we hit the end, then do the miscellaneous part
  335. if (!gotData)
  336. {
  337. // That went ok, so scan for any miscellaneous stuff
  338. scanMiscellaneous();
  339. if (fDocHandler)
  340. fDocHandler->endDocument();
  341. }
  342. }
  343. }
  344. // NOTE:
  345. //
  346. // In all of the error processing below, the emitError() call MUST come
  347. // before the flush of the reader mgr, or it will fail because it tries
  348. // to find out the position in the XML source of the error.
  349. catch(const XMLErrs::Codes)
  350. {
  351. // This is a 'first failure' exception, so reset and return failure
  352. fReaderMgr.reset();
  353. return false;
  354. }
  355. catch(const XMLValid::Codes)
  356. {
  357. // This is a 'first fatal error' type exit, so reset and reuturn failure
  358. fReaderMgr.reset();
  359. return false;
  360. }
  361. catch(const XMLException& excToCatch)
  362. {
  363. // Emit the error and catch any user exception thrown from here. Make
  364. // sure in all cases we flush the reader manager.
  365. fInException = true;
  366. try
  367. {
  368. if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning)
  369. emitError
  370. (
  371. XMLErrs::XMLException_Warning
  372. , excToCatch.getType()
  373. , excToCatch.getMessage()
  374. );
  375. else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal)
  376. emitError
  377. (
  378. XMLErrs::XMLException_Fatal
  379. , excToCatch.getType()
  380. , excToCatch.getMessage()
  381. );
  382. else
  383. emitError
  384. (
  385. XMLErrs::XMLException_Error
  386. , excToCatch.getType()
  387. , excToCatch.getMessage()
  388. );
  389. }
  390. catch(const OutOfMemoryException&)
  391. {
  392. throw;
  393. }
  394. catch(...)
  395. {
  396. // Reset and rethrow user error
  397. fReaderMgr.reset();
  398. throw;
  399. }
  400. // Reset and return failure
  401. fReaderMgr.reset();
  402. return false;
  403. }
  404. catch(const OutOfMemoryException&)
  405. {
  406. throw;
  407. }
  408. catch(...)
  409. {
  410. // Reset and rethrow original error
  411. fReaderMgr.reset();
  412. throw;
  413. }
  414. // If we hit the end, then flush the reader manager
  415. if (!retVal)
  416. fReaderMgr.reset();
  417. return retVal;
  418. }
  419. // ---------------------------------------------------------------------------
  420. // WFXMLScanner: Private helper methods.
  421. // ---------------------------------------------------------------------------
  422. // This method handles the common initialization, to avoid having to do
  423. // it redundantly in multiple constructors.
  424. void WFXMLScanner::commonInit()
  425. {
  426. fEntityTable = new (fMemoryManager) ValueHashTableOf<XMLCh>(11, fMemoryManager);
  427. fAttrNameHashList = new (fMemoryManager)ValueVectorOf<unsigned int>(16, fMemoryManager);
  428. fAttrNSList = new (fMemoryManager) ValueVectorOf<XMLAttr*>(8, fMemoryManager);
  429. fElements = new (fMemoryManager) RefVectorOf<XMLElementDecl>(32, true, fMemoryManager);
  430. fElementLookup = new (fMemoryManager) RefHashTableOf<XMLElementDecl>(109, false, fMemoryManager);
  431. // Add the default entity entries for the character refs that must always
  432. // be present.
  433. fEntityTable->put((void*) XMLUni::fgAmp, chAmpersand);
  434. fEntityTable->put((void*) XMLUni::fgLT, chOpenAngle);
  435. fEntityTable->put((void*) XMLUni::fgGT, chCloseAngle);
  436. fEntityTable->put((void*) XMLUni::fgQuot, chDoubleQuote);
  437. fEntityTable->put((void*) XMLUni::fgApos, chSingleQuote);
  438. }
  439. void WFXMLScanner::cleanUp()
  440. {
  441. delete fEntityTable;
  442. delete fAttrNameHashList;
  443. delete fAttrNSList;
  444. delete fElementLookup;
  445. delete fElements;
  446. }
  447. unsigned int
  448. WFXMLScanner::resolvePrefix(const XMLCh* const prefix
  449. , const ElemStack::MapModes mode)
  450. {
  451. // Watch for the special namespace prefixes. We always map these to
  452. // special URIs. 'xml' gets mapped to the official URI that its defined
  453. // to map to by the NS spec. xmlns gets mapped to a special place holder
  454. // URI that we define (so that it maps to something checkable.)
  455. if (XMLString::equals(prefix, XMLUni::fgXMLNSString))
  456. return fXMLNSNamespaceId;
  457. else if (XMLString::equals(prefix, XMLUni::fgXMLString))
  458. return fXMLNamespaceId;
  459. // Ask the element stack to search up itself for a mapping for the
  460. // passed prefix.
  461. bool unknown;
  462. unsigned int uriId = fElemStack.mapPrefixToURI(prefix, mode, unknown);
  463. // If it was unknown, then the URI was faked in but we have to issue an error
  464. if (unknown)
  465. emitError(XMLErrs::UnknownPrefix, prefix);
  466. return uriId;
  467. }
  468. // This method will reset the scanner data structures, and related plugged
  469. // in stuff, for a new scan session. We get the input source for the primary
  470. // XML entity, create the reader for it, and push it on the stack so that
  471. // upon successful return from here we are ready to go.
  472. void WFXMLScanner::scanReset(const InputSource& src)
  473. {
  474. // For all installed handlers, send reset events. This gives them
  475. // a chance to flush any cached data.
  476. if (fDocHandler)
  477. fDocHandler->resetDocument();
  478. if (fEntityHandler)
  479. fEntityHandler->resetEntities();
  480. if (fErrorReporter)
  481. fErrorReporter->resetErrors();
  482. // Reset the element stack, and give it the latest ids for the special
  483. // URIs it has to know about.
  484. fElemStack.reset
  485. (
  486. fEmptyNamespaceId
  487. , fUnknownNamespaceId
  488. , fXMLNamespaceId
  489. , fXMLNSNamespaceId
  490. );
  491. // Reset some status flags
  492. fInException = false;
  493. fStandalone = false;
  494. fErrorCount = 0;
  495. fHasNoDTD = true;
  496. fElementIndex = 0;
  497. // Reset elements lookup table
  498. fElementLookup->removeAll();
  499. // Handle the creation of the XML reader object for this input source.
  500. // This will provide us with transcoding and basic lexing services.
  501. XMLReader* newReader = fReaderMgr.createReader
  502. (
  503. src
  504. , true
  505. , XMLReader::RefFrom_NonLiteral
  506. , XMLReader::Type_General
  507. , XMLReader::Source_External
  508. , fCalculateSrcOfs
  509. );
  510. if (!newReader) {
  511. if (src.getIssueFatalErrorIfNotFound())
  512. ThrowXML1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId());
  513. else
  514. ThrowXML1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId());
  515. }
  516. // Push this read onto the reader manager
  517. fReaderMgr.pushReader(newReader, 0);
  518. // and reset security-related things if necessary:
  519. if(fSecurityManager != 0)
  520. {
  521. fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit();
  522. fEntityExpansionCount = 0;
  523. }
  524. }
  525. // This method is called between markup in content. It scans for character
  526. // data that is sent to the document handler. It watches for any markup
  527. // characters that would indicate that the character data has ended. It also
  528. // handles expansion of general and character entities.
  529. //
  530. // sendData() is a local static helper for this method which handles some
  531. // code that must be done in three different places here.
  532. void WFXMLScanner::sendCharData(XMLBuffer& toSend)
  533. {
  534. // If no data in the buffer, then nothing to do
  535. if (toSend.isEmpty())
  536. return;
  537. // Always assume its just char data if not validating
  538. if (fDocHandler)
  539. fDocHandler->docCharacters(toSend.getRawBuffer(), toSend.getLen(), false);
  540. // Reset buffer
  541. toSend.reset();
  542. }
  543. // ---------------------------------------------------------------------------
  544. // WFXMLScanner: Private scanning methods
  545. // ---------------------------------------------------------------------------
  546. // This method will kick off the scanning of the primary content of the
  547. // document, i.e. the elements.
  548. bool WFXMLScanner::scanContent(const bool extEntity)
  549. {
  550. // Go into a loop until we hit the end of the root element, or we fall
  551. // out because there is no root element.
  552. //
  553. // We have to do kind of a deeply nested double loop here in order to
  554. // avoid doing the setup/teardown of the exception handler on each
  555. // round. Doing it this way we only do it when an exception actually
  556. // occurs.
  557. bool gotData = true;
  558. bool inMarkup = false;
  559. while (gotData)
  560. {
  561. try
  562. {
  563. while (gotData)
  564. {
  565. // Sense what the next top level token is. According to what
  566. // this tells us, we will call something to handle that kind
  567. // of thing.
  568. unsigned int orgReader;
  569. const XMLTokens curToken = senseNextToken(orgReader);
  570. // Handle character data and end of file specially. Char data
  571. // is not markup so we don't want to handle it in the loop
  572. // below.
  573. if (curToken == Token_CharData)
  574. {
  575. // Scan the character data and call appropriate events. Let
  576. // him use our local character data buffer for efficiency.
  577. scanCharData(fCDataBuf);
  578. continue;
  579. }
  580. else if (curToken == Token_EOF)
  581. {
  582. // The element stack better be empty at this point or we
  583. // ended prematurely before all elements were closed.
  584. if (!fElemStack.isEmpty())
  585. {
  586. const ElemStack::StackElem* topElem = fElemStack.popTop();
  587. emitError
  588. (
  589. XMLErrs::EndedWithTagsOnStack
  590. , topElem->fThisElement->getFullName()
  591. );
  592. }
  593. // Its the end of file, so clear the got data flag
  594. gotData = false;
  595. continue;
  596. }
  597. // We are in some sort of markup now
  598. inMarkup = true;
  599. // According to the token we got, call the appropriate
  600. // scanning method.
  601. switch(curToken)
  602. {
  603. case Token_CData :
  604. // Make sure we are within content
  605. if (fElemStack.isEmpty())
  606. emitError(XMLErrs::CDATAOutsideOfContent);
  607. scanCDSection();
  608. break;
  609. case Token_Comment :
  610. scanComment();
  611. break;
  612. case Token_EndTag :
  613. scanEndTag(gotData);
  614. break;
  615. case Token_PI :
  616. scanPI();
  617. break;
  618. case Token_StartTag :
  619. if (fDoNamespaces)
  620. scanStartTagNS(gotData);
  621. else
  622. scanStartTag(gotData);
  623. break;
  624. default :
  625. fReaderMgr.skipToChar(chOpenAngle);
  626. break;
  627. }
  628. if (orgReader != fReaderMgr.getCurrentReaderNum())
  629. emitError(XMLErrs::PartialMarkupInEntity);
  630. // And we are back out of markup again
  631. inMarkup = false;
  632. }
  633. }
  634. catch(const EndOfEntityException& toCatch)
  635. {
  636. // If we were in some markup when this happened, then its a
  637. // partial markup error.
  638. if (inMarkup)
  639. emitError(XMLErrs::PartialMarkupInEntity);
  640. // Send an end of entity reference event
  641. if (fDocHandler)
  642. fDocHandler->endEntityReference(toCatch.getEntity());
  643. inMarkup = false;
  644. }
  645. }
  646. // It went ok, so return success
  647. return true;
  648. }
  649. void WFXMLScanner::scanEndTag(bool& gotData)
  650. {
  651. // Assume we will still have data until proven otherwise. It will only
  652. // ever be false if this is the end of the root element.
  653. gotData = true;
  654. // Check if the element stack is empty. If so, then this is an unbalanced
  655. // element (i.e. more ends than starts, perhaps because of bad text
  656. // causing one to be skipped.)
  657. if (fElemStack.isEmpty())
  658. {
  659. emitError(XMLErrs::MoreEndThanStartTags);
  660. fReaderMgr.skipPastChar(chCloseAngle);
  661. ThrowXML(RuntimeException, XMLExcepts::Scan_UnbalancedStartEnd);
  662. }
  663. // Pop the stack of the element we are supposed to be ending. Remember
  664. // that we don't own this. The stack just keeps them and reuses them.
  665. unsigned int uriId = (fDoNamespaces)
  666. ? fElemStack.getCurrentURI() : fEmptyNamespaceId;
  667. const ElemStack::StackElem* topElem = fElemStack.popTop();
  668. // See if it was the root element, to avoid multiple calls below
  669. const bool isRoot = fElemStack.isEmpty();
  670. // Make sure that its the end of the element that we expect
  671. if (!fReaderMgr.skippedString(topElem->fThisElement->getFullName()))
  672. {
  673. emitError
  674. (
  675. XMLErrs::ExpectedEndOfTagX
  676. , topElem->fThisElement->getFullName()
  677. );
  678. fReaderMgr.skipPastChar(chCloseAngle);
  679. return;
  680. }
  681. // Make sure we are back on the same reader as where we started
  682. if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum())
  683. emitError(XMLErrs::PartialTagMarkupError);
  684. // Skip optional whitespace
  685. fReaderMgr.skipPastSpaces();
  686. // Make sure we find the closing bracket
  687. if (!fReaderMgr.skippedChar(chCloseAngle))
  688. {
  689. emitError
  690. (
  691. XMLErrs::UnterminatedEndTag
  692. , topElem->fThisElement->getFullName()
  693. );
  694. }
  695. // If we have a doc handler, tell it about the end tag
  696. if (fDocHandler)
  697. {
  698. fDocHandler->endElement
  699. (
  700. *topElem->fThisElement
  701. , uriId
  702. , isRoot
  703. , topElem->fThisElement->getElementName()->getPrefix()
  704. );
  705. }
  706. // If this was the root, then done with content
  707. gotData = !isRoot;
  708. }
  709. void WFXMLScanner::scanDocTypeDecl()
  710. {
  711. // Just skips over it
  712. // REVISIT: Should we issue a warning
  713. static const XMLCh doctypeIE[] =
  714. {
  715. chOpenSquare, chCloseAngle, chNull
  716. };
  717. XMLCh nextCh = fReaderMgr.skipUntilIn(doctypeIE);
  718. if (nextCh == chOpenSquare)
  719. fReaderMgr.skipPastChar(chCloseSquare);
  720. fReaderMgr.skipPastChar(chCloseAngle);
  721. }
  722. bool WFXMLScanner::scanStartTag(bool& gotData)
  723. {
  724. // Assume we will still have data until proven otherwise. It will only
  725. // ever be false if this is the root and its empty.
  726. gotData = true;
  727. // Get the QName. In this case, we are not doing namespaces, so we just
  728. // use it as is and don't have to break it into parts.
  729. if (!fReaderMgr.getName(fQNameBuf))
  730. {
  731. emitError(XMLErrs::ExpectedElementName);
  732. fReaderMgr.skipToChar(chOpenAngle);
  733. return false;
  734. }
  735. // Assume it won't be an empty tag
  736. bool isEmpty = false;
  737. // See if its the root element
  738. const bool isRoot = fElemStack.isEmpty();
  739. // Lets try to look up the element
  740. const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer();
  741. XMLElementDecl* elemDecl = fElementLookup->get(qnameRawBuf);
  742. if (!elemDecl) {
  743. if (fElementIndex < fElements->size()) {
  744. elemDecl = fElements->elementAt(fElementIndex);
  745. }
  746. else {
  747. elemDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
  748. (
  749. fGrammarPoolMemoryManager
  750. );
  751. fElements->addElement(elemDecl);
  752. }
  753. elemDecl->setElementName(XMLUni::fgZeroLenString, qnameRawBuf, fEmptyNamespaceId);
  754. fElementLookup->put((void*)elemDecl->getFullName(), elemDecl);
  755. fElementIndex++;
  756. }
  757. // Expand the element stack and add the new element
  758. fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum());
  759. // Skip any whitespace after the name
  760. fReaderMgr.skipPastSpaces();
  761. // We loop until we either see a /> or >, handling attribute/value
  762. // pairs until we get there.
  763. unsigned int attCount = 0;
  764. unsigned int curAttListSize = fAttrList->size();
  765. while (true)
  766. {
  767. // And get the next non-space character
  768. XMLCh nextCh = fReaderMgr.peekNextChar();
  769. // If the next character is not a slash or closed angle bracket,
  770. // then it must be whitespace, since whitespace is required
  771. // between the end of the last attribute and the name of the next
  772. // one.
  773. if (attCount)
  774. {
  775. if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle))
  776. {
  777. if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh))
  778. {
  779. // Ok, skip by them and peek another char
  780. fReaderMgr.skipPastSpaces();
  781. nextCh = fReaderMgr.peekNextChar();
  782. }
  783. else
  784. {
  785. // Emit the error but keep on going
  786. emitError(XMLErrs::ExpectedWhitespace);
  787. }
  788. }
  789. }
  790. // Ok, here we first check for any of the special case characters.
  791. // If its not one, then we do the normal case processing, which
  792. // assumes that we've hit an attribute value, Otherwise, we do all
  793. // the special case checks.
  794. if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh))
  795. {
  796. // Assume its going to be an attribute, so get a name from
  797. // the input.
  798. if (!fReaderMgr.getName(fAttNameBuf))
  799. {
  800. emitError(XMLErrs::ExpectedAttrName);
  801. fReaderMgr.skipPastChar(chCloseAngle);
  802. return false;
  803. }
  804. // And next must be an equal sign
  805. if (!scanEq())
  806. {
  807. static const XMLCh tmpList[] =
  808. {
  809. chSingleQuote, chDoubleQuote, chCloseAngle
  810. , chOpenAngle, chForwardSlash, chNull
  811. };
  812. emitError(XMLErrs::ExpectedEqSign);
  813. // Try to sync back up by skipping forward until we either
  814. // hit something meaningful.
  815. const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList);
  816. if ((chFound == chCloseAngle) || (chFound == chForwardSlash))
  817. {
  818. // Jump back to top for normal processing of these
  819. continue;
  820. }
  821. else if ((chFound == chSingleQuote)
  822. || (chFound == chDoubleQuote)
  823. || fReaderMgr.getCurrentReader()->isWhitespace(chFound))
  824. {
  825. // Just fall through assuming that the value is to follow
  826. }
  827. else if (chFound == chOpenAngle)
  828. {
  829. // Assume a malformed tag and that new one is starting
  830. emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf);
  831. return false;
  832. }
  833. else
  834. {
  835. // Something went really wrong
  836. return false;
  837. }
  838. }
  839. // See if this attribute is declared more than one for this element.
  840. const XMLCh* attNameRawBuf = fAttNameBuf.getRawBuffer();
  841. unsigned int attNameHash = XMLString::hash(attNameRawBuf, 109);
  842. if (attCount) {
  843. for (unsigned int k=0; k < attCount; k++) {
  844. if (fAttrNameHashList->elementAt(k) == attNameHash) {
  845. if (
  846. XMLString::equals
  847. (
  848. fAttrList->elementAt(k)->getName()
  849. , attNameRawBuf
  850. )
  851. )
  852. {
  853. emitError
  854. (
  855. XMLErrs::AttrAlreadyUsedInSTag
  856. , attNameRawBuf
  857. , qnameRawBuf
  858. );
  859. break;
  860. }
  861. }
  862. }
  863. }
  864. // Skip any whitespace before the value and then scan the att
  865. // value. This will come back normalized with entity refs and
  866. // char refs expanded.
  867. fReaderMgr.skipPastSpaces();
  868. if (!scanAttValue(attNameRawBuf, fAttValueBuf))
  869. {
  870. static const XMLCh tmpList[] =
  871. {
  872. chCloseAngle, chOpenAngle, chForwardSlash, chNull
  873. };
  874. emitError(XMLErrs::ExpectedAttrValue);
  875. // It failed, so lets try to get synced back up. We skip
  876. // forward until we find some whitespace or one of the
  877. // chars in our list.
  878. const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList);
  879. if ((chFound == chCloseAngle)
  880. || (chFound == chForwardSlash)
  881. || fReaderMgr.getCurrentReader()->isWhitespace(chFound))
  882. {
  883. // Just fall through and process this attribute, though
  884. // the value will be "".
  885. }
  886. else if (chFound == chOpenAngle)
  887. {
  888. // Assume a malformed tag and that new one is starting
  889. emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf);
  890. return false;
  891. }
  892. else
  893. {
  894. // Something went really wrong
  895. return false;
  896. }
  897. }
  898. // Add this attribute to the attribute list that we use to
  899. // pass them to the handler. We reuse its existing elements
  900. // but expand it as required.
  901. XMLAttr* curAtt;
  902. if (attCount >= curAttListSize)
  903. {
  904. curAtt = new (fMemoryManager) XMLAttr
  905. (
  906. -1
  907. , attNameRawBuf
  908. , XMLUni::fgZeroLenString
  909. , fAttValueBuf.getRawBuffer()
  910. , XMLAttDef::CData
  911. , true
  912. , fMemoryManager
  913. );
  914. fAttrList->addElement(curAtt);
  915. fAttrNameHashList->addElement(attNameHash);
  916. }
  917. else
  918. {
  919. curAtt = fAttrList->elementAt(attCount);
  920. curAtt->set
  921. (
  922. -1
  923. , attNameRawBuf
  924. , XMLUni::fgZeroLenString
  925. , fAttValueBuf.getRawBuffer()
  926. );
  927. curAtt->setSpecified(true);
  928. fAttrNameHashList->setElementAt(attNameHash, attCount);
  929. }
  930. attCount++;
  931. // And jump back to the top of the loop
  932. continue;
  933. }
  934. // It was some special case character so do all of the checks and
  935. // deal with it.
  936. if (!nextCh)
  937. ThrowXML(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF);
  938. if (nextCh == chForwardSlash)
  939. {
  940. fReaderMgr.getNextChar();
  941. isEmpty = true;
  942. if (!fReaderMgr.skippedChar(chCloseAngle))
  943. emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf);
  944. break;
  945. }
  946. else if (nextCh == chCloseAngle)
  947. {
  948. fReaderMgr.getNextChar();
  949. break;
  950. }
  951. else if (nextCh == chOpenAngle)
  952. {
  953. // Check for this one specially, since its going to be common
  954. // and it is kind of auto-recovering since we've already hit the
  955. // next open bracket, which is what we would have seeked to (and
  956. // skipped this whole tag.)
  957. emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName());
  958. break;
  959. }
  960. else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote))
  961. {
  962. // Check for this one specially, which is probably a missing
  963. // attribute name, e.g. ="value". Just issue expected name
  964. // error and eat the quoted string, then jump back to the
  965. // top again.
  966. emitError(XMLErrs::ExpectedAttrName);
  967. fReaderMgr.getNextChar();
  968. fReaderMgr.skipQuotedString(nextCh);
  969. fReaderMgr.skipPastSpaces();
  970. continue;
  971. }
  972. }
  973. // If empty, validate content right now if we are validating and then
  974. // pop the element stack top. Else, we have to update the current stack
  975. // top's namespace mapping elements.
  976. if (isEmpty)
  977. {
  978. // Pop the element stack back off since it'll never be used now
  979. fElemStack.popTop();
  980. // If the elem stack is empty, then it was an empty root
  981. if (isRoot)
  982. gotData = false;
  983. }
  984. // If we have a document handler, then tell it about this start tag. We
  985. // don't have any URI id to send along, so send fEmptyNamespaceId. We also do not send
  986. // any prefix since its just one big name if we are not doing namespaces.
  987. if (fDocHandler)
  988. {
  989. fDocHandler->startElement
  990. (
  991. *elemDecl
  992. , fEmptyNamespaceId
  993. , 0
  994. , *fAttrList
  995. , attCount
  996. , isEmpty
  997. , isRoot
  998. );
  999. }
  1000. return true;
  1001. }
  1002. // This method is called to scan a start tag when we are processing
  1003. // namespaces. There are two different versions of this method, one for
  1004. // namespace aware processing an done for non-namespace aware processing.
  1005. //
  1006. // This method is called after we've scanned the < of a start tag. So we
  1007. // have to get the element name, then scan the attributes, after which
  1008. // we are either going to see >, />, or attributes followed by one of those
  1009. // sequences.
  1010. bool WFXMLScanner::scanStartTagNS(bool& gotData)
  1011. {
  1012. // Assume we will still have data until proven otherwise. It will only
  1013. // ever be false if this is the root and its empty.
  1014. gotData = true;
  1015. // The current position is after the open bracket, so we need to read in
  1016. // in the element name.
  1017. if (!fReaderMgr.getName(fQNameBuf))
  1018. {
  1019. emitError(XMLErrs::ExpectedElementName);
  1020. fReaderMgr.skipToChar(chOpenAngle);
  1021. return false;
  1022. }
  1023. // See if its the root element
  1024. const bool isRoot = fElemStack.isEmpty();
  1025. // Assume it won't be an empty tag
  1026. bool isEmpty = false;
  1027. // Skip any whitespace after the name
  1028. fReaderMgr.skipPastSpaces();
  1029. // Lets try to look up the element
  1030. const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer();
  1031. XMLElementDecl* elemDecl = fElementLookup->get(qnameRawBuf);
  1032. if (!elemDecl) {
  1033. if (!XMLString::compareNString(qnameRawBuf, XMLUni::fgXMLNSColonString, 6))
  1034. emitError(XMLErrs::NoXMLNSAsElementPrefix, qnameRawBuf);
  1035. if (fElementIndex < fElements->size()) {
  1036. elemDecl = fElements->elementAt(fElementIndex);
  1037. }
  1038. else {
  1039. elemDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
  1040. (
  1041. fGrammarPoolMemoryManager
  1042. );
  1043. fElements->addElement(elemDecl);
  1044. }
  1045. elemDecl->setElementName(qnameRawBuf, fEmptyNamespaceId);
  1046. fElementLookup->put((void*)elemDecl->getFullName(), elemDecl);
  1047. fElementIndex++;
  1048. }
  1049. // Expand the element stack and add the new element
  1050. fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum());
  1051. // reset NS attribute list
  1052. fAttrNSList->removeAllElements();
  1053. // We loop until we either see a /> or >, handling attribute/value
  1054. // pairs until we get there.
  1055. unsigned int attCount = 0;
  1056. unsigned int curAttListSize = fAttrList->size();
  1057. while (true)
  1058. {
  1059. // And get the next non-space character
  1060. XMLCh nextCh = fReaderMgr.peekNextChar();
  1061. // If the next character is not a slash or closed angle bracket,
  1062. // then it must be whitespace, since whitespace is required
  1063. // between the end of the last attribute and the name of the next
  1064. // one.
  1065. if (attCount)
  1066. {
  1067. if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle))
  1068. {
  1069. if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh))
  1070. {
  1071. // Ok, skip by them and peek another char
  1072. fReaderMgr.skipPastSpaces();
  1073. nextCh = fReaderMgr.peekNextChar();
  1074. }
  1075. else
  1076. {
  1077. // Emit the error but keep on going
  1078. emitError(XMLErrs::ExpectedWhitespace);
  1079. }
  1080. }
  1081. }
  1082. // Ok, here we first check for any of the special case characters.
  1083. // If its not one, then we do the normal case processing, which
  1084. // assumes that we've hit an attribute value, Otherwise, we do all
  1085. // the special case checks.
  1086. if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh))
  1087. {
  1088. // Assume its going to be an attribute, so get a name from
  1089. // the input.
  1090. if (!fReaderMgr.getName(fAttNameBuf))
  1091. {
  1092. emitError(XMLErrs::ExpectedAttrName);
  1093. fReaderMgr.skipPastChar(chCloseAngle);
  1094. return false;
  1095. }
  1096. // And next must be an equal sign
  1097. if (!scanEq())
  1098. {
  1099. static const XMLCh tmpList[] =
  1100. {
  1101. chSingleQuote, chDoubleQuote, chCloseAngle
  1102. , chOpenAngle, chForwardSlash, chNull
  1103. };
  1104. emitError(XMLErrs::ExpectedEqSign);
  1105. // Try to sync back up by skipping forward until we either
  1106. // hit something meaningful.
  1107. const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList);
  1108. if ((chFound == chCloseAngle) || (chFound == chForwardSlash))
  1109. {
  1110. // Jump back to top for normal processing of these
  1111. continue;
  1112. }
  1113. else if ((chFound == chSingleQuote)
  1114. || (chFound == chDoubleQuote)
  1115. || fReaderMgr.getCurrentReader()->isWhitespace(chFound))
  1116. {
  1117. // Just fall through assuming that the value is to follow
  1118. }
  1119. else if (chFound == chOpenAngle)
  1120. {
  1121. // Assume a malformed tag and that new one is starting
  1122. emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf);
  1123. return false;
  1124. }
  1125. else
  1126. {
  1127. // Something went really wrong
  1128. return false;
  1129. }
  1130. }
  1131. // See if this attribute is declared more than one for this element.
  1132. const XMLCh* attNameRawBuf = fAttNameBuf.getRawBuffer();
  1133. unsigned int attNameHash = XMLString::hash(attNameRawBuf, 109);
  1134. if (attCount) {
  1135. for (unsigned int k=0; k < attCount; k++) {
  1136. if (fAttrNameHashList->elementAt(k) == attNameHash) {
  1137. if (XMLString::equals(
  1138. fAttrList->elementAt(k)->getQName()
  1139. , attNameRawBuf))
  1140. {
  1141. emitError
  1142. (
  1143. XMLErrs::AttrAlreadyUsedInSTag
  1144. , attNameRawBuf
  1145. , qnameRawBuf
  1146. );
  1147. break;
  1148. }
  1149. }
  1150. }
  1151. }
  1152. // Skip any whitespace before the value and then scan the att
  1153. // value. This will come back normalized with entity refs and
  1154. // char refs expanded.
  1155. fReaderMgr.skipPastSpaces();
  1156. if (!scanAttValue(attNameRawBuf, fAttValueBuf))
  1157. {
  1158. static const XMLCh tmpList[] =
  1159. {
  1160. chCloseAngle, chOpenAngle, chForwardSlash, chNull
  1161. };
  1162. emitError(XMLErrs::ExpectedAttrValue);
  1163. // It failed, so lets try to get synced back up. We skip
  1164. // forward until we find some whitespace or one of the
  1165. // chars in our list.
  1166. const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList);
  1167. if ((chFound == chCloseAngle)
  1168. || (chFound == chForwardSlash)
  1169. || fReaderMgr.getCurrentReader()->isWhitespace(chFound))
  1170. {
  1171. // Just fall through and process this attribute, though
  1172. // the value will be "".
  1173. }
  1174. else if (chFound == chOpenAngle)
  1175. {
  1176. // Assume a malformed tag and that new one is starting
  1177. emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf);
  1178. return false;
  1179. }
  1180. else
  1181. {
  1182. // Something went really wrong
  1183. return false;
  1184. }
  1185. }
  1186. // Add this attribute to the attribute list that we use to
  1187. // pass them to the handler. We reuse its existing elements
  1188. // but expand it as required.
  1189. const XMLCh* attValueRawBuf = fAttValueBuf.getRawBuffer();
  1190. XMLAttr* curAtt = 0;
  1191. if (attCount >= curAttListSize)
  1192. {
  1193. curAtt = new (fMemoryManager) XMLAttr
  1194. (
  1195. fEmptyNamespaceId
  1196. , attNameRawBuf
  1197. , attValueRawBuf
  1198. , XMLAttDef::CData
  1199. , true
  1200. , fMemoryManager
  1201. );
  1202. fAttrList->addElement(curAtt);
  1203. fAttrNameHashList->addElement(attNameHash);
  1204. }
  1205. else
  1206. {
  1207. curAtt = fAttrList->elementAt(attCount);
  1208. curAtt->set
  1209. (
  1210. fEmptyNamespaceId
  1211. , attNameRawBuf
  1212. , attValueRawBuf
  1213. );
  1214. curAtt->setSpecified(true);
  1215. fAttrNameHashList->setElementAt(attNameHash, attCount);
  1216. }
  1217. // Make sure that the name is basically well formed for namespace
  1218. // enabled rules. It either has no colons, or it has one which
  1219. // is neither the first or last char.
  1220. const int colonFirst = XMLString::indexOf(attNameRawBuf, chColon);
  1221. if (colonFirst != -1)
  1222. {
  1223. const int colonLast = XMLString::lastIndexOf(attNameRawBuf, chColon);
  1224. if (colonFirst != colonLast)
  1225. {
  1226. emitError(XMLErrs::TooManyColonsInName);
  1227. continue;
  1228. }
  1229. else if ((colonFirst == 0)
  1230. || (colonLast == (int)fAttNameBuf.getLen() - 1))
  1231. {
  1232. emitError(XMLErrs::InvalidColonPos);
  1233. continue;
  1234. }
  1235. }
  1236. // Map prefix to namespace
  1237. const XMLCh* attPrefix = curAtt->getPrefix();
  1238. const XMLCh* attLocalName = curAtt->getName();
  1239. const XMLCh* namespaceURI = fAttValueBuf.getRawBuffer();
  1240. if (attPrefix && *attPrefix) {
  1241. if (XMLString::equals(attPrefix, XMLUni::fgXMLString)) {
  1242. curAtt->setURIId(fXMLNamespaceId);
  1243. }
  1244. else if (XMLString::equals(attPrefix, XMLUni::fgXMLNSString)) {
  1245. if (XMLString::equals(attLocalName, XMLUni::fgXMLNSString))
  1246. emitError(XMLErrs::NoUseOfxmlnsAsPrefix);
  1247. else if (XMLString::equals(attLocalName, XMLUni::fgXMLString)) {
  1248. if (!XMLString::equals(namespaceURI, XMLUni::fgXMLURIName))
  1249. emitError(XMLErrs::PrefixXMLNotMatchXMLURI);
  1250. }
  1251. if (!namespaceURI)
  1252. emitError(XMLErrs::NoEmptyStrNamespace, attNameRawBuf);
  1253. else if(!*namespaceURI && fXMLVersion == XMLReader::XMLV1_0)
  1254. emitError(XMLErrs::NoEmptyStrNamespace, attNameRawBuf);
  1255. fElemStack.addPrefix
  1256. (
  1257. attLocalName
  1258. , fURIStringPool->addOrFind(namespaceURI)
  1259. );
  1260. curAtt->setURIId(fXMLNSNamespaceId);
  1261. }
  1262. else {
  1263. fAttrNSList->addElement(curAtt);
  1264. }
  1265. }
  1266. else {
  1267. if (XMLString::equals(XMLUni::fgXMLNSString, attLocalName)) {
  1268. if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName))
  1269. emitError(XMLErrs::NoUseOfxmlnsURI);
  1270. else if (XMLString::equals(namespaceURI, XMLUni::fgXML

Large files files are truncated, but you can click here to view the full file