From d696047efe8d7356f441a52b43a531e6ca8ad3c7 Mon Sep 17 00:00:00 2001 From: Arturo Borrero Gonzalez Date: Wed, 13 Feb 2013 12:15:13 +0000 Subject: src: change XML output format to use element instead of attributes There are some problems in using attributes: * they cannot contain multiple values (child elements can) * they are not easily expandable (for future changes) * they cannot describe structures (child elements can) * they are more difficult to manipulate by program code * attribute values are not easy to test against a DTD Extracted from "XML Elements vs. Attributes" at: http://www.w3schools.com/dtd/dtd_el_vs_attr.asp For more information. Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- src/chain.c | 16 ++++++++-------- src/table.c | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/chain.c b/src/chain.c index 3c83e6d..1b1c3fe 100644 --- a/src/chain.c +++ b/src/chain.c @@ -443,14 +443,14 @@ static int nft_chain_snprintf_xml(char *buf, size_t size, struct nft_chain *c) "\n" "\t\n" - "\t\t\n" - "\t\t\n" - "\t\t\n" - "\t\t\n" - "\t\t\n" - "\t\t\n" - "\t\t\n" - "\t\t\n" + "\t\t%d\n" + "\t\t%s\n" + "\t\t
%s
\n" + "\t\t%d\n" + "\t\t%d\n" + "\t\t%d\n" + "\t\t%d\n" + "\t\t%d\n" "\t
\n" "
\n", c->name, c->handle, c->bytes, c->packets, diff --git a/src/table.c b/src/table.c index eb485b2..d2e07db 100644 --- a/src/table.c +++ b/src/table.c @@ -179,8 +179,9 @@ static int nft_table_snprintf_xml(char *buf, size_t size, struct nft_table *t) return snprintf(buf, size, "\n" "\t\n" - "\t\t\n" - "\t\t\n" + "\t\t%u\n" + "\t\t%d\n" + "\t\t%d\n" "\t\n" "
\n" , t->name, t->family, t->flags, t->table_flags); -- cgit v1.2.3