http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2354 *** shadow/2354 Wed Jun 27 07:44:30 2001 --- shadow/2354.tmp.4059 Wed Jun 27 07:44:30 2001 *************** *** 0 **** --- 1,103 ---- + +============================================================================+ + | getURI() does not return Element's Id | + +----------------------------------------------------------------------------+ + | Bug #: 2354 Product: Xerces-C | + | Status: NEW Version: 1.5 | + | Resolution: Platform: PC | + | Severity: Normal OS/Version: Windows NT/2K | + | Priority: Other Component: Validating Parser (DTD) | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + I'm moving my old code (that deals with the content model) to Xerces. + I can see one problem in the current version. + + First question: Did I properly change the old method ? (If no, then what is + it's analogue) + Old source: src\com\ibm\xml\framework\ContentSpecNode.hpp + Old method: unsigned int ContentSpecNode::getElemId() const + + New source: src\validators\common\ContentSpecNode.hpp + Analoge: getElement()->getURI() + + + Let's see where is the problem. + Suppose I'm parsing the xml with the following DTD + <!ELEMENT Root (A,B)> + <!ELEMENT A (#PCDATA)> + <!ELEMENT B (D)> + <!ELEMENT D (A)> + + Let's see some pseudo code. My notes in comments. + + void MyDtdParser::elementDecl( const DTDElementDecl& decl, bool isIgnored ) + { + + decl.getFullName() // Root + decl.getId() // 1 + + // Lets see the content model of 'Root' element + const ContentSpecNode* node = decl.getContentSpec(); + node->getType() // Sequence + node->getElement()->getURI(); // XMLElementDecl::fgInvalidElemId + + // Lets examine its first ( "A" ) + firstNode = node->getFirst(); + firstNode->getType() // Leaf + // fElement.fLocalPart is "A" + firstNode->getElement()->getURI(); // 0. + // I expected 2 ( here and after the values returned by XML4C 2.x ) + + // Lets examine its second ( "B" ) + secondNode = node->getFirst(); + secondNode->getType() // Leaf + // fElement.fLocalPart is "B" + second->getElement()->getURI(); // 0 I expected 3 + + // Next call to elementDecl() + decl.getFullName() // A + decl.getId() // 2 + + // Lets see the content model of 'A' element + const ContentSpecNode* node = decl.getContentSpec(); + node->getType() // ZeroOrMore + node->getElement()->getURI(); // XMLElementDecl::fgInvalidElemId + + // Well, let's see its first (I expected this info above) + firstNode = node->getFirst(); + firstNode->getType() // Leaf + firstNode->getElement()->getURI(); // XMLElementDecl::fgPCDataElemId + + + // Next call to elementDecl() + decl.getFullName() // B + decl.getId() // 3 + + // Lets see the content model of 'B' element + const ContentSpecNode* node = decl.getContentSpec(); + // fElement.fLocalPart is "D" + node->getType() // Leaf + node->getElement()->getURI(); // 0. Expected 4 + + // Next call to elementDecl() + decl.getFullName() // D + decl.getId() // 4 + + // Lets see the content model of 'D' element + const ContentSpecNode* node = decl.getContentSpec(); + // fElement.fLocalPart is "A" + node->getType() // Leaf + node->getElement()->getURI(); // 0. Expected 2 + } + + + + Peter A. Volchek + Software Engineer + Metis International, Inc. + [EMAIL PROTECTED] \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
