Re: [xml] Newline at the end of output
- From: James Hart <beeblebrox42 gmail com>
- To: xml gnome org
- Subject: Re: [xml] Newline at the end of output
- Date: Tue, 9 Jun 2009 15:30:11 -0600
Martin,
Exactly the answer I needed. The xmlSaveTree works great.
~James
On Tue, Jun 9, 2009 at 2:56 PM, Martin (gzlist)
<gzlist googlemail com> wrote:
On 09/06/2009, James Hart <
beeblebrox42 gmail com> wrote:
> I have a use case where I need to treat an xml document as a document
> fragment, I won't get into the details of why exactly, but lets make the
> assumption it is a valid use case for now.
For your case, rather than doing:
> xmlSaveDoc(saveCtxt, doc_);
Instead do:
xmlSaveTree(saveCtxt, xmlDocGetRootElement(doc_));
> I don't want to have to hack the removal of this newline in my code if it
> can be helped. Is there a way to do this and not get the newline? Is there
> a way to output the xml string for just the root element instead of using
> the document approach to get around this?
Just hacking off the trailing newline is the method that's been used
when needed in the past, see for instance:
<https://bugs.webkit.org/show_bug.cgi?id=15919>
<http://bugzilla.gnome.org/show_bug.cgi?id=495668>
<http://trac.webkit.org/changeset/28014>
<http://trac.webkit.org/browser/trunk/WebCore/xml/XSLTProcessor.cpp?rev=42738#L192>
Martin
--
If there is anything bigger than my ego around, I want it caught and shot now!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]