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

  • Home
  • SEARCH
  • 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 8441717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:38:15+00:00 2026-06-10T08:38:15+00:00

In my software, I use libxml2 to manipulate (obviously) XML data structures. I mainly

  • 0

In my software, I use libxml2 to manipulate (obviously) XML data structures. I mainly use XSD schema validation and so far, it works well.

When the data structure input by the client doesn’t match the XSD schema, libxml2 output some debug messages to the console.

Here is an example:

/data/file_name:5230: parser error : StartTag: invalid element name
<
^

While those strings are useful for debugging purposes, I don’t want them to appear and polute the console output in the final app. So far, I couldn’t find an official way of doing this.Though, i do have one method of modifying the library itself,but i’m looking for a library configuration which does that i.e, without modifying the code.

Do you know how to suppress the debug output or (even better) to redirect it to a custom function ?

Peace & Regards.

  • 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-06-10T08:38:17+00:00Added an answer on June 10, 2026 at 8:38 am

    There is a callback mechanism for outputting warnings and errors the way you want.

    As said in the API documentation, xmlSchemaSetParserErrors() Set the callback functions used to handle errors for a validation context.

    You need to write two callback functions with respect to defined signature :

    • xmlSchemaValidityErrorFunc err
    • xmlSchemaValidityWarningFunc warn

    An example could be :

    void err(void *ctx, const char *msg, ...)
    {
      char buf[1024];
      va_list args;
    
      va_start(args, msg);
      int len = vsnprintf_s(buf, sizeof(buf), sizeof(buf)/sizeof(buf[0]), msg, args);
      va_end(args);
    
      if(len==0) // Can't create schema validity error!
      else       // Do something to store `buf`, 
                 // you may need to use void *ctx to achieve this
    
      return;
    }
    

    Then just call

    xmlSchemaSetValidErrors(valid_ctxt_ptr, (xmlSchemaValidityErrorFunc) err, (xmlSchemaValidityWarningFunc) warn, ctx);

    before calling

    xmlSchemaValidateDoc()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my software, I use libxml2 and xmlsec to manipulate (obviously) XML data structures.
I'm exploring a piece of software making use of Oracle API and as far
I'm beginning to work on mailing-list software we use internally (EDIT: though we send
We're getting ready to deploy a commercial application. Our software makes use of several
We use a software which uses Sql server 2005 as back-end. The problem is
A stupid third-party software that we use stores datetime as varchar for some good
I am interested in an array of software ideas and use more than one
I know you can use source control software for source code, but can you
I need to use the RGBRast software renderer for a DirectX application I'm developing.
I am taking a software engineering course and we use Java to implement some

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.