W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2003

Tidy lib: Changing an attribute value (patch included)

From: Olivier <olivier-tidy@dolphian.com>
Date: Thu, 09 Oct 2003 13:36:42 +0200
Message-ID: <3F85484A.9010107@dolphian.com>
To: html-tidy@w3.org

	hi, here is a quick patch to allow one to
change an attribute's value when using the tidylib,
it basically adds:

void tidyAttrValueSet ( TidyAttr tattr, ctmbstr* val );

example:

	[...]
        if (!strcmp ( tidyAttrName ( attribute ), "value" ))
          tidyAttrValueSet ( attribute, tmbstrdup ( "foo" ));
	[...]

	best regards,

/olivier

--- tidy/src/tidylib.c.orig	Thu Oct  9 12:58:03 2003
+++ tidy/src/tidylib.c	Thu Oct  9 13:06:08 2003
@@ -1548,6 +1548,16 @@
     aval = attval->value;
   return aval;
 }
+void       tidyAttrValueSet( TidyAttr tattr, ctmbstr* val )
+{
+  AttVal* attval = tidyAttrToImpl( tattr );
+  ctmbstr aval = NULL;
+  if ( attval ) {
+    if ( attval->value )
+      free ( attval->value );
+    attval->value = tmbstrdup ( val );
+  }
+}
 
 /* Null for pure HTML
 ctmbstr       tidyAttrNsLocal( TidyAttr tattr )
Received on Thursday, 9 October 2003 07:42:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:54 UTC