RE: [xml] Self terminating tags

I was talking about simple output from libXML.  If I add a new empty tag
using xmlNewTextChild() it is saved as <tag></tag> NOT as <tag/>.  I would
like the latter.

Can this be done?


-----Original Message-----
From: Cyberthymia [mailto:cyberthymia yahoo co uk] 
Sent: Thursday, December 12, 2002 3:11 AM
To: Brett Robichaud
Cc: xml gnome org
Subject: Re: [xml] Self terminating tags


Please ignore my last post - the variable should be set to 0, 
which it is by default.

In a blatant attempt to try and recover some dignity, is this 
XML being generated from an XSLT transform?

I've had a quick look in the source and there appears to be a 
problem where if you are doing something like 
<tag><xsl:value-of select="..."></tag> and the select doesn't 
actually return anything, then libxml is still trying to 
output an empty text element instead of an empty tag.

I'll fix this and post a patch this afternoon.


----- Original Message -----
From: "Cyberthymia" <cyberthymia yahoo co uk>
To: "Brett Robichaud" <brobichaud digimarc com>
Cc: <xml gnome org>
Sent: Thursday, December 12, 2002 10:34 AM
Subject: Re: [xml] Self terminating tags


Out of curiosity, you wouldn't happen to be talking about the XML 
output from libxml, would you?

If so, there is a global variable "xmlSaveNoEmptyTags" that 
whether empty tags are output as <tag></tag> or <tag/>

Set this variable to 1 before you call any of the functions to 
XML output.


----- Original Message -----
From: "Brett Robichaud" <brobichaud digimarc com>
To: <veillard redhat com>
Cc: <xml gnome org>
Sent: Wednesday, December 11, 2002 10:50 PM
Subject: RE: [xml] Self terminating tags

Here is a very simplified version of what I'm trying to do:

<?xml version="1.0" encoding="utf-8"?>
<mosaic width="128" height="128" loc="mosaic1.gwmr"/> </metadata>

Using libXML I can only figure out how to do this:

<?xml version="1.0" encoding="utf-8"?>
<mosaic width="128" height="128" loc="mosaic1.gwmr"></mosaic> 


-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Sent: Wednesday, December 11, 2002 2:43 PM
To: Brett Robichaud
Cc: 'xml gnome org'
Subject: Re: [xml] Self terminating tags

On Wed, Dec 11, 2002 at 02:38:52PM -0800, Brett Robichaud wrote:
Using 2.4.28 of libXML under Windows I can only seem to get
<MyTag attrib1="Hello" attrib2="goodbye"></MyTag>

You have a problem:

   paphio:~/XML -> cat tst.xml
   <MyTag attrib1="Hello" attrib2="goodbye" />
   paphio:~/XML -> xmllint tst.xml
   <?xml version="1.0"?>
   <MyTag attrib1="Hello" attrib2="goodbye"/>
   paphio:~/XML ->

Provide complete example reproducable with xmllint . See


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM 
search engine 
xml mailing list, project page
xml gnome org

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]