本文整理汇总了C++中xmlTextReaderConstValue函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlTextReaderConstValue函数的具体用法?C++ xmlTextReaderConstValue怎么用?C++ xmlTextReaderConstValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlTextReaderConstValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
int XMIResource::loadPoint(xmlTextReaderPtr reader, const model::BaseObject& o)
{
assert(o.kind() == LINK);
std::vector<double> points;
controller.getObjectProperty(o.id(), o.kind(), CONTROL_POINTS, points);
// iterate on attributes
for (int rc = xmlTextReaderMoveToFirstAttribute(reader); rc > 0; rc = xmlTextReaderMoveToNextAttribute(reader))
{
auto found = std::find(constXcosNames.begin(), constXcosNames.end(), xmlTextReaderConstName(reader));
enum xcosNames current = static_cast<enum xcosNames>(std::distance(constXcosNames.begin(), found));
switch (current)
{
case e_x:
points.push_back(to_double(xmlTextReaderConstValue(reader)));
break;
case e_y:
points.push_back(to_double(xmlTextReaderConstValue(reader)));
break;
default:
// ignore other parameters
// TODO: Does other metamodels might be managed there ?
break;
}
}
controller.setObjectProperty(o.id(), o.kind(), CONTROL_POINTS, points);
return 1;
}
示例2: processNode
/**
* processNode:
* @reader: the xmlReader
*
* Dump information about the current node
*/
static void
processNode(xmlTextReaderPtr reader) {
const xmlChar *name, *value;
int nodetype;
static char spaces[33]=" ";
name = xmlTextReaderConstName(reader);
if (name == NULL)
name = BAD_CAST "--";
value = xmlTextReaderConstValue(reader);
nodetype = xmlTextReaderNodeType(reader);
if (nodetype!=14 && nodetype!=15) // Skip all text bodies and "/" entities.
{
#ifdef DETAILS
printf("%s%d %d %s %d %d",
(spaces + (32-2*xmlTextReaderDepth(reader))),
xmlTextReaderDepth(reader),
nodetype,
name,
xmlTextReaderIsEmptyElement(reader),
xmlTextReaderHasValue(reader));
#else
printf("%s%s", (spaces + (32-2*xmlTextReaderDepth(reader))), name);
#endif
if (value == NULL)
printf("\n");
else {
if (xmlStrlen(value) > 40)
printf(" %.40s...\n", value);
else
printf(" %s\n", value);
}
}
if (nodetype==1) // Element - possibly has attributes
{
while (xmlTextReaderMoveToNextAttribute(reader))
printf("%s Attrib: %s=\"%s\"\n",
(spaces + (32-2*xmlTextReaderDepth(reader))),
xmlTextReaderConstName(reader),
xmlTextReaderConstValue(reader));
}
}
示例3: parse_dev_class
static void parse_dev_class(xmlTextReaderPtr reader)
{
char *value;
value = (char *)xmlTextReaderConstValue(reader);
print_dev_class(atoi(value));
}
示例4: xmlTextReaderConstValue
static char *ReaderValue( xml_reader_t *p_reader )
{
const xmlChar *psz_value =
xmlTextReaderConstValue( p_reader->p_sys->p_reader );
return psz_value ? strdup( (const char *)psz_value ) : NULL;
}
示例5: xmlTextReaderRead
string XMLConversion::GetContent()
{
xmlTextReaderRead(_reader);
const xmlChar* pvalue = xmlTextReaderConstValue(_reader);
string value((const char*)pvalue);
return Trim(value);
}
示例6: processNode
/**
* processNode:
* @reader: the xmlReader
*
* Dump information about the current node
*/
static void
processNode(xmlTextReaderPtr reader) {
const xmlChar *name, *value;
name = xmlTextReaderConstName(reader);
if (name == NULL)
name = BAD_CAST "--";
value = xmlTextReaderConstValue(reader);
printf("Depth: %d; Type: %d; Name: %s; %d|%d",
xmlTextReaderDepth(reader),
xmlTextReaderNodeType(reader),
name,
xmlTextReaderIsEmptyElement(reader),
xmlTextReaderHasValue(reader));
if (value == NULL)
printf("\n");
else {
if (xmlStrlen(value) > 40)
printf("|-> %.40s...\n", value);
else
printf(" %s\n", value);
}
}
示例7: myProcessNode
int myProcessNode(xmlTextReaderPtr reader,int *lastdepth, int *readnext ,int *mode,char** savehere,int *i)
{
const xmlChar *name, *value;
name = xmlTextReaderConstName(reader);
if (name == NULL)
name = BAD_CAST "--";
value = xmlTextReaderConstValue(reader);
if(*readnext == 1 && *lastdepth == xmlTextReaderDepth(reader)-1)
{
if(*i <6)
{
sprintf(savehere[*i],"%s",value);
*i=*i + 1;
}
else
return 1;
}
else if(0==strncmp(name,"title",5) && *mode>0)
{
*readnext = 1;
*lastdepth = xmlTextReaderDepth(reader);
if(*mode==1)
*mode=0;//now look for items
}
else if(0==strncmp(name,"item",4)||0==strncmp(name,"entry",5))
{ //find some news feeds
*mode=2;
}
else
*readnext = 0;
return 0;
}
示例8: while
void XmlParser::_readMember() {
std::string type;
std::string ref;
std::string role;
// Read attributes
if (xmlTextReaderHasAttributes(_reader) == XmlStatus::TRUE) {
while (xmlTextReaderMoveToNextAttribute(_reader)) {
std::string k = (char*) xmlTextReaderConstName(_reader);
std::string v = (char*) xmlTextReaderConstValue(_reader);
if (k == "type") {
type = v;
} else if (k == "ref") {
ref = v;
} else if (k == "role") {
role = v;
}
}
}
if (_prevMemberParentElementId == _parentElementId) {
_dbBuilder.addMember(_parentElementId, ref, type, role, false);
} else {
_dbBuilder.addMember(_parentElementId, ref, type, role, true);
_prevMemberParentElementId = _parentElementId;
}
}
示例9: xmlTextReaderAttributeCount
bool XMLReader::processNode()
{
if (m_reader == NULL)
{
std::cout << "error" << std::endl ;
}
if (xmlTextReaderRead(m_reader) != 1)
{
return false ;
}
m_attributes.clear() ;
if (xmlTextReaderHasAttributes(m_reader) == 1)
{
int count = xmlTextReaderAttributeCount(m_reader) ;
for (int i = 0 ; i < count ; i++)
{
xmlTextReaderMoveToAttributeNo(m_reader, i) ;
m_attributes.insert(
std::pair<std::string, std::string>(
(char*) xmlTextReaderConstLocalName(
m_reader),
(char*) xmlTextReaderConstValue(
m_reader))) ;
}
xmlTextReaderMoveToElement(m_reader) ;
}
// std::cout << print() << std::endl ;
return true ;
}
示例10: xmlTextReaderRead
//-----------------------------------------
void LegacyParser::processAttributeDefaultNode(xmlTextReaderPtr reader) {
//-----------------------------------------
int ret = xmlTextReaderRead(reader);
if( ret == 1 ) {
/* should be the text node */
const xmlChar* name = xmlTextReaderConstName(reader);
if ( xmlStrEqual(name, xmlCharStrdup("#text")) == 1 ) {
int hasVal = xmlTextReaderHasValue(reader);
if(hasVal == 1) {
const xmlChar *value = xmlTextReaderConstValue(reader);
if(value != NULL) {
if( _last_node_type == ATTR_NODE ) {
_gexf->getData().setNodeAttributeDefault(_last_id, Conv::xmlCharToStr(value));
}
else if( _last_node_type == ATTR_EDGE ) {
_gexf->getData().setEdgeAttributeDefault(_last_id, Conv::xmlCharToStr(value));
}
}
}
else if(hasVal == -1) {
throw FileReaderException("An error occured in xmlTextReaderHasValue() for Default node.");
}
}
}
}
示例11: xmlTextReaderConstName
int XMIResource::loadBase64(xmlTextReaderPtr reader, enum object_properties_t property, const model::BaseObject& o)
{
// iterate on attributes
for (int rc = xmlTextReaderMoveToFirstAttribute(reader); rc > 0; rc = xmlTextReaderMoveToNextAttribute(reader))
{
auto found = std::find(constXcosNames.begin(), constXcosNames.end(), xmlTextReaderConstName(reader));
enum xcosNames current = static_cast<enum xcosNames>(std::distance(constXcosNames.begin(), found));
switch (current)
{
case e_base64:
{
const xmlChar* base64 = xmlTextReaderConstValue(reader);
std::vector<double> v = base64::decode<std::vector<double> >(to_string(base64));
controller.setObjectProperty(o.id(), o.kind(), property, v);
break;
}
default:
// ignore other parameters
// TODO: Does other metamodels might be managed there ?
break;
}
}
return 1;
}
示例12: getTitle
/**
* Gets the title from the parser. Returns true if success, false if EOF
*/
bool getTitle (xmlTextReaderPtr xmlReader, int *moreWiki, GString* articleTitle) {
// loops until it finds the title tag or EOF
// one tree at a time, skips sub trees
while (1 == *moreWiki) {
// loops until xmlReader is back down to level 2
// one node at a time
while (1 == *moreWiki && 2 > xmlTextReaderDepth (xmlReader)) {
*moreWiki = xmlTextReaderRead (xmlReader);
}
// loops until it finds the title tag, end of subtree or EOF
// one tree at a time, skips sub trees
while (1 == *moreWiki && 2 <= xmlTextReaderDepth (xmlReader)) {
if (xmlStrEqual(xmlTextReaderConstName(xmlReader), (const unsigned char *) "title")) {
*moreWiki = xmlTextReaderRead(xmlReader);
articleTitle = g_string_assign(articleTitle, (gchar *) xmlTextReaderConstValue(xmlReader));
return (1 == *moreWiki);
}
*moreWiki = xmlTextReaderNext(xmlReader);
}
}
// this should only happen at the end of the document
return (1 == *moreWiki);
}
示例13: rxml_reader_value
/*
* call-seq:
* reader.value -> text
*
* Provide the text value of the node if present.
*/
static VALUE rxml_reader_value(VALUE self)
{
xmlTextReaderPtr xReader = rxml_text_reader_get(self);
const xmlChar *result = xmlTextReaderConstValue(xReader);
const xmlChar *xencoding = xmlTextReaderConstEncoding(xReader);
return (result == NULL ? Qnil : rxml_new_cstr(result, xencoding));
}
示例14: xmlTextReaderConstValue
static char *ReaderValue( xml_reader_t *p_reader )
{
const xmlChar *psz_value =
xmlTextReaderConstValue( p_reader->p_sys->p_reader );
if( psz_value ) return strdup( (const char *)psz_value );
else return 0;
}
示例15: parse_bdaddr
static void parse_bdaddr(xmlTextReaderPtr reader)
{
const char *value;
value = (char *)xmlTextReaderConstValue(reader);
if (value != NULL) {
printf(" %s\n", value);
}
addr = strtoba(value);
}