Fixed required attributes list
This commit is contained in:
parent
9c9a141c96
commit
16b9efaf3d
|
@ -280,18 +280,16 @@ void XMLCALL XmlPromptGenerator::attlistdeclhandler (
|
||||||
PromptGeneratorData *d;
|
PromptGeneratorData *d;
|
||||||
d = ( PromptGeneratorData * ) data;
|
d = ( PromptGeneratorData * ) data;
|
||||||
|
|
||||||
std::set<std::string> attributeValues;
|
std::set<std::string> &attributeValues = d->attributeMap[elname][attname];
|
||||||
if ( *att_type == '(' ) // change to exclude _known_ identifiers?
|
if ( *att_type == '(' ) // change to exclude _known_ identifiers?
|
||||||
{
|
{
|
||||||
char *s, *word;
|
const char *s, *word;
|
||||||
s = ( char * ) att_type;
|
s = att_type;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
s++;
|
s++;
|
||||||
while ( wxIsspace( *s ) )
|
|
||||||
s++;
|
|
||||||
word = s;
|
word = s;
|
||||||
while ( *s != '|' && *s != ')' && !wxIsspace( *s ) )
|
while ( *s != '|' && *s != ')' )
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
std::string currentValue ( word, s - word );
|
std::string currentValue ( word, s - word );
|
||||||
|
@ -299,18 +297,9 @@ void XMLCALL XmlPromptGenerator::attlistdeclhandler (
|
||||||
|
|
||||||
while ( *s != '|' && *s != ')')
|
while ( *s != '|' && *s != ')')
|
||||||
s++;
|
s++;
|
||||||
} while ( *s != ')' && *s );
|
} while ( *s != ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attributeValues.empty() )
|
|
||||||
{
|
|
||||||
d->attributeMap[elname][attname].insert ( "" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::set<std::string>::iterator it;
|
|
||||||
for ( it = attributeValues.begin(); it != attributeValues.end(); it++ )
|
|
||||||
d->attributeMap[elname][attname].insert ( *it );
|
|
||||||
|
|
||||||
if ( isrequired )
|
if ( isrequired )
|
||||||
{
|
{
|
||||||
d->requiredAttributeMap[elname].insert ( attname );
|
d->requiredAttributeMap[elname].insert ( attname );
|
||||||
|
@ -531,45 +520,41 @@ void XmlPromptGenerator::handleSchema (
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch attributes
|
// fetch attributes
|
||||||
if ( curElem.hasAttDefs() && ! ( curElem.getAttDefList().isEmpty() ) )
|
if ( !curElem.hasAttDefs() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
XMLAttDefList& attIter = curElem.getAttDefList();
|
||||||
|
for ( unsigned int i = 0; i < attIter.getAttDefCount(); i++ )
|
||||||
{
|
{
|
||||||
std::map<std::string, std::set<std::string> > attributeMap;
|
std::string attribute, attributeValue;
|
||||||
|
|
||||||
XMLAttDefList& attIter = curElem.getAttDefList();
|
XMLAttDef& attr = attIter.getAttDef ( i );
|
||||||
for ( unsigned int i = 0; i < attIter.getAttDefCount(); i++ )
|
XMLAttDef::DefAttTypes ty = attr.getDefaultType();
|
||||||
|
if ( ty == XMLAttDef::Prohibited )
|
||||||
|
continue;
|
||||||
|
SchemaAttDef *pAttr = ( SchemaAttDef * ) &attr;
|
||||||
|
|
||||||
|
const QName *qnm = pAttr->getAttName();
|
||||||
|
if ( qnm )
|
||||||
{
|
{
|
||||||
std::string attribute, attributeValue;
|
s = XMLString::transcode ( qnm->getRawName() );
|
||||||
std::set<std::string> attributeValueSet;
|
attribute = s;
|
||||||
|
XMLString::release( &s );
|
||||||
XMLAttDef& attr = attIter.getAttDef ( i );
|
|
||||||
XMLAttDef::DefAttTypes ty = attr.getDefaultType();
|
|
||||||
if ( ty == XMLAttDef::Prohibited )
|
|
||||||
continue;
|
|
||||||
SchemaAttDef *pAttr = ( SchemaAttDef * ) &attr;
|
|
||||||
|
|
||||||
const QName *qnm = pAttr->getAttName();
|
|
||||||
if ( qnm )
|
|
||||||
{
|
|
||||||
s = XMLString::transcode ( qnm->getRawName() );
|
|
||||||
attribute = s;
|
|
||||||
XMLString::release( &s );
|
|
||||||
}
|
|
||||||
if ( attribute.empty() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Value
|
|
||||||
if ( pAttr->getValue() )
|
|
||||||
{
|
|
||||||
s = XMLString::transcode ( pAttr->getValue() );
|
|
||||||
attributeValue = s;
|
|
||||||
XMLString::release( &s );
|
|
||||||
attributeValueSet.insert ( attributeValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
attributeMap.insert ( make_pair ( attribute, attributeValueSet ) );
|
|
||||||
}
|
}
|
||||||
if ( !attributeMap.empty() )
|
if ( attribute.empty() )
|
||||||
d->attributeMap.insert( make_pair ( element, attributeMap ) );
|
continue;
|
||||||
|
|
||||||
|
// Value
|
||||||
|
if ( pAttr->getValue() )
|
||||||
|
{
|
||||||
|
s = XMLString::transcode ( pAttr->getValue() );
|
||||||
|
attributeValue = s;
|
||||||
|
XMLString::release( &s );
|
||||||
|
}
|
||||||
|
|
||||||
|
d->attributeMap[element][attribute].insert( attributeValue );
|
||||||
|
if ( ty == XMLAttDef::Required || ty == XMLAttDef::Required_And_Fixed)
|
||||||
|
d->requiredAttributeMap[element].insert ( attribute );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete parser;
|
delete parser;
|
||||||
|
|
Loading…
Reference in New Issue