Зукр Тукр | 1 Feb 14:17
Picon

Trying to serialize compressed XML document

Hello, I'm using libxml2-2.7.8 compiled on Windows with zlib support. I'm trying to get a buffer with compressed XML document. I'm using xmlSetDocCompressMode(doc, 9); function. If I save the doc to a file using xmlSaveFormatFile(), it saves the compressed file fine. However when I'm trying to use xmlDocDump...() functions, the buffer is not compressed. I can see that there is xmlSaveFileTo() function, however I can't find any related documentation on this matter. All my attempts cause crashes. A code example would be much appreciated.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml <at> gnome.org
http://mail.gnome.org/mailman/listinfo/xml
Pietro Cerutti | 1 Feb 18:01
Picon

Segfault setting both xmlTextReaderSetStructuredErrorHandler and xmlSetStructuredErrorFunc

Hi, 

I have a segfault running the sample program here:
http://people.freebsd.org/~gahr/xmlErrorHandler.c

It seems that setting up both xmlTextReaderSetStructuredErrorHandler and
xmlSetStructuredErrorFunc confuses the code around error.c:592 and
following, but I'm having a hard time tracking down the logics there..

I'm not sure if this is somehow related to this other post:
http://mail.gnome.org/archives/xml/2009-August/msg00020.html

Any hints?

--

-- 
Pietro Cerutti
gahr <at> gahr.ch

PGP Public Key:
http://gahr.ch/pgp
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml <at> gnome.org
http://mail.gnome.org/mailman/listinfo/xml
John J. Boyer | 2 Feb 10:17
Favicon

Finding the encoding of an xml documentj.

How do I find the encoding of an xml document? My Braille transcription 
software requires UTF-8. 

Thanks,

--

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities
Nikolay Sivov | 2 Feb 11:28
Picon

Re: Finding the encoding of an xml documentj.

On 2/2/2012 12:17, John J. Boyer wrote:
> How do I find the encoding of an xml document? My Braille transcription
> software requires UTF-8.
What are you trying to do?

If you need to get parsed document encoding I guess it's stored in 
xmlDoc.encoding field and probably in parser context as well.
If you want to guess what encoding your document is in before passing to 
parser - try xmlDetectCharEncoding().
>
> Thanks,
>
Mariano Guadagnini | 2 Feb 17:00
Picon

[XPATH] Nested function calls issue?

Hey guys, 


How are you doing? Well, i've been having an issue with Xpath, using stacked xpath function calls like the one above:

fn:replace('abcdefghi','a',fn:replace('abcdefghi','b','B'))


After evaluation of such expression, the library returns simply "B", instead of aBcdefghibcdefghi as I expected. I came up with this after having issues with my own registered xpath functions, which showed the same behavior, so I decided to try using built in functions, but the result leads the same.

I',m using LibXML2.2.7.

Is this a bug, and if so, any workaround to it?


Thanks in advance,


Best

--
Mariano Guadagnini
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml <at> gnome.org
http://mail.gnome.org/mailman/listinfo/xml
Зукр Тукр | 3 Feb 12:38
Picon

Is there any way to get a compressed buffer in memory?

Hello, I'm using libxml2 with zlib support. I'm trying to get a compressed XML buffer in memory. I've already tried xmlSaveFormatFileTo(), xmlSaveToBuffer() and different xmlDocDump...() functions. They all make buffer not compressed. When I use xmlSaveFormatFile() to save the exact same compressed xmlDoc to a file (not to a buffer) and it saves it compressed. Is there any way at all to have a compressed buffer in memory using standard API functions?
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml <at> gnome.org
http://mail.gnome.org/mailman/listinfo/xml
John J. Boyer | 4 Feb 11:31
Favicon

This code unlinks too much.

The document is xhtml with <head and <body inside the <HTML tag. The 
code is pasted below the line of dashes. The problem area starts with 
the line

oldPrebSib = furbrl->prev;

curBrlNode is defined and set outside this function Itcontains a 
braille translation, in this case of a MathML 
expression. This has already been placed in transNode. curbrlNode 
follows a <math tag, with its subtree. The math expression is supposed 
to be replaced by transNode and curBrlNode removed. When I trace through 
the code with gdb it appears to work properly. However, xmlDocDump does 
not produce anything except the <head subtree within the <HTML tag 
of the xhtml document. 
In other words, the body is completely missing. Suggestions? Thanks.

--------------------

static int
finishBrlNode ()
{
  int wcLength;
  int utf8Length;
  unsigned char *transText = (unsigned char *) ud->outbuf2;
  xmlNode *transNode;
  xmlNode *linkedTransNode;
  xmlNode *oldPrevSib;
  xmlNode *oldBrlNode;
  wcLength = ud->outbuf1_len_so_far;
  utf8Length = ud->outbuf2_len;
  wc_string_to_utf8 (ud->outbuf1, &wcLength, transText, &utf8Length);
  transNode = xmlNewText (transText);
  oldPrevSib = curBrlNode->prev;
  if (oldPrevSib != NULL)
    {
      xmlUnlinkNode (oldPrevSib);
      xmlFreeNode (oldPrevSib);
    }
  linkedTransNode = xmlAddPrevSibling (curBrlNode, transNode);
  afterCurBrl = curBrlNode->next;
  useAfterCurBrl = 1;
  oldBrlNode = curBrlNode;
  xmlUnlinkNode (oldBrlNode);
  xmlFreeNode (oldBrlNode);
  return 1;
}

--

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities
John J. Boyer | 6 Feb 09:34
Favicon

Possible bug in libxml2

This regards the code I posted a couple of days ago. It works fine if 
the previous sibling of curBrlNode is a text node. However, if the 
previous sibling is the root of a subtree, such as  MathML expression, 
xmlDocDump produces a document pared down to the root element and its 
<head child, as described in thet post. I'm trying to find a workaround.

Thanks,
John

--

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities
Noam Postavsky | 6 Feb 20:02
Picon

Re: reading xml subtree (getting xml fragment )

On Sat, Jan 21, 2012 at 8:16 PM, Sagaert Johan <sagaert.johan <at> skynet.be> wrote:
> So far no problem, ,how can I get the innerxml of the node I have found from
> my xmlnodeptr ?

I think xmlNodeDump
(http://xmlsoft.org/html/libxml-tree.html#xmlNodeDump) is what you
want.
Noam Postavsky | 7 Feb 06:19
Picon

Re: [XPATH] Nested function calls issue?

Mariano Guadagnini <mguadagnini <at> gmail.com> writes:

> Hey guys, 
>
> How are you doing? Well, i've been having an issue with Xpath, using stacked
> xpath function calls like the one above:
>
>
> fn:replace('abcdefghi','a',fn:replace('abcdefghi','b','B'))

You didn't give much context, but I think you are using the wrong
prefix.

~/src/xml/sandbox$ cat replace.xsl 
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings" version="1.0" extension-element-prefixes="str">
  <xsl:output omit-xml-declaration="yes" indent="no"/>
  <xsl:template match="/">
    <xsl:value-of select="str:replace('abcdefghi', 'a', str:replace('abcdefghi', 'b', 'B'))"/>
    <xsl:text>
      ====
</xsl:text>
    <xsl:value-of select="fn:replace('abcdefghi', 'a', fn:replace('abcdefghi', 'b', 'B'))"/>
  </xsl:template>
</xsl:stylesheet>
~/src/xml/sandbox$ echo '<x/>' | xsltproc replace.xsl -
xmlXPathCompOpEval: function replace bound to undefined prefix fn
xmlXPathCompOpEval: function replace bound to undefined prefix fn
xmlXPathCompiledEval: 4 objects left on the stack.
aBcdefghibcdefghi
      ====
B
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml <at> gnome.org
http://mail.gnome.org/mailman/listinfo/xml

Gmane