本文整理汇总了C++中DOMNode::getNodeType方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::getNodeType方法的具体用法?C++ DOMNode::getNodeType怎么用?C++ DOMNode::getNodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::getNodeType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectConfigElement
void Triggerconf::createConfigAttribute (string module, string submodule, string configname, string attributename)
{
//
// attributes are always created, no matter if they exists or not
// dublication is prevented by xercesc
//
DOMNode* currentConfigElement = selectConfigElement (module, submodule, configname);
if (currentConfigElement == NULL) return;
assert (currentConfigElement->getNodeType () == DOMNode::ELEMENT_NODE);
DOMElement* elem = (DOMElement*) currentConfigElement;
XMLCh* xattrname = XMLString::transcode (attributename.c_str ());
XMLCh* xempty = XMLString::transcode ("");
elem->setAttribute (xattrname, xempty);
XMLString::release (&xattrname);
XMLString::release (&xempty);
resetError ();
}
示例2: findElement
void findElement(unsigned index) {
currentElement = NULL;
while ((elementList != NULL) && (index < elementList->getLength())) {
DOMNode *node = elementList->item(index);
if (node == NULL) {
// Should be impossible
throw new runtime_error("DOMChildIterator::setIndex() - elementList->item(i) failed");
}
if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
DOMElement *el = dynamic_cast< xercesc::DOMElement* >( node );
if (el == NULL) {
// Should be impossible
throw new runtime_error("DOMChildIterator::setIndex() - casting failed");
}
currentElement = el;
this->index = index;
break;
}
index++;
}
}
示例3: getAnimalName
// Returns the value of the "name" child of an "animal" element.
const XMLCh* getAnimalName(const DOMElement* animal)
{
static XercesString name = fromNative("name");
// Iterate though animal's children
DOMNodeList* children = animal->getChildNodes( );
for ( size_t i = 0,
len = children->getLength( );
i < len;
++i )
{
DOMNode* child = children->item(i);
if ( child->getNodeType( ) == DOMNode::ELEMENT_NODE &&
static_cast<DOMElement*>(child)->getTagName( ) == name )
{
// We've found the "name" element.
return child->getTextContent( );
}
}
return 0;
}
示例4: getPreviousLogicalSibling
DOMElement * DOMElementImpl::getPreviousElementSibling() const
{
DOMNode* n = getPreviousLogicalSibling(this);
while (n != NULL) {
switch (n->getNodeType()) {
case DOMNode::ELEMENT_NODE:
return (DOMElement*) n;
case DOMNode::ENTITY_REFERENCE_NODE:
{
DOMElement* e = getLastElementChild(n);
if (e != NULL)
return e;
}
break;
default:
break;
}
n = getPreviousLogicalSibling(n);
}
return NULL;
}
示例5: lookupPrefix
const XMLCh* DOMNodeImpl::lookupPrefix(const XMLCh* namespaceURI) const {
// REVISIT: When Namespaces 1.1 comes out this may not be true
// Prefix can't be bound to null namespace
if (namespaceURI == 0) {
return 0;
}
DOMNode *thisNode = castToNode(this);
short type = thisNode->getNodeType();
switch (type) {
case DOMNode::ELEMENT_NODE: {
return lookupPrefix(namespaceURI, (DOMElement*)thisNode);
}
case DOMNode::DOCUMENT_NODE:{
return ((DOMDocument*)thisNode)->getDocumentElement()->lookupPrefix(namespaceURI);
}
case DOMNode::ENTITY_NODE :
case DOMNode::NOTATION_NODE:
case DOMNode::DOCUMENT_FRAGMENT_NODE:
case DOMNode::DOCUMENT_TYPE_NODE:
// type is unknown
return 0;
case DOMNode::ATTRIBUTE_NODE:{
if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) {
return fOwnerNode->lookupPrefix(namespaceURI);
}
return 0;
}
default:{
DOMNode *ancestor = getElementAncestor(thisNode);
if (ancestor != 0) {
return ancestor->lookupPrefix(namespaceURI);
}
return 0;
}
}
}
示例6: parseGameObjectFile
void XmlPropertyReader::parseGameObjectFile(Ogre::DataStreamPtr &stream, const Ogre::String &groupName)
{
initializeXml();
XERCES_CPP_NAMESPACE::DOMDocument* doc = loadDocument(stream);
DOMNodeList* godefsXml = doc->getDocumentElement()->getElementsByTagName(AutoXMLCh("gameobjectclass").data());
for (unsigned int idx = 0; idx < godefsXml->getLength(); idx++)
{
PropertyRecordPtr ps(new PropertyRecord());
DOMElement* curNode = static_cast<DOMElement*>(godefsXml->item(idx));
const DOMNamedNodeMap* godefAttrs = curNode->getAttributes();
for (XMLSize_t attrIdx = 0; attrIdx < godefAttrs->getLength(); attrIdx++)
{
PropertyEntry entry = processProperty(static_cast<DOMAttr*>(godefAttrs->item(attrIdx)));
if (entry.first != "")
{
ps->setProperty(entry.first, entry.second);
}
}
DOMNodeList* godefChildren = curNode->getChildNodes();
for (XMLSize_t childIdx = 0; childIdx < godefChildren->getLength(); childIdx++)
{
DOMNode* curChild = godefChildren->item(childIdx);
if (curChild->getNodeType() == DOMNode::ELEMENT_NODE)
{
PropertyEntry entry = processProperty(static_cast<DOMElement*>(curChild));
if (entry.first != "")
{
ps->setProperty(entry.first, entry.second);
}
}
}
mPropertyRecords.push_back(ps);
}
shutdownXml();
}
示例7: load
void DSIGKeyInfoName::load(void) {
// Assuming we have a valid DOM_Node to start with, load the signing key so that it can
// be used later on
if (mp_keyInfoDOMNode == NULL) {
// Attempt to load an empty signature element
throw XSECException(XSECException::LoadEmptyInfoName);
}
if (!strEquals(getDSIGLocalName(mp_keyInfoDOMNode), "KeyName")) {
throw XSECException(XSECException::LoadNonInfoName);
}
// Now find the text node containing the name
DOMNode *tmpElt = mp_keyInfoDOMNode->getFirstChild();
while (tmpElt != 0 && tmpElt->getNodeType() != DOMNode::TEXT_NODE)
tmpElt = tmpElt->getNextSibling();
if (tmpElt != 0) {
mp_keyNameTextNode = tmpElt;
mp_name = tmpElt->getNodeValue();
}
else {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
MAKE_UNICODE_STRING("Expected TEXT node as child to <KeyName> element"));
}
}
示例8: attNodeCount
int attNodeCount(DOMElement * d) {
int ret;
ret = d->getAttributes()->getLength();
DOMNode *c;
c = d->getFirstChild();
while (c != NULL) {
if (c->getNodeType() == DOMNode::ELEMENT_NODE)
ret += attNodeCount((DOMElement *) c);
c = c->getNextSibling();
}
return ret;
}
示例9:
DOMNode *WrapXerces::getNextLogicalSibling (
const DOMNode* n )
{
// Copied from Xerces-C
DOMNode* next = n->getNextSibling();
// If "n" has no following sibling and its parent is an entity reference node we
// need to continue the search through the following siblings of the entity
// reference as these are logically siblings of the given node.
if ( !next ) {
DOMNode* parent = n->getParentNode();
while ( parent
&& parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE )
{
next = parent->getNextSibling();
if ( next )
break;
parent = parent->getParentNode();
}
}
return next;
}
示例10: if
Implementation
CSDReader4qxml::implementation (DOMElement* element)
throw(CSDReadException)
{
Implementation impl;
impl.id = Qedo::transcode(element->getAttribute(X("id")));
std::string element_name;
DOMNode* child = element->getFirstChild();
while (child != 0)
{
if (child->getNodeType() == DOMNode::ELEMENT_NODE)
{
element_name = Qedo::transcode(child->getNodeName());
//
// os
//
if (element_name == "os")
{
impl.os_name=os((DOMElement*)child);
}
//
// fileinarchive
//
else if (element_name == "descriptor")
{
impl.descriptor=descriptor((DOMElement*)child);
}
}
// get next child
child = child->getNextSibling();
}
//throw CSDReadException();
return impl;
}
示例11: isEqualNode
bool DOMNodeImpl::isEqualNode(const DOMNode* arg) const
{
if (!arg)
return false;
if (isSameNode(arg)) {
return true;
}
DOMNode* thisNode = castToNode(this);
if (arg->getNodeType() != thisNode->getNodeType()) {
return false;
}
// the compareString will check null string as well
if (!XMLString::equals(thisNode->getNodeName(), arg->getNodeName())) {
return false;
}
if (!XMLString::equals(thisNode->getLocalName(),arg->getLocalName())) {
return false;
}
if (!XMLString::equals(thisNode->getNamespaceURI(), arg->getNamespaceURI())) {
return false;
}
if (!XMLString::equals(thisNode->getPrefix(), arg->getPrefix())) {
return false;
}
if (!XMLString::equals(thisNode->getNodeValue(), arg->getNodeValue())) {
return false;
}
return true;
}
示例12: createRegion
void *NclLayoutParser::parseRegion(
DOMElement *parentElement, void *objGrandParent) {
wclog << "parseRegion" << endl;
void *parentObject;
DOMNodeList *elementNodeList;
DOMElement *element;
DOMNode *node;
string elementTagName;
void *elementObject;
parentObject = createRegion(parentElement, objGrandParent);
if (parentObject == NULL) {
return NULL;
}
elementNodeList = parentElement->getChildNodes();
for (int i = 0; i < (int)elementNodeList->getLength(); i++) {
node = elementNodeList->item(i);
if (node->getNodeType()==DOMNode::ELEMENT_NODE) {
element = (DOMElement*)node;
elementTagName = XMLString::transcode(element->getTagName());
wclog << ">>" << elementTagName.c_str() << ": ";
wclog << XMLString::transcode(element->getAttribute(XMLString::transcode("id")));
if (XMLString::compareIString(
elementTagName.c_str(), "region") == 0) {
elementObject = parseRegion(element, parentObject);
if (elementObject != NULL) {
addRegionToRegion(parentObject, elementObject);
}
}
}
}
return parentObject;
}
示例13: createImportedDocumentBase
void *NclImportParser::parseImportedDocumentBase(
DOMElement *parentElement, void *objGrandParent) {
void *parentObject;
DOMNodeList *elementNodeList;
DOMElement *element;
DOMNode *node;
string elementTagName;
void *elementObject;
//pre-compile attributes
parentObject = createImportedDocumentBase(
parentElement, objGrandParent);
if (parentObject == NULL) {
return NULL;
}
elementNodeList = parentElement->getChildNodes();
for (int i = 0; i < (int)elementNodeList->getLength(); i++) {
node = elementNodeList->item(i);
if(node->getNodeType()==DOMNode::ELEMENT_NODE){
element = (DOMElement*)node;
elementTagName = XMLString::transcode( element->getTagName() );
if (XMLString::compareIString(
elementTagName.c_str(), "importNCL") == 0) {
elementObject = parseImportNCL(element, parentObject);
if (elementObject != NULL) {
addImportNCLToImportedDocumentBase(
parentObject, elementObject);
}
}
}
}
return parentObject;
}
示例14: clsSettingsReaderException
list<string> ClsSettingsReader::getListLastFiles() {
#ifdef DEBUG_CLSSETTINGSREADER
cout << "ClsSettingsReader::getListLastFiles()" << endl;
#endif
list<string> lstLFO;
if(iSysSettingReaderState != PARSER_BUFFER_PARSED){
ClsSettingsReaderException clsSettingsReaderException(ClsSettingsReaderException::BUFFER_NOT_PARSED);
throw clsSettingsReaderException;
}
DOMNodeList* dnlstTemp = ddocIqrSetting->getElementsByTagName(XMLString::transcode(ClsTagLibrary::lastFilesOpen()));
DOMNode* dnTemp=NULL;
if ( dnlstTemp->getLength() == 1){
dnTemp = dnlstTemp->item(0);
} else if ( dnlstTemp->getLength() < 1) {
ClsSettingsReaderException clsSettingsReaderException(ClsSettingsReaderException::ENTITY_NOT_FOUND);
throw clsSettingsReaderException;
}
DOMNodeList* dnlstFiles = dnTemp->getChildNodes();
unsigned int ii = 0;
while( ii< dnlstFiles->getLength()){
DOMNode* dnTempTemp = dnlstFiles->item(ii);
if(dnTempTemp->getNodeType() == 1){
DOMNode* dnValue = dnTempTemp->getFirstChild();
if(dnValue!=NULL){
string strValue = XMLString::transcode(dnValue->getNodeValue());
lstLFO.push_back(strValue);
}
}
ii++;
}
return lstLFO;
};
示例15: getChildOfType
DOMNode* Triggerconf::getChildOfType (DOMNode* root, short type, unsigned int index)
{
if (root == NULL) return NULL;
if (! root->hasChildNodes ()) return NULL;
DOMNodeList* childs = root->getChildNodes ();
if (childs == NULL) return NULL;
unsigned int idx = 0;
for (unsigned int i=0; i<childs->getLength (); i++) {
DOMNode* child = childs->item (i);
if (child->getNodeType () == type) {
if (idx == index)
return child;
else
idx++;
}
} // for (unsigned int i=0; i<childs->getLength (); i++)
return NULL;
}