Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [XML] Assertion when GetAttrCount()
[XML] Assertion when GetAttrCount() [message #6906] Mon, 04 December 2006 08:29 Go to previous message
g00fy is currently offline  g00fy
Messages: 15
Registered: December 2006
Location: Mechelen, Belgium, Europe
Promising Member
#include <CtrlLib/CtrlLib.h>
#include <ide/Common/Common.h>
#include <Core/Core.h>


void write_out( FileOut& out, const XmlNode& xml, int ident )
{
	switch( xml.GetType() )
	{
	case XML_TEXT:
		out << String(' ', ident) << "Text: " << xml.GetText() << "\n";
		break;
	case XML_TAG:
		out << String(' ', ident) << "Tag: " << xml.GetTag() << "\n";
		for ( int i = 0, total = xml.GetAttrCount(); i < total; i++ )
		{
			out << String( ' ', ident ) << "+> " << xml.AttrId(i) << ": " << xml.Attr(i) << "\n";
		}
		ident += 2;
		break;
	case XML_DOC:
		out << String(' ', ident) << "Doc:\n";
		break;
	default:
		out << String(' ', ident) << "**UNDEFINED TAG**\n";
		break;
	}
	
	for ( int i = 0, total = xml.GetCount(); i < total; i++ )
	{
		write_out(out, xml[i], ident + 2);
	}
}

GUI_APP_MAIN
{
	Package p;

	String filename("C:\\Upp\\uppsrc\\ide\\Common\\Common.upp");

	p.Load(filename);
	
	XmlNode xml;

	XmlNode makefile = xml.Add("makefile");
	
	XmlNode lib = makefile.Add("lib");
	lib.SetAttr("id", GetFileName(filename));
	
	FileOut out("c:\\tst.dat");
	write_out(out, xml, 2);
}


This code asserts on the call to "xml.GetAttrCount()". It thinks the vector holding those items have -1 items only...

Greetz
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bug in "Streams" documentation (Serialization support)?
Next Topic: Value: BOOLEAN_V, USERVALUE_V [REQUEST]
Goto Forum:
  


Current Time: Tue Jun 17 10:34:14 CEST 2025

Total time taken to generate the page: 0.04315 seconds