本文整理汇总了C++中DOMAttr::getPrefix方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMAttr::getPrefix方法的具体用法?C++ DOMAttr::getPrefix怎么用?C++ DOMAttr::getPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMAttr
的用法示例。
在下文中一共展示了DOMAttr::getPrefix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateData
void XmlSchemaGenerator::generateData ( const wxString &elementName,
size_t nIndent /*= 0*/)
{
ElmtData &data = mElements[elementName];
std::set<const DOMElement *>::iterator elmtItr;
data.name = elementName;
//Content
std::map<wxString, ChildData> &childMap = data.children;
std::map<wxString, ChildData>::iterator itr;
std::set<wxString> previous;
elmtItr = data.nodes.begin();
for ( ; elmtItr != data.nodes.end(); ++elmtItr )
{
previous.clear();
std::map<wxString, size_t> countMap;
DOMElement *child = ( **elmtItr ).getFirstElementChild();
for ( ; child != NULL; child = child->getNextElementSibling() )
{
wxString name = WrapXerces::toString ( child->getTagName() );
childMap[name].prevSiblings.insert ( previous.begin(), previous.end() );
childMap[name].prevSiblings.erase ( name ); // Don't depend on oneself
previous.insert ( name );
countMap[name] += 1;
}
std::map<wxString, size_t>::iterator countItr = countMap.begin();
for ( ; countItr != countMap.end(); ++countItr )
{
if ( childMap[countItr->first].maxOccurs < countItr->second )
childMap[countItr->first].maxOccurs = countItr->second;
}
if ( childMap.size() == countMap.size() )
continue;
for ( itr = childMap.begin(); itr != childMap.end(); ++itr )
{
if ( countMap.find ( itr->first ) != countMap.end() )
continue;
itr->second.minOccurs = 0;
}
}
// Attribute
std::map<wxString, const XMLCh *> &attrMap = data.attrMap;
std::set<wxString> &optAttrs = data.optAttrs;
std::map<wxString, const XMLCh *>::iterator attrItr;
elmtItr = data.nodes.begin();
for ( ; elmtItr != data.nodes.end(); ++elmtItr )
{
if ( ! ( **elmtItr ).hasAttributes() )
continue;
wxString name;
DOMAttr *attr;
DOMNamedNodeMap *attrs = ( **elmtItr ).getAttributes();
size_t i = attrs->getLength();
while ( i-- > 0 )
{
attr = ( DOMAttr* ) attrs->item ( i );
name = WrapXerces::toString ( attr->getName() );
if ( attr->getPrefix() != NULL )
{
wxLogDebug ( _T("Ignore: %s"), name.c_str() );
continue;
}
if ( attr->getSpecified() )
attrMap[name]; // Initialize attribute map
else
attrMap[name] = attr->getValue();
}
if ( attrMap.size() == optAttrs.size() )
continue;
for ( attrItr = attrMap.begin(); attrItr != attrMap.end(); ++attrItr )
{
if ( attrs->getNamedItem ( ( const XMLCh * )
WrapXerces::toString ( attrItr->first ).GetData() ) == NULL )
{
optAttrs.insert ( attrItr->first );
}
}
}
// Deal with sequence
wxLogDebug ( _T("%s:"), elementName.c_str() );
data.useSequence = getSequence ( data.sequence, childMap );
// Now we have the data of the element
if ( mGrammarType == Grammar::DTDGrammarType )
{
generateDTD ( data, nIndent );
mSchema << data.schema;
}
else if ( !mInlineSimpleType )
{ // Or wait until all data are available
generateSchema ( data, nIndent );
mSchema << data.schema;
}
}