Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3277682
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:23:47+00:00 2026-05-17T19:23:47+00:00

I am having a lot of trouble working with the libxml2 library to parse

  • 0

I am having a lot of trouble working with the libxml2 library to parse an xml file.

I have weeded out a previous, similar problem, but have run into another.

Here is the problem code:

class SSystem{
public:
    //Constructors
    SSystem(){};
    //Make SSystem from XML Definition. Pass ptr to node
    SSystem(xmlNodePtr Nptr, xmlDocPtr Dptr){
        name = wxString((char *)xmlGetProp(Nptr, (xmlChar*)"name"), wxConvUTF8);
        //Move to next level down, the <general> element
        Nptr = Nptr->xmlChildrenNode;
        //Move one more level down to the <radius> element
        Nptr = Nptr->xmlChildrenNode;
        //Get Radius value
        if (!xmlStrcmp(Nptr->name, (const xmlChar *)"radius")) {
            char* contents = (char*)xmlNodeGetContent(Nptr);
            std::string test1 = std::string(contents);
            radius = wxString(contents, wxConvUTF8);
        }
    }

Both an xmlNodePtr and an xmlDocPtr are passed to the constructor, which works fine taking just a property (“name”), but is now choking on further parsing.

Here is a piece of the xml file in question:

<?xml version="1.0" encoding="UTF-8"?>
<Systems>
 <ssys name="Acheron">
  <general>
   <radius>3500.000000</radius> <-- I am trying to get this value (3500).
   <stars>300</stars>
   <asteroids>0</asteroids>
   <interference>0.000000</interference>
   <nebula volatility="0.000000">0.000000</nebula>
  </general>

It compiles fine, but crashes when the constructor is loaded (I know because, if I comment out the if conditional and the char* contents = (char*)xmlNodeGetContent(Nptr->xmlChildrenNode), it runs fine.

I’ve tried so many different things (removed one of the Nptr->xmlChildrenNode), but nothing works.

What is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:23:48+00:00Added an answer on May 17, 2026 at 7:23 pm

    Okay, I am going to use a different XML parsing library, as Libxml is a bit too complicated for me.

    I am looking into using MiniXML (http://www.minixml.org/).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a lot of trouble getting my compiled assembly file working on SPIM.
I'm having a lot of trouble working out how to use mod_rewrite (via htaccess)
With the revamp of XCode I am having a lot of trouble working out
I am having a lot of trouble adding the WEKA library to a project
I'm having a lot of trouble with my background worker. I have a background
Working with the Facebook php SDK's, I am having a lot of trouble figuring
I am having a lot of trouble trying to find out how to draw
I'm working with Core Data and having a lot of trouble's getting data into
I am having a lot of trouble with this basic recursion problem in java;
I am having a lot of trouble in working with streams using monodroid. What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.