[xml] Help in using the xmlStopParser -sax for libxml2
- From: nikunj nemani <nikunjnemani gmail com>
- To: Aaron Patterson <aaron patterson gmail com>
- Cc: xml gnome org
- Subject: [xml] Help in using the xmlStopParser -sax for libxml2
- Date: Tue, 7 Apr 2009 11:23:39 -0700
Hello,
I am trying to use xmlStopParser for stop the sax parser.
The problem is I want to call it from endElementDebug.
which has syntax endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
It does not have a xmlParserCtxtPtr.
I am not directly calling the endElement.
I have a function defined and I am calling
xmlSAXUserParseFile(
debugSAXHandler, sctx, filename)
Inside endElementDebug I did
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx
xmlStopParser(ctxt)
But this doesn't seem to work.
Can you help me how to solve this problem.
Thanks and Regards,
Nikunj
2009/4/7 Aaron Patterson
<aaron patterson gmail com>
On Tue, Apr 7, 2009 at 2:41 AM, Daniel Veillard <
veillard redhat com> wrote:
> On Mon, Apr 06, 2009 at 05:10:39PM -0700, Aaron Patterson wrote:
>> On Mon, Apr 6, 2009 at 4:01 PM, Aaron Patterson
>> <
aaron patterson gmail com> wrote:
>> > Hi,
>> >
>> > Is there a way to adjust the indenting level when using xmlSaveToIO()?
>> > I've set xmlIndentTreeOutput to 1, set the xmlTreeIndentString, and
>> > made sure to enable XML_SAVE_FORMAT in the options, but none of this
>> > seems to help. Any hints would be greatly appreciated.
>> >
>> > The code I have right now is like this:
>> >
>> > xmlIndentTreeOutput = 1;
>> > xmlTreeIndentString = "---------------";
>> >
>> > xmlSaveCtxtPtr savectx = xmlSaveToIO(
>> > (xmlOutputWriteCallback)io_write_callback,
>> > (xmlOutputCloseCallback)io_close_callback,
>> > (void *)io,
>> > NULL,
>> > options
>> > );
>> >
>> > xmlSaveTree(savectx, node);
>> > xmlSaveClose(savectx);
>>
>> Nevermind! It works fine. I just had blank text nodes in my tree
>> that disabled the formatting.
>
> Ah, okay, but again this is a global variable, I guess a setting in
> the xmlSaveCtxtPtr would be way better,
Yes, that would be nice. I see there are some settings in the
xmlSaveCtxt struct, but that struct is private.
Thank you for the excellent library!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]