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 ;
    }
Esempio n. 2
0
gboolean
xml_reader_move_to_nth_attribute (XmlReader *reader,
                                  gint       nth)
{
  g_return_val_if_fail (XML_IS_READER (reader), FALSE);

  return (xmlTextReaderMoveToAttributeNo (reader->xml, nth) == 1);
}
Esempio n. 3
0
bool c_XMLReader::t_movetoattributeno(int64_t index) {
  if (m_ptr) {
    int ret = xmlTextReaderMoveToAttributeNo(m_ptr, index);
    if (ret == 1) {
      return true;
    }
  }
  return false;
}
void BEXMLTextReader::move_to_attribute ( const int attribute_number )
{
	int return_code = xmlTextReaderMoveToAttributeNo ( reader, attribute_number );
	if ( return_code == kBE_XMLReaderError ) {
		throw BEXMLReaderInterface_Exception ( last_error() );
	} else if ( return_code == 0 ) {
		throw BEXMLReaderInterface_Exception ( kBE_XMLReaderAttributeNotFoundError );
	}
}
Esempio n. 5
0
bool c_XMLReader::t_movetoattributeno(int64 index) {
  INSTANCE_METHOD_INJECTION_BUILTIN(XMLReader, XMLReader::movetoattributeno);
  if (m_ptr) {
    int ret = xmlTextReaderMoveToAttributeNo(m_ptr, index);
    if (ret == 1) {
      return true;
    }
  }
  return false;
}
Esempio n. 6
0
bool HHVM_METHOD(XMLReader, moveToAttributeNo,
                 int64_t index) {
  auto* data = Native::data<XMLReader>(this_);
  SYNC_VM_REGS_SCOPED();
  if (data->m_ptr) {
    int ret = xmlTextReaderMoveToAttributeNo(data->m_ptr, index);
    if (ret == 1) {
      return true;
    }
  }
  return false;
}
Esempio n. 7
0
/* reader:move_to_attribute(name|idx) */
static int xmlreader_move_to_attribute(lua_State *L)
{
  xmlreader xr = check_xmlreader(L, 1);
  int ret;

  if (lua_type(L, 2) == LUA_TNUMBER) {
    int n = luaL_checkint(L, 2);
    ret = xmlTextReaderMoveToAttributeNo(xr, n);
  } else {
    const xmlChar *name = (xmlChar*)luaL_checkstring(L, 2);
    ret = xmlTextReaderMoveToAttribute(xr, name);
  }

  BOOL_OR_ERROR(L, ret);
}
Esempio n. 8
0
/*
 * call-seq:
 *   reader.move_to_attribute(val) -> code
 *
 * Move the position of the current instance to the attribute with the
 * specified index (if +val+ is an integer) or name (if +val+ is a string)
 * relative to the containing element.
 */
static VALUE rxml_reader_move_to_attr(VALUE self, VALUE val)
{
  xmlTextReaderPtr xreader;
  int ret;

  xreader = rxml_text_reader_get(self);

  if (TYPE(val) == T_FIXNUM)
  {
    ret = xmlTextReaderMoveToAttributeNo(xreader, FIX2INT(val));
  }
  else
  {
    ret = xmlTextReaderMoveToAttribute(xreader,
        (const xmlChar *) StringValueCStr(val));
  }

  return INT2FIX(ret);
}
Esempio n. 9
0
static	void	FetchAttributes(xmlTextReaderPtr reader,t_ctxt *ctxt)
{
	int	i;
	int	attrCount = xmlTextReaderAttributeCount(reader);

//printf("fetch xml attributes %d\n",attrCount);
	ctxt->atcount	= 0;
	for (i = 0; i < attrCount && i < XOML_MAX_ATTR ; i++) 
	{
		xmlChar	*aqname	= NULL;
		xmlChar	*avalue	= NULL;

		xmlTextReaderMoveToAttributeNo(reader,i);
		aqname	= xmlTextReaderName(reader);
		avalue	= xmlTextReaderValue(reader);

		ctxt->atname[ctxt->atcount]	= (char *)aqname;
		ctxt->atvalue[ctxt->atcount]	= (char *)avalue;
		ctxt->atcount++;
	}
}
Esempio n. 10
0
/* {{{ proto boolean XMLReader::moveToAttributeNo(int index)
Positions reader at attribute at specified index.
Returns TRUE on success and FALSE on failure */
PHP_METHOD(xmlreader, moveToAttributeNo)
{
	zval *id;
	zend_long attr_pos;
	int retval;
	xmlreader_object *intern;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &attr_pos) == FAILURE) {
		return;
	}

	id = getThis();

	intern = Z_XMLREADER_P(id);
	if (intern && intern->ptr) {
		retval = xmlTextReaderMoveToAttributeNo(intern->ptr, attr_pos);
		if (retval == 1) {
			RETURN_TRUE;
		}
	}

	RETURN_FALSE;
}