本文整理汇总了C++中DOMElement::getNextElementSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::getNextElementSibling方法的具体用法?C++ DOMElement::getNextElementSibling怎么用?C++ DOMElement::getNextElementSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::getNextElementSibling方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFile
void Parameters::readFile(string str){
file = str;
XMLPlatformUtils::Initialize();
XercesDOMParser parser;
parser.setValidationScheme(XercesDOMParser::Val_Always);
HandlerBase errHandler;// = (ErrorHandler*) new HandlerBase();
parser.setErrorHandler(&errHandler);
parser.parse(str.c_str());
DOMDocument * doc = parser.getDocument();
DOMElement* elementRoot = doc->getDocumentElement();
// Extract floats
DOMElement* floatRoot = (DOMElement *)
elementRoot->getElementsByTagName(XMLString::transcode("real"))->item(0);
DOMElement* child = floatRoot->getFirstElementChild();
do{
saveReal(XMLString::transcode(child->getNodeName()),
atof(XMLString::transcode(child->getTextContent())));
child = child->getNextElementSibling();
}while(child != NULL);
// Extract integers
DOMElement* intRoot = (DOMElement *)
elementRoot->getElementsByTagName(XMLString::transcode("integer"))->item(0);
child = intRoot->getFirstElementChild();
do{
saveInteger(
XMLString::transcode(child->getNodeName()),
atoi(XMLString::transcode(child->getTextContent())));
child = child->getNextElementSibling();
}while(child != NULL);
}
示例2: getChildElementCount
XMLSize_t DOMElementImpl::getChildElementCount() const
{
XMLSize_t count = 0;
DOMElement* child = getFirstElementChild();
while (child != NULL) {
++count;
child = child->getNextElementSibling();
}
return count;
}
示例3: getChildren
XmlElementList XmlElement::getChildren() const {
XmlElementList vec;
DOMElement* curr = base->getFirstElementChild();
while(curr) {
if(!(curr->getNodeType() == DOMNode::TEXT_NODE || curr->getNodeType() == DOMNode::COMMENT_NODE)) //skip text nodes and comments
vec.push_back( XmlElement(curr, doc) );
curr = curr->getNextElementSibling();
}
return vec;
}
示例4: findAllElements
void XmlSchemaGenerator::findAllElements ( const DOMElement &element,
size_t nIndent /*= 0*/)
{
wxString tagName = WrapXerces::toString ( element.getTagName() );
mElements[tagName].nodes.insert ( &element );
DOMElement *child = element.getFirstElementChild();
for ( ; child != NULL; child = child->getNextElementSibling() )
{
findAllElements ( *child, nIndent );
}
}
示例5: generateData
void XmlSchemaGenerator::generateData ( const DOMElement &element,
size_t nIndent /*= 0*/)
{
wxString name = WrapXerces::toString ( element.getTagName() );
if ( mElements[name].name.empty() )
{ // Only generate data once
generateData ( name, nIndent );
}
DOMElement *child = element.getFirstElementChild();
for ( ; child != NULL; child = child->getNextElementSibling() )
{
generateData ( *child, nIndent );
}
}
示例6: sigNodeName
static DOMElement *
SAMLFindChildByName(const DOMElement *elem,
const char *name)
{
XMLT sigNodeName(name);
DOMElement *childElem;
for (childElem = elem->getFirstElementChild();
childElem != NULL; childElem = childElem->getNextElementSibling()) {
if (XMLString::equals(childElem->getNodeName(),
sigNodeName.getUnicodeStr())) {
break;
}
}
return childElem;
}
示例7: outputSchema
void XmlSchemaGenerator::outputSchema ( const DOMElement &element )
{
wxString tagName = WrapXerces::toString ( element.getTagName() );
ElmtData &data = mElements[tagName];
if ( data.schema.empty() )
{
if ( mGrammarType == Grammar::SchemaGrammarType )
generateSchema ( data, 1 );
else
generateDTD ( data, 1 );
mSchema << data.schema;
}
DOMElement *child = element.getFirstElementChild();
for ( ; child != NULL; child = child->getNextElementSibling() )
{
outputSchema ( *child );
}
}
示例8: fileInfo
XERCES_CPP_NAMESPACE_USE
std::vector<DgFileTile> DgFileTile::getTiles(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDocument,
const std::string& filename,
unsigned int& height,
unsigned int& width)
{
std::vector<DgFileTile> tiles;
DOMElement* pRoot = pDocument->getDocumentElement();
if (pRoot == NULL || !XMLString::equals(pRoot->getNodeName(), X("isd")))
{
return tiles;
}
DOMNodeList* pTilList = pRoot->getElementsByTagName(X("TIL"));
if (pTilList == NULL || pTilList->getLength() != 1)
{
return tiles;
}
DOMNode* pTil = pTilList->item(0);
if (pTil == NULL || pTil->getNodeType() != DOMNode::ELEMENT_NODE)
{
return tiles;
}
DOMElement* pTilElement = static_cast<DOMElement*>(pTil);
DOMNodeList* pTilesList = pTilElement->getElementsByTagName(X("TILE"));
if (pTilesList == NULL)
{
return tiles;
}
height = 0;
width = 0;
bool error = false;
QFileInfo fileInfo(QString::fromStdString(filename));
QDir fileDir = fileInfo.dir();
for (unsigned int i = 0; i < pTilesList->getLength(); ++i)
{
DgFileTile curTile;
DOMNode* pNode = pTilesList->item(i);
if (pNode == NULL || pNode->getNodeType() != DOMNode::ELEMENT_NODE)
{
continue;
}
DOMElement* pElement = static_cast<DOMElement*>(pNode);
DOMElement* pChildElement = pElement->getFirstElementChild();
while (pChildElement != NULL)
{
std::string textContent = A(pChildElement->getTextContent());
if (XMLString::equals(pChildElement->getNodeName(), X("FILENAME")))
{
curTile.mTilFilename = fileDir.filePath(QString::fromStdString(textContent)).toStdString();
}
if (XMLString::equals(pChildElement->getNodeName(), X("ULCOLOFFSET")))
{
curTile.mStartCol = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
}
if (XMLString::equals(pChildElement->getNodeName(), X("ULROWOFFSET")))
{
curTile.mStartRow = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
}
if (XMLString::equals(pChildElement->getNodeName(), X("LRCOLOFFSET")))
{
curTile.mEndCol = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
}
if (XMLString::equals(pChildElement->getNodeName(), X("LRROWOFFSET")))
{
curTile.mEndRow = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
}
pChildElement = pChildElement->getNextElementSibling();
}
tiles.push_back(curTile);
if (curTile.mEndCol > width)
{
width = curTile.mEndCol;
}
if (curTile.mEndRow > height)
{
height = curTile.mEndRow;
}
}
return tiles;
}
示例9: scName
static bool
SAMLCheckSubject(const DOMDocument *doc,
SAMLTokenData &token)
{
const DOMElement *subject;
char *name = g_strdup_printf("%sSubject",
token.ns.c_str());
subject = SAMLFindChildByName(doc->getDocumentElement(), name);
g_free(name);
if (NULL == subject) {
// Should not happen, since this is required element in the schema.
Log("%s: Missing subject element!\n", __FUNCTION__);
// ASSERT(0);
return false;
}
const DOMElement *nameID;
name = g_strdup_printf("%sNameID", token.ns.c_str());
nameID = SAMLFindChildByName(subject, name);
g_free(name);
if (NULL == nameID) {
/*
* The schema allows BaseID, NameID, or EncryptedID. The library code
* for the SSO server only supports NameID. EncryptedID is really
* complicated (and we don't have decryption keys, so let's not
* support it for now.
*/
Log("%s: No NameID element for the subject.\n", __FUNCTION__);
return false;
}
token.subjectName = SAMLStringWrapper(nameID->getTextContent()).c_str();
Debug("%s: subjectName: '%s'\n", __FUNCTION__, token.subjectName.c_str());
/*
* TODO: Investigate: NameID elements can have a NameQualifier attribute.
* This smells like a domain name, and we might want to include it with
* subject name (<NameQualifier>\subjectName).
*/
/*
* Find all the SubjectConfirmation nodes and see if at least one can be
* verified.
*/
name = g_strdup_printf("%sSubjectConfirmation", token.ns.c_str());
XMLT scName(name);
g_free(name);
for (DOMElement *child = subject->getFirstElementChild(); child != NULL;
child = child->getNextElementSibling()) {
if (!XMLString::equals(child->getNodeName(), scName.getUnicodeStr())) {
continue;
}
const XMLCh *method = child->getAttribute(MAKE_UNICODE_STRING("Method"));
if ((NULL == method) || (0 == *method)) {
// Should not happen, since this is a required attribute.
ASSERT(0);
Debug("%s: Missing confirmation method.\n", __FUNCTION__);
continue;
}
if (!XMLString::equals(
MAKE_UNICODE_STRING("urn:oasis:names:tc:SAML:2.0:cm:bearer"),
method)) {
Debug("%s: Non-bearer confirmation method in token", __FUNCTION__);
continue;
}
const DOMElement *subjConfirmData;
name = g_strdup_printf("%sSubjectConfirmationData", token.ns.c_str());
subjConfirmData = SAMLFindChildByName(child, name);
g_free(name);
if (NULL != subjConfirmData) {
if (!SAMLCheckTimeAttr(subjConfirmData, "NotBefore", true) ||
!SAMLCheckTimeAttr(subjConfirmData, "NotOnOrAfter", false)) {
Warning("%s: subjConfirmData time check failed\n", __FUNCTION__);
continue;
}
const XMLCh *recipient;
recipient = subjConfirmData->getAttribute(
MAKE_UNICODE_STRING("Recipient"));
/*
* getAttribute() returns a 0-length string, not NULL, if it can't
* find what it wants.
*/
if ((0 != XMLString::stringLen(recipient)) &&
!SAMLCheckAudience(recipient)) {
Debug("%s: failed recipient check\n", __FUNCTION__);
continue;
}
}
return true;
}
//.........这里部分代码省略.........