Bug #2173060 bug with element with underscore in schemas
This commit is contained in:
parent
c93e94db6f
commit
865701cf62
|
@ -24,7 +24,6 @@
|
||||||
#include "xmlencodinghandler.h"
|
#include "xmlencodinghandler.h"
|
||||||
#include "readfile.h"
|
#include "readfile.h"
|
||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "getword.h"
|
|
||||||
#include "pathresolver.h"
|
#include "pathresolver.h"
|
||||||
|
|
||||||
#undef XMLCALL
|
#undef XMLCALL
|
||||||
|
@ -462,6 +461,7 @@ void XmlPromptGenerator::handleSchema (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *s;
|
||||||
while ( elemEnum.hasMoreElements() )
|
while ( elemEnum.hasMoreElements() )
|
||||||
{
|
{
|
||||||
const SchemaElementDecl& curElem = elemEnum.nextElement();
|
const SchemaElementDecl& curElem = elemEnum.nextElement();
|
||||||
|
@ -472,7 +472,9 @@ void XmlPromptGenerator::handleSchema (
|
||||||
const QName *qnm = curElem.getElementName();
|
const QName *qnm = curElem.getElementName();
|
||||||
if ( qnm )
|
if ( qnm )
|
||||||
{
|
{
|
||||||
element = XMLString::transcode ( qnm->getRawName() ); // this includes any prefix:localname combinations
|
s = XMLString::transcode ( qnm->getRawName() ); // this includes any prefix:localname combinations
|
||||||
|
element = s;
|
||||||
|
XMLString::release( &s );
|
||||||
}
|
}
|
||||||
if ( element.empty() )
|
if ( element.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -480,23 +482,19 @@ void XmlPromptGenerator::handleSchema (
|
||||||
const XMLCh* fmtCntModel = curElem.getFormattedContentModel();
|
const XMLCh* fmtCntModel = curElem.getFormattedContentModel();
|
||||||
if ( fmtCntModel != NULL ) // tbd: this does not yet pick up prefix:localname combinations
|
if ( fmtCntModel != NULL ) // tbd: this does not yet pick up prefix:localname combinations
|
||||||
{
|
{
|
||||||
size_t len;
|
|
||||||
char *s, *word;
|
|
||||||
std::string structure;
|
std::string structure;
|
||||||
s = ( char * ) XMLString::transcode ( fmtCntModel );
|
s = XMLString::transcode ( fmtCntModel );
|
||||||
|
|
||||||
structure = s;
|
structure = s;
|
||||||
|
XMLString::release( &s );
|
||||||
d->elementStructureMap.insert ( make_pair ( element, structure ) );
|
d->elementStructureMap.insert ( make_pair ( element, structure ) );
|
||||||
|
}
|
||||||
while ( ( word = GetWord::run ( &s, &len ) ) != NULL )
|
const ContentSpecNode *spec = curElem.getContentSpec();
|
||||||
|
if ( spec != NULL )
|
||||||
{
|
{
|
||||||
std::string currentValue ( word, len );
|
getContent ( spec, children );
|
||||||
if ( currentValue.size() )
|
|
||||||
children.insert ( currentValue );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !children.empty() )
|
if ( !children.empty() )
|
||||||
d->elementMap.insert ( make_pair ( element, children ) );
|
d->elementMap.insert ( make_pair ( element, children ) );
|
||||||
|
}
|
||||||
|
|
||||||
// fetch attributes
|
// fetch attributes
|
||||||
if ( curElem.hasAttDefs() && ! ( curElem.getAttDefList().isEmpty() ) )
|
if ( curElem.hasAttDefs() && ! ( curElem.getAttDefList().isEmpty() ) )
|
||||||
|
@ -518,7 +516,9 @@ void XmlPromptGenerator::handleSchema (
|
||||||
const QName *qnm = pAttr->getAttName();
|
const QName *qnm = pAttr->getAttName();
|
||||||
if ( qnm )
|
if ( qnm )
|
||||||
{
|
{
|
||||||
attribute = XMLString::transcode ( qnm->getRawName() );
|
s = XMLString::transcode ( qnm->getRawName() );
|
||||||
|
attribute = s;
|
||||||
|
XMLString::release( &s );
|
||||||
}
|
}
|
||||||
if ( attribute.empty() )
|
if ( attribute.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -526,7 +526,9 @@ void XmlPromptGenerator::handleSchema (
|
||||||
// Value
|
// Value
|
||||||
if ( pAttr->getValue() )
|
if ( pAttr->getValue() )
|
||||||
{
|
{
|
||||||
attributeValue = XMLString::transcode ( pAttr->getValue() );
|
s = XMLString::transcode ( pAttr->getValue() );
|
||||||
|
attributeValue = s;
|
||||||
|
XMLString::release( &s );
|
||||||
attributeValueSet.insert ( attributeValue );
|
attributeValueSet.insert ( attributeValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,3 +541,24 @@ void XmlPromptGenerator::handleSchema (
|
||||||
delete parser;
|
delete parser;
|
||||||
XMLPlatformUtils::Terminate();
|
XMLPlatformUtils::Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XmlPromptGenerator::getContent (
|
||||||
|
const ContentSpecNode *spec,
|
||||||
|
std::set<std::string> &list )
|
||||||
|
{
|
||||||
|
//if ( spec == NULL) return;
|
||||||
|
|
||||||
|
const QName *qnm = spec->getElement();
|
||||||
|
if ( qnm )
|
||||||
|
{
|
||||||
|
char *element = XMLString::transcode ( qnm->getRawName() );
|
||||||
|
if ( element != NULL )
|
||||||
|
list.insert( element );
|
||||||
|
XMLString::release( &element );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( spec->getFirst() != NULL)
|
||||||
|
getContent( spec->getFirst(), list );
|
||||||
|
if ( spec->getSecond() != NULL)
|
||||||
|
getContent( spec->getSecond(), list );
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "wrapexpat.h"
|
#include "wrapexpat.h"
|
||||||
#include "parserdata.h"
|
#include "parserdata.h"
|
||||||
|
#include <xercesc/validators/common/ContentSpecNode.hpp>
|
||||||
|
|
||||||
struct PromptGeneratorData : public ParserData
|
struct PromptGeneratorData : public ParserData
|
||||||
{
|
{
|
||||||
|
@ -109,6 +110,9 @@ class XmlPromptGenerator : public WrapExpat
|
||||||
PromptGeneratorData *d,
|
PromptGeneratorData *d,
|
||||||
const XML_Char *el,
|
const XML_Char *el,
|
||||||
const XML_Char **attr );
|
const XML_Char **attr );
|
||||||
|
static void getContent (
|
||||||
|
const xercesc::ContentSpecNode *spec,
|
||||||
|
std::set<std::string> &list );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue