aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-12-16 15:50:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-12-16 15:50:30 +0200
commitf8952f732115d36a2b5f0c2a8a520f1ccd9db545 (patch)
tree4e3f8c9e3b948189e5a2e9a44eb7499db5eb8b5d
parenta44a422fd0dcb9348ab3a9262b37e0e7f783b6ee (diff)
Update to new revision of genx
Now by elements with empty content a closed immediately and attributes are no longer sorted.
-rw-r--r--NEWS7
-rw-r--r--libxsde/xsde/c/genx/char-props.c8
-rw-r--r--libxsde/xsde/c/genx/genx.c370
-rw-r--r--libxsde/xsde/c/genx/genx.h25
-rw-r--r--tests/cxx/hybrid/binary/cdr/test-000.std2
-rw-r--r--tests/cxx/hybrid/binary/custom/test-000.std2
-rw-r--r--tests/cxx/hybrid/binary/xdr/test-000.std2
-rw-r--r--tests/cxx/hybrid/built-in/test-000.std2
-rw-r--r--tests/cxx/hybrid/choice/test-000.std2
-rw-r--r--tests/cxx/hybrid/clone/test-000.std2
-rw-r--r--tests/cxx/hybrid/default/test-000.std2
-rw-r--r--tests/cxx/hybrid/polymorphism/any-type/test-000.std6
-rw-r--r--tests/cxx/hybrid/polymorphism/enumeration/test-000.std2
-rw-r--r--tests/cxx/hybrid/recursive/test-000.std2
-rw-r--r--tests/cxx/serializer/all/test-000.std2
-rw-r--r--tests/cxx/serializer/built-in/test-001.std4
-rw-r--r--tests/cxx/serializer/choice/test-000.std2
-rw-r--r--tests/cxx/serializer/list/test-000.std2
-rw-r--r--tests/cxx/serializer/recursive/test-000.std2
-rw-r--r--tests/cxx/serializer/restriction/test-000.std2
-rw-r--r--tests/cxx/serializer/sequence/test-000.std2
-rw-r--r--tests/cxx/serializer/wildcard/test-000.std2
22 files changed, 317 insertions, 135 deletions
diff --git a/NEWS b/NEWS
index 6ae571e..0e58e03 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,13 @@ Version 3.3.0
C++/Serializer
+ * Elements with empty content are now closed immediately (for example,
+ <foo x='y'/>) rather than with a separate closing tag (for example,
+ <foo x='y'></foo>).
+
+ * To improve serialization performance, attributes are not longer
+ sorted but rather written in the order that they were specified.
+
* Support for the fractionDigits facet for the decimal data type.
* New functions, format() and precision(), allow changing of the
diff --git a/libxsde/xsde/c/genx/char-props.c b/libxsde/xsde/c/genx/char-props.c
index c9db225..1b9a5aa 100644
--- a/libxsde/xsde/c/genx/char-props.c
+++ b/libxsde/xsde/c/genx/char-props.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2014 Code Synthesis Tools CC.
+ * Copyright (c) 2007-2013 Code Synthesis Tools CC.
* Copyright (c) 2004 by Tim Bray and Sun Microsystems.
*
* For copying permission, see the accompanying COPYING file.
@@ -20,16 +20,16 @@ static void charProp(char * p, int c, int prop)
p[c] |= prop;
}
-static void rangeProp(char * p, int start, int end, int prop)
+static void rangeProp(char * p, size_t start, size_t end, int prop)
{
- int i;
+ size_t i;
for (i = start; i <= end; i++)
p[i] |= prop;
}
void genxSetCharProps(char * p)
{
- int i;
+ size_t i;
for (i = 0; i < GENX_CHAR_TABLE_SIZE; i++)
p[i] = 0;
diff --git a/libxsde/xsde/c/genx/genx.c b/libxsde/xsde/c/genx/genx.c
index 39cd8ae..c4c73a8 100644
--- a/libxsde/xsde/c/genx/genx.c
+++ b/libxsde/xsde/c/genx/genx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2014 Code Synthesis Tools CC.
+ * Copyright (c) 2007-2013 Code Synthesis Tools CC.
* Copyright (c) 2004 by Tim Bray and Sun Microsystems.
*
* For copying permission, see the accompanying COPYING file.
@@ -47,8 +47,8 @@ typedef enum
typedef struct
{
genxWriter writer;
- int count;
- int space;
+ size_t count;
+ size_t space;
void * * pointers;
} plist;
@@ -58,8 +58,8 @@ typedef struct
typedef struct
{
utf8 buf;
- int used;
- int space;
+ size_t used;
+ size_t space;
} collector;
/*******************************
@@ -79,7 +79,7 @@ struct genxNamespace_rec
{
genxWriter writer;
utf8 name;
- int declCount;
+ size_t declCount;
Boolean baroque;
genxAttribute declaration;
genxAttribute defaultDecl;
@@ -107,6 +107,7 @@ struct genxAttribute_rec
collector value;
int provided; /* provided for current element? */
attrType atype;
+ genxAttribute next; /* Attribute order chain if not canonical. */
};
/*******************************
@@ -130,7 +131,7 @@ struct genxWriter_rec
plist attributes;
plist prefixes;
plist stack;
- struct genxAttribute_rec arec;
+ struct genxAttribute_rec arec; /* Dummy attribute used for lookup. */
char * etext[100];
genxAlloc alloc;
genxDealloc dealloc;
@@ -139,6 +140,13 @@ struct genxWriter_rec
int ppIndent;
int ppDepth;
Boolean ppSimple;
+
+ /* Canonicalization. */
+ Boolean canonical;
+
+ /* Attrbute order when not canonical. */
+ genxAttribute firstAttribute;
+ genxAttribute lastAttribute;
};
/*******************************
@@ -159,7 +167,7 @@ void genxSetCharProps(char * p);
/*******************************
* private memory utilities
*/
-static void * allocate(genxWriter w, int bytes)
+static void * allocate(genxWriter w, size_t bytes)
{
if (w->alloc)
return (void *) (*w->alloc)(w->userData, bytes);
@@ -202,7 +210,7 @@ static genxStatus initCollector(genxWriter w, collector * c)
return GENX_SUCCESS;
}
-static genxStatus growCollector(genxWriter w, collector * c, int size)
+static genxStatus growCollector(genxWriter w, collector * c, size_t size)
{
utf8 newSpace;
@@ -228,7 +236,7 @@ static void endCollect(collector * c)
static genxStatus collectString(genxWriter w, collector * c, constUtf8 string)
{
- int sl = strlen((const char *) string);
+ size_t sl = strlen((const char *) string);
if (sl >= c->space)
if ((w->status = growCollector(w, c, sl)) != GENX_SUCCESS)
@@ -261,7 +269,7 @@ static genxStatus initPlist(genxWriter w, plist * pl)
static Boolean checkExpand(plist * pl)
{
void * * newlist;
- int i;
+ size_t i;
if (pl->count < pl->space)
return True;
@@ -293,9 +301,9 @@ static genxStatus listAppend(plist * pl, void * pointer)
/*
* insert in place, shuffling up
*/
-static genxStatus listInsert(plist * pl, void * pointer, int at)
+static genxStatus listInsert(plist * pl, void * pointer, size_t at)
{
- int i;
+ size_t i;
if (!checkExpand(pl))
return GENX_ALLOC_FAILED;
@@ -314,7 +322,7 @@ static genxStatus listInsert(plist * pl, void * pointer, int at)
static genxNamespace findNamespace(plist * pl, constUtf8 uri)
{
- int i;
+ size_t i;
genxNamespace * nn = (genxNamespace *) pl->pointers;
for (i = 0; i < pl->count; i++)
@@ -326,7 +334,7 @@ static genxNamespace findNamespace(plist * pl, constUtf8 uri)
static genxElement findElement(plist * pl, constUtf8 xmlns, constUtf8 type)
{
- int i;
+ size_t i;
genxElement * ee = (genxElement *) pl->pointers;
for (i = 0; i < pl->count; i++)
@@ -368,7 +376,8 @@ static utf8 storePrefix(genxWriter w, constUtf8 prefix, Boolean force)
prefix = buf;
}
- high = w->prefixes.count; low = -1;
+ high = (int) w->prefixes.count;
+ low = -1;
while (high - low > 1)
{
int probe = (high + low) / 2;
@@ -395,7 +404,7 @@ static utf8 storePrefix(genxWriter w, constUtf8 prefix, Boolean force)
return NULL;
}
- w->status = listInsert(&w->prefixes, (void *) prefix, high);
+ w->status = listInsert(&w->prefixes, (void *) prefix, (size_t) high);
if (w->status != GENX_SUCCESS)
return NULL;
@@ -593,29 +602,28 @@ genxWriter genxNew(genxAlloc alloc, genxDealloc dealloc, void * userData)
genxSetCharProps(w->xmlChars);
- w->etext[GENX_SUCCESS] = "Success";
- w->etext[GENX_BAD_UTF8] = "Bad UTF8";
- w->etext[GENX_NON_XML_CHARACTER] = "Non XML Character";
- w->etext[GENX_BAD_NAME] = "Bad NAME";
- w->etext[GENX_ALLOC_FAILED] = "Memory allocation failed";
- w->etext[GENX_BAD_NAMESPACE_NAME] = "Bad namespace name";
- w->etext[GENX_INTERNAL_ERROR] = "Internal error";
- w->etext[GENX_DUPLICATE_PREFIX] = "Duplicate prefix";
- w->etext[GENX_SEQUENCE_ERROR] = "Call out of sequence";
- w->etext[GENX_NO_START_TAG] = "No Start-tag for EndElement call";
- w->etext[GENX_IO_ERROR] = "I/O error";
- w->etext[GENX_MISSING_VALUE] = "Missing attribute value";
- w->etext[GENX_MALFORMED_COMMENT] = "Malformed comment body";
+ w->etext[GENX_SUCCESS] = "success";
+ w->etext[GENX_BAD_UTF8] = "invalid UTF-8";
+ w->etext[GENX_NON_XML_CHARACTER] = "non-XML character";
+ w->etext[GENX_BAD_NAME] = "invalid name";
+ w->etext[GENX_ALLOC_FAILED] = "memory allocation failed";
+ w->etext[GENX_BAD_NAMESPACE_NAME] = "invalid namespace name";
+ w->etext[GENX_INTERNAL_ERROR] = "internal error";
+ w->etext[GENX_DUPLICATE_PREFIX] = "duplicate prefix";
+ w->etext[GENX_SEQUENCE_ERROR] = "call out of sequence";
+ w->etext[GENX_NO_START_TAG] = "no start tag for end element call";
+ w->etext[GENX_IO_ERROR] = "io error";
+ w->etext[GENX_MISSING_VALUE] = "missing attribute value";
+ w->etext[GENX_MALFORMED_COMMENT] = "malformed comment body";
w->etext[GENX_MALFORMED_PI] = "?> in PI";
- w->etext[GENX_XML_PI_TARGET] = "Target of PI matches [xX][mM][lL]";
- w->etext[GENX_DUPLICATE_ATTRIBUTE] =
- "Same attribute specified more than once";
+ w->etext[GENX_XML_PI_TARGET] = "target of PI matches [xX][mM][lL]";
+ w->etext[GENX_DUPLICATE_ATTRIBUTE] = "duplicate attribute";
w->etext[GENX_ATTRIBUTE_IN_DEFAULT_NAMESPACE] =
- "Attribute cannot be in default namespace";
+ "attribute is default namespace";
w->etext[GENX_DUPLICATE_NAMESPACE] =
- "Declared namespace twice with different prefixes on one element.";
+ "namespace declared twice with different prefixes";
w->etext[GENX_BAD_DEFAULT_DECLARATION] =
- "Declared a default namespace on an element which is in no namespace";
+ "default namespace declared on an element which is not in a namespace";
/* the xml: namespace is pre-wired */
xml = genxDeclareNamespace(w, (utf8) "http://www.w3.org/XML/1998/namespace",
@@ -626,13 +634,16 @@ genxWriter genxNew(genxAlloc alloc, genxDealloc dealloc, void * userData)
xml->declaration = xml->defaultDecl;
w->ppIndent = 0; /* Pretty-printing is disabled by default. */
+ w->canonical = False; /* No canonicalization by default. */
+ w->firstAttribute = NULL;
+ w->lastAttribute = NULL;
return w;
}
genxStatus genxReset (genxWriter w)
{
- int i;
+ size_t i;
/* Clean up the stack. */
w->stack.count = 0;
@@ -647,6 +658,23 @@ genxStatus genxReset (genxWriter w)
((genxNamespace) w->namespaces.pointers[i])->baroque = False;
}
+ /* Clear provided attributes. */
+ for (i = 0; i < w->attributes.count; i++)
+ ((genxAttribute) w->attributes.pointers[i])->provided = False;
+
+ /* Clear attribute list. */
+ if (!w->canonical)
+ {
+ while (w->firstAttribute != NULL)
+ {
+ genxAttribute t = w->firstAttribute->next;
+ w->firstAttribute->next = NULL;
+ w->firstAttribute = t;
+ }
+
+ w->lastAttribute = NULL;
+ }
+
w->status = GENX_SUCCESS;
w->sequence = SEQUENCE_NO_DOC;
@@ -685,6 +713,24 @@ int genxGetPrettyPrint(genxWriter w)
}
/*
+ * get/set canonicalization.
+ */
+genxStatus genxSetCanonical(genxWriter w, int flag)
+{
+ if (w->sequence == SEQUENCE_NO_DOC)
+ w->canonical = flag;
+ else
+ w->status = GENX_SEQUENCE_ERROR;
+
+ return w->status;
+}
+
+int genxGetCanonical(genxWriter w)
+{
+ return w->canonical;
+}
+
+/*
* get/set allocator
*/
void genxSetAlloc(genxWriter w, genxAlloc alloc)
@@ -712,7 +758,7 @@ genxDealloc genxGetDealloc(genxWriter w)
*/
void genxDispose(genxWriter w)
{
- int i;
+ size_t i;
genxNamespace * nn = (genxNamespace *) w->namespaces.pointers;
genxElement * ee = (genxElement *) w->elements.pointers;
genxAttribute * aa = (genxAttribute *) w->attributes.pointers;
@@ -1084,7 +1130,8 @@ static genxAttribute declareAttribute(genxWriter w, genxNamespace ns,
}
/* attribute list has to be kept sorted per c14n rules */
- high = w->attributes.count; low = -1;
+ high = (int) w->attributes.count;
+ low = -1;
while (high - low > 1)
{
int probe = (high + low) / 2;
@@ -1110,6 +1157,7 @@ static genxAttribute declareAttribute(genxWriter w, genxNamespace ns,
a->ns = ns;
a->provided = False;
a->atype = w->arec.atype;
+ a->next = NULL;
if ((a->name = copy(w, name)) == NULL)
{
@@ -1124,7 +1172,7 @@ static genxAttribute declareAttribute(genxWriter w, genxNamespace ns,
if ((w->status = collectString(w, &a->value, valuestr)) != GENX_SUCCESS)
goto busted;
- w->status = listInsert(&w->attributes, a, high);
+ w->status = listInsert(&w->attributes, a, (size_t) high);
if (w->status != GENX_SUCCESS)
goto busted;
@@ -1171,7 +1219,7 @@ static genxStatus sendxBounded(genxWriter w, constUtf8 start, constUtf8 end)
return GENX_IO_ERROR;
}
-#define SendCheck(w,s) if ((w->status=sendx(w,(utf8)s))!=GENX_SUCCESS) return w->status;
+#define SendCheck(w,s) if ((w->status=sendx(w,(constUtf8)s))!=GENX_SUCCESS) return w->status
/*******************************
* XML writing routines. The semantics of the externally-facing ones are
@@ -1212,6 +1260,32 @@ static genxStatus writeIndentation(genxWriter w)
}
/*
+ * Output attribute.
+ */
+static genxStatus writeAttribute(genxAttribute a)
+{
+ genxWriter w = a->writer;
+
+ if (a->ns && a->ns->baroque && a->ns->declaration == w->xmlnsEquals)
+ return w->status = GENX_ATTRIBUTE_IN_DEFAULT_NAMESPACE;
+
+ SendCheck(w, " ");
+
+ if (a->ns)
+ {
+ SendCheck(w, a->ns->declaration->name + STRLEN_XMLNS_COLON);
+ SendCheck(w, ":");
+ }
+
+ SendCheck(w, a->name);
+ SendCheck(w, "=\"");
+ SendCheck(w, a->value.buf);
+ SendCheck(w, "\"");
+
+ return w->status;
+}
+
+/*
* Write out the attributes we've been gathering up for an element. We save
* them until we've gathered them all so they can be writen in canonical
* order.
@@ -1220,9 +1294,9 @@ static genxStatus writeIndentation(genxWriter w)
* we build it, then as each attribute is added, we fill in its value and
* mark the fact that it's been added, in the "provided" field.
*/
-static genxStatus writeStartTag(genxWriter w)
+static genxStatus writeStartTag(genxWriter w, Boolean close)
{
- int i;
+ size_t i;
genxAttribute * aa = (genxAttribute *) w->attributes.pointers;
genxElement e = w->nowStarting;
@@ -1242,8 +1316,11 @@ static genxStatus writeStartTag(genxWriter w)
if (writeIndentation (w) != GENX_SUCCESS)
return w->status;
- w->ppDepth++;
- w->ppSimple = True;
+ if (!close)
+ {
+ w->ppDepth++;
+ w->ppSimple = True;
+ }
}
SendCheck(w, "<");
@@ -1254,27 +1331,42 @@ static genxStatus writeStartTag(genxWriter w)
}
SendCheck(w, e->type);
- for (i = 0; i < w->attributes.count; i++)
+ /* If we are canonicalizing, then write sorted attributes. Otherwise
+ write them in the order specified. */
+ if (w->canonical)
{
- if (aa[i]->provided)
+ for (i = 0; i < w->attributes.count; i++)
{
- if (aa[i]->ns && aa[i]->ns->baroque &&
- aa[i]->ns->declaration == w->xmlnsEquals)
- return w->status = GENX_ATTRIBUTE_IN_DEFAULT_NAMESPACE;
-
- SendCheck(w, " ");
-
- if (aa[i]->ns)
+ if (aa[i]->provided)
{
- SendCheck(w, aa[i]->ns->declaration->name + STRLEN_XMLNS_COLON)
- SendCheck(w, ":");
+ if (writeAttribute (aa[i]) != GENX_SUCCESS)
+ return w->status;
+
+ aa[i]->provided = False;
}
- SendCheck(w, aa[i]->name);
- SendCheck(w, "=\"");
- SendCheck(w, aa[i]->value.buf);
- SendCheck(w, "\"");
}
}
+ else
+ {
+ /* Keep the chain consistent even if we bail out mid way because of
+ an error. This way we will still be able to clear it in reset().*/
+ while (w->firstAttribute != NULL)
+ {
+ genxAttribute t = w->firstAttribute->next;
+
+ if (writeAttribute (w->firstAttribute) != GENX_SUCCESS)
+ return w->status;
+
+ w->firstAttribute->provided = False;
+ w->firstAttribute->next = NULL;
+ w->firstAttribute = t;
+ }
+
+ w->lastAttribute = NULL;
+ }
+
+ if (close)
+ SendCheck(w, "/");
SendCheck(w, ">");
return GENX_SUCCESS;
}
@@ -1288,7 +1380,7 @@ static genxStatus unsetDefaultNamespace(genxWriter w)
Boolean found = False;
/* don't put it in if not needed */
- i = w->stack.count - 1;
+ i = (int) (w->stack.count) - 1;
while (found == False && i > 0)
{
while (w->stack.pointers[i] != NULL)
@@ -1346,7 +1438,6 @@ genxStatus genxUnsetDefaultNamespace(genxWriter w)
genxStatus genxStartElement(genxElement e)
{
genxWriter w = e->writer;
- int i;
switch (w->sequence)
{
@@ -1356,7 +1447,7 @@ genxStatus genxStartElement(genxElement e)
return w->status = GENX_SEQUENCE_ERROR;
case SEQUENCE_START_TAG:
case SEQUENCE_ATTRIBUTES:
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, False)) != GENX_SUCCESS)
return w->status;
break;
case SEQUENCE_PRE_DOC:
@@ -1366,10 +1457,6 @@ genxStatus genxStartElement(genxElement e)
w->sequence = SEQUENCE_START_TAG;
- /* clear provided attributes */
- for (i = 0; i < w->attributes.count; i++)
- ((genxAttribute) w->attributes.pointers[i])->provided = 0;
-
/*
* push the stack. We push a NULL after a pointer to this element
* because the stack will also contain pointers to the namespace
@@ -1438,7 +1525,7 @@ static genxStatus addNamespace(genxNamespace ns, constUtf8 prefix)
* case it's a no-op; or, if there's another declaration for this
* prefix on another namespace, in which case we have to over-ride
*/
- i = w->stack.count - 1;
+ i = (int) (w->stack.count) - 1;
while (i > 0)
{
while (w->stack.pointers[i] != NULL)
@@ -1474,7 +1561,7 @@ static genxStatus addNamespace(genxNamespace ns, constUtf8 prefix)
* If this namespace is already declared on
* this element (with different prefix/decl) which is an error.
*/
- i = w->stack.count - 1;
+ i = (int) (w->stack.count) - 1;
while (w->stack.pointers[i] != NULL)
{
genxNamespace otherNs;
@@ -1596,7 +1683,17 @@ static genxStatus addAttribute(genxAttribute a, constUtf8 valuestr)
if (valuestr && a->provided)
return w->status = GENX_DUPLICATE_ATTRIBUTE;
- a->provided = 1;
+
+ a->provided = True;
+
+ /* Add the attribute to the ordered list if not canonical. */
+ if (!w->canonical)
+ {
+ if (w->lastAttribute != NULL)
+ w->lastAttribute = w->lastAttribute->next = a;
+ else
+ w->lastAttribute = w->firstAttribute = a;
+ }
return GENX_SUCCESS;
}
@@ -1653,15 +1750,24 @@ genxStatus genxEndAttribute(genxWriter w)
if (a->provided)
return w->status = GENX_DUPLICATE_ATTRIBUTE;
- a->provided = 1;
+ a->provided = True;
+
+ /* Add the attribute to the ordered list if not canonical. */
+ if (!w->canonical)
+ {
+ if (w->lastAttribute != NULL)
+ w->lastAttribute = w->lastAttribute->next = a;
+ else
+ w->lastAttribute = w->firstAttribute = a;
+ }
return GENX_SUCCESS;
}
genxStatus genxEndElement(genxWriter w)
{
- genxElement e;
int i;
+ Boolean close = True;
switch (w->sequence)
{
@@ -1672,42 +1778,54 @@ genxStatus genxEndElement(genxWriter w)
return w->status = GENX_SEQUENCE_ERROR;
case SEQUENCE_START_TAG:
case SEQUENCE_ATTRIBUTES:
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, !w->canonical)) != GENX_SUCCESS)
return w->status;
+ close = w->canonical;
break;
case SEQUENCE_CONTENT:
break;
}
/*
- * first peek into the stack to find the right namespace declaration
- * (if any) so we can properly prefix the end-tag. Have to do this
- * before unwinding the stack because that might reset some xmlns
- * prefixes to the context in the parent element
+ * Output the closing tag.
*/
- for (i = w->stack.count - 1; w->stack.pointers[i] != NULL; i -= 2)
- ;
- e = (genxElement) w->stack.pointers[--i];
-
- if (w->ppIndent)
+ if (close)
{
- w->ppDepth--;
+ genxElement e;
- if (!w->ppSimple)
- if (writeIndentation (w) != GENX_SUCCESS)
- return w->status;
+ /*
+ * first peek into the stack to find the right namespace declaration
+ * (if any) so we can properly prefix the end-tag. Have to do this
+ * before unwinding the stack because that might reset some xmlns
+ * prefixes to the context in the parent element
+ */
+ for (i = (int) (w->stack.count) - 1;
+ w->stack.pointers[i] != NULL;
+ i -= 2)
+ ;
+ e = (genxElement) w->stack.pointers[--i];
- w->ppSimple = False;
- }
+ if (w->ppIndent)
+ {
+ w->ppDepth--;
- SendCheck(w, "</");
- if (e->ns && e->ns->declaration != w->xmlnsEquals)
- {
- SendCheck(w, e->ns->declaration->name + STRLEN_XMLNS_COLON);
- SendCheck(w, ":");
+ if (!w->ppSimple)
+ if (writeIndentation (w) != GENX_SUCCESS)
+ return w->status;
+ }
+
+ SendCheck(w, "</");
+ if (e->ns && e->ns->declaration != w->xmlnsEquals)
+ {
+ SendCheck(w, e->ns->declaration->name + STRLEN_XMLNS_COLON);
+ SendCheck(w, ":");
+ }
+ SendCheck(w, e->type);
+ SendCheck(w, ">");
}
- SendCheck(w, e->type);
- SendCheck(w, ">");
+
+ if (w->ppIndent)
+ w->ppSimple = False;
/*
* pop zero or more namespace declarations, then a null, then the
@@ -1729,7 +1847,7 @@ genxStatus genxEndElement(genxWriter w)
*/
if (ns->baroque)
{
- i = w->stack.count;
+ i = (int) w->stack.count;
while (i > 0)
{
while (w->stack.pointers[i] != NULL)
@@ -1756,9 +1874,9 @@ genxStatus genxEndElement(genxWriter w)
}
/* pop the NULL */
- --w->stack.count;
- if (w->stack.count < 0)
+ if (w->stack.count == 0)
return w->status = GENX_NO_START_TAG;
+ --w->stack.count;
if (w->stack.count == 0)
w->sequence = SEQUENCE_POST_DOC;
@@ -1828,7 +1946,7 @@ genxStatus genxAddText(genxWriter w, constUtf8 start)
if (w->sequence == SEQUENCE_START_TAG ||
w->sequence == SEQUENCE_ATTRIBUTES)
{
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, False)) != GENX_SUCCESS)
return w->status;
w->sequence = SEQUENCE_CONTENT;
}
@@ -1861,7 +1979,7 @@ genxStatus genxAddBoundedText(genxWriter w, constUtf8 start, constUtf8 end)
if (w->sequence == SEQUENCE_START_TAG ||
w->sequence == SEQUENCE_ATTRIBUTES)
{
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, False)) != GENX_SUCCESS)
return w->status;
w->sequence = SEQUENCE_CONTENT;
}
@@ -1886,7 +2004,7 @@ genxStatus genxAddBoundedText(genxWriter w, constUtf8 start, constUtf8 end)
return w->status = GENX_SEQUENCE_ERROR;
}
-genxStatus genxAddCountedText(genxWriter w, constUtf8 start, int byteCount)
+genxStatus genxAddCountedText(genxWriter w, constUtf8 start, size_t byteCount)
{
utf8 end = (utf8) (start + byteCount);
@@ -1901,7 +2019,7 @@ genxStatus genxAddCharacter(genxWriter w, int c)
if (w->sequence == SEQUENCE_START_TAG ||
w->sequence == SEQUENCE_ATTRIBUTES)
{
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, False)) != GENX_SUCCESS)
return w->status;
w->sequence = SEQUENCE_CONTENT;
}
@@ -1998,6 +2116,9 @@ genxStatus genxEndDocument(genxWriter w)
if (w->sequence != SEQUENCE_POST_DOC)
return w->status = GENX_SEQUENCE_ERROR;
+ /* Write a newline after the closing tag. */
+ /* Disabled for xsde SendCheck (w, "\n");*/
+
if ((w->status = (*w->sender->flush)(w->userData)) != GENX_SUCCESS)
return w->status;
@@ -2005,9 +2126,46 @@ genxStatus genxEndDocument(genxWriter w)
return GENX_SUCCESS;
}
+genxStatus genxXmlDeclaration(genxWriter w,
+ constUtf8 ver,
+ constUtf8 enc,
+ constUtf8 stl)
+{
+ if (w->sequence != SEQUENCE_PRE_DOC)
+ return w->status = GENX_SEQUENCE_ERROR;
+
+ if ((w->status = genxCheckText(w, ver)) != GENX_SUCCESS)
+ return w->status;
+
+ if (enc != NULL && (w->status = genxCheckText(w, enc)) != GENX_SUCCESS)
+ return w->status;
+
+ if (stl != NULL && (w->status = genxCheckText(w, stl)) != GENX_SUCCESS)
+ return w->status;
+
+ SendCheck (w, "<?xml version=\"");
+ SendCheck (w, ver);
+
+ if (enc != NULL)
+ {
+ SendCheck (w, "\" encoding=\"");
+ SendCheck (w, enc);
+ }
+
+ if (stl != NULL)
+ {
+ SendCheck (w, "\" standalone=\"");
+ SendCheck (w, stl);
+ }
+
+ SendCheck (w, "\" ?>\n");
+
+ return GENX_SUCCESS;
+}
+
genxStatus genxComment(genxWriter w, constUtf8 text)
{
- int i;
+ size_t i;
if (w->sequence == SEQUENCE_NO_DOC ||
w->sequence == SEQUENCE_START_ATTR)
@@ -2026,7 +2184,7 @@ genxStatus genxComment(genxWriter w, constUtf8 text)
if (w->sequence == SEQUENCE_START_TAG ||
w->sequence == SEQUENCE_ATTRIBUTES)
{
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, False)) != GENX_SUCCESS)
return w->status;
w->sequence = SEQUENCE_CONTENT;
}
@@ -2051,7 +2209,7 @@ genxStatus genxComment(genxWriter w, constUtf8 text)
genxStatus genxPI(genxWriter w, constUtf8 target, constUtf8 text)
{
- int i;
+ size_t i;
if (w->sequence == SEQUENCE_NO_DOC ||
w->sequence == SEQUENCE_START_ATTR)
@@ -2079,7 +2237,7 @@ genxStatus genxPI(genxWriter w, constUtf8 target, constUtf8 text)
if (w->sequence == SEQUENCE_START_TAG ||
w->sequence == SEQUENCE_ATTRIBUTES)
{
- if ((w->status = writeStartTag(w)) != GENX_SUCCESS)
+ if ((w->status = writeStartTag(w, False)) != GENX_SUCCESS)
return w->status;
w->sequence = SEQUENCE_CONTENT;
}
diff --git a/libxsde/xsde/c/genx/genx.h b/libxsde/xsde/c/genx/genx.h
index 2b04806..bdaeee1 100644
--- a/libxsde/xsde/c/genx/genx.h
+++ b/libxsde/xsde/c/genx/genx.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (c) 2007-2014 Code Synthesis Tools CC.
+ * Copyright (c) 2007-2013 Code Synthesis Tools CC.
* Copyright (c) 2004 by Tim Bray and Sun Microsystems.
*
* For copying permission, see the accompanying COPYING file.
@@ -12,6 +12,8 @@
#ifndef GENX_H
#define GENX_H
+#include <stddef.h> /* size_t */
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -71,7 +73,7 @@ typedef struct genxNamespace_rec * genxNamespace;
typedef struct genxElement_rec * genxElement;
typedef struct genxAttribute_rec * genxAttribute;
-typedef void * (*genxAlloc) (void * userData, int bytes);
+typedef void * (*genxAlloc) (void * userData, size_t bytes);
typedef void (*genxDealloc) (void * userData, void* data);
/*
@@ -116,6 +118,13 @@ genxStatus genxSetPrettyPrint(genxWriter w, int indentation);
int genxGetPrettyPrint(genxWriter w);
/*
+ * Set/get canonicalization. If true, then output explicit closing
+ * tags and sort attributes. Default is false.
+ */
+genxStatus genxSetCanonical(genxWriter w, int flag);
+int genxGetCanonical(genxWriter w);
+
+/*
* User-provided memory allocator, if desired. For example, if you were
* in an Apache module, you could arrange for genx to use ap_palloc by
* making the pool accessible via the userData call.
@@ -188,6 +197,14 @@ genxStatus genxStartDocSender(genxWriter w, genxSender * sender);
genxStatus genxEndDocument(genxWriter w);
/*
+ * Write XML declaration. If encoding or standalone are NULL, then those
+ * attributes are omitted.
+ */
+genxStatus genxXmlDeclaration(genxWriter w,
+ constUtf8 version,
+ constUtf8 encoding,
+ constUtf8 standalone);
+/*
* Write a comment
*/
genxStatus genxComment(genxWriter w, constUtf8 text);
@@ -260,10 +277,10 @@ genxStatus genxEndElement(genxWriter w);
/*
* Write some text
* You can't write any text outside the root element, except with
- * genxComment and genxPI
+ * genxComment and genxPI.
*/
genxStatus genxAddText(genxWriter w, constUtf8 start);
-genxStatus genxAddCountedText(genxWriter w, constUtf8 start, int byteCount);
+genxStatus genxAddCountedText(genxWriter w, constUtf8 start, size_t byteCount);
genxStatus genxAddBoundedText(genxWriter w, constUtf8 start, constUtf8 end);
/*
diff --git a/tests/cxx/hybrid/binary/cdr/test-000.std b/tests/cxx/hybrid/binary/cdr/test-000.std
index f36f755..420a5b5 100644
--- a/tests/cxx/hybrid/binary/cdr/test-000.std
+++ b/tests/cxx/hybrid/binary/cdr/test-000.std
@@ -1,2 +1,2 @@
-<t:root xmlns:t="test"><list>1 2 3</list><union>abc</union><enumeration>left</enumeration><complex df1="123" df2="456" dv1="aaa bbb ccc" dv2="mmm nnn" ff1="123" ff2="123" fv1="aaa bbb ccc" fv2="aaa bbb ccc" x="1"><a>aaa</a></complex><complex df1="123" df2="123" dv1="aaa bbb ccc" dv2="aaa bbb ccc" ff1="123" ff2="123" fv1="aaa bbb ccc" fv2="aaa bbb ccc" x="1" y="2"><a>aaa</a><b>bbb</b><c>c</c><c>cc</c><c>ccc</c></complex><choice></choice><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><byte>65</byte><unsigned_byte>66</unsigned_byte><short>-222</short><unsigned_short>57005</unsigned_short><int>-57005</int><unsigned_int>3735928559</unsigned_int><long>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><string>string</string><normalized_string>normalized string</normalized_string><token>one two three</token><name>name</name><name_token>name-token</name_token><name_tokens>name tokens</name_tokens><ncname>ncname</ncname><language>en-us</language><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ==
+<t:root xmlns:t="test"><list>1 2 3</list><union>abc</union><enumeration>left</enumeration><complex x="1" df1="123" df2="456" ff1="123" ff2="123" dv1="aaa bbb ccc" dv2="mmm nnn" fv1="aaa bbb ccc" fv2="aaa bbb ccc"><a>aaa</a></complex><complex x="1" y="2" df1="123" df2="123" ff1="123" ff2="123" dv1="aaa bbb ccc" dv2="aaa bbb ccc" fv1="aaa bbb ccc" fv2="aaa bbb ccc"><a>aaa</a><b>bbb</b><c>c</c><c>cc</c><c>ccc</c></complex><choice/><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><byte>65</byte><unsigned_byte>66</unsigned_byte><short>-222</short><unsigned_short>57005</unsigned_short><int>-57005</int><unsigned_int>3735928559</unsigned_int><long>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><string>string</string><normalized_string>normalized string</normalized_string><token>one two three</token><name>name</name><name_token>name-token</name_token><name_tokens>name tokens</name_tokens><ncname>ncname</ncname><language>en-us</language><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ==
</base64_binary><hex_binary>6865782052696E617279</hex_binary><date>2001-10-26+02:00</date><date_time>2001-10-26T21:32:52+02:00</date_time><duration>P1Y2M3DT5H20M30S</duration><day>---01+02:00</day><month>--11+02:00</month><month_day>--02-11+02:00</month_day><year>2001+02:00</year><year_month>2001-11+02:00</year_month><time>21:32:52+02:00</time></t:root> \ No newline at end of file
diff --git a/tests/cxx/hybrid/binary/custom/test-000.std b/tests/cxx/hybrid/binary/custom/test-000.std
index f36f755..420a5b5 100644
--- a/tests/cxx/hybrid/binary/custom/test-000.std
+++ b/tests/cxx/hybrid/binary/custom/test-000.std
@@ -1,2 +1,2 @@
-<t:root xmlns:t="test"><list>1 2 3</list><union>abc</union><enumeration>left</enumeration><complex df1="123" df2="456" dv1="aaa bbb ccc" dv2="mmm nnn" ff1="123" ff2="123" fv1="aaa bbb ccc" fv2="aaa bbb ccc" x="1"><a>aaa</a></complex><complex df1="123" df2="123" dv1="aaa bbb ccc" dv2="aaa bbb ccc" ff1="123" ff2="123" fv1="aaa bbb ccc" fv2="aaa bbb ccc" x="1" y="2"><a>aaa</a><b>bbb</b><c>c</c><c>cc</c><c>ccc</c></complex><choice></choice><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><byte>65</byte><unsigned_byte>66</unsigned_byte><short>-222</short><unsigned_short>57005</unsigned_short><int>-57005</int><unsigned_int>3735928559</unsigned_int><long>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><string>string</string><normalized_string>normalized string</normalized_string><token>one two three</token><name>name</name><name_token>name-token</name_token><name_tokens>name tokens</name_tokens><ncname>ncname</ncname><language>en-us</language><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ==
+<t:root xmlns:t="test"><list>1 2 3</list><union>abc</union><enumeration>left</enumeration><complex x="1" df1="123" df2="456" ff1="123" ff2="123" dv1="aaa bbb ccc" dv2="mmm nnn" fv1="aaa bbb ccc" fv2="aaa bbb ccc"><a>aaa</a></complex><complex x="1" y="2" df1="123" df2="123" ff1="123" ff2="123" dv1="aaa bbb ccc" dv2="aaa bbb ccc" fv1="aaa bbb ccc" fv2="aaa bbb ccc"><a>aaa</a><b>bbb</b><c>c</c><c>cc</c><c>ccc</c></complex><choice/><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><byte>65</byte><unsigned_byte>66</unsigned_byte><short>-222</short><unsigned_short>57005</unsigned_short><int>-57005</int><unsigned_int>3735928559</unsigned_int><long>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><string>string</string><normalized_string>normalized string</normalized_string><token>one two three</token><name>name</name><name_token>name-token</name_token><name_tokens>name tokens</name_tokens><ncname>ncname</ncname><language>en-us</language><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ==
</base64_binary><hex_binary>6865782052696E617279</hex_binary><date>2001-10-26+02:00</date><date_time>2001-10-26T21:32:52+02:00</date_time><duration>P1Y2M3DT5H20M30S</duration><day>---01+02:00</day><month>--11+02:00</month><month_day>--02-11+02:00</month_day><year>2001+02:00</year><year_month>2001-11+02:00</year_month><time>21:32:52+02:00</time></t:root> \ No newline at end of file
diff --git a/tests/cxx/hybrid/binary/xdr/test-000.std b/tests/cxx/hybrid/binary/xdr/test-000.std
index f36f755..420a5b5 100644
--- a/tests/cxx/hybrid/binary/xdr/test-000.std
+++ b/tests/cxx/hybrid/binary/xdr/test-000.std
@@ -1,2 +1,2 @@
-<t:root xmlns:t="test"><list>1 2 3</list><union>abc</union><enumeration>left</enumeration><complex df1="123" df2="456" dv1="aaa bbb ccc" dv2="mmm nnn" ff1="123" ff2="123" fv1="aaa bbb ccc" fv2="aaa bbb ccc" x="1"><a>aaa</a></complex><complex df1="123" df2="123" dv1="aaa bbb ccc" dv2="aaa bbb ccc" ff1="123" ff2="123" fv1="aaa bbb ccc" fv2="aaa bbb ccc" x="1" y="2"><a>aaa</a><b>bbb</b><c>c</c><c>cc</c><c>ccc</c></complex><choice></choice><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><byte>65</byte><unsigned_byte>66</unsigned_byte><short>-222</short><unsigned_short>57005</unsigned_short><int>-57005</int><unsigned_int>3735928559</unsigned_int><long>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><string>string</string><normalized_string>normalized string</normalized_string><token>one two three</token><name>name</name><name_token>name-token</name_token><name_tokens>name tokens</name_tokens><ncname>ncname</ncname><language>en-us</language><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ==
+<t:root xmlns:t="test"><list>1 2 3</list><union>abc</union><enumeration>left</enumeration><complex x="1" df1="123" df2="456" ff1="123" ff2="123" dv1="aaa bbb ccc" dv2="mmm nnn" fv1="aaa bbb ccc" fv2="aaa bbb ccc"><a>aaa</a></complex><complex x="1" y="2" df1="123" df2="123" ff1="123" ff2="123" dv1="aaa bbb ccc" dv2="aaa bbb ccc" fv1="aaa bbb ccc" fv2="aaa bbb ccc"><a>aaa</a><b>bbb</b><c>c</c><c>cc</c><c>ccc</c></complex><choice/><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><byte>65</byte><unsigned_byte>66</unsigned_byte><short>-222</short><unsigned_short>57005</unsigned_short><int>-57005</int><unsigned_int>3735928559</unsigned_int><long>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><string>string</string><normalized_string>normalized string</normalized_string><token>one two three</token><name>name</name><name_token>name-token</name_token><name_tokens>name tokens</name_tokens><ncname>ncname</ncname><language>en-us</language><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ==
</base64_binary><hex_binary>6865782052696E617279</hex_binary><date>2001-10-26+02:00</date><date_time>2001-10-26T21:32:52+02:00</date_time><duration>P1Y2M3DT5H20M30S</duration><day>---01+02:00</day><month>--11+02:00</month><month_day>--02-11+02:00</month_day><year>2001+02:00</year><year_month>2001-11+02:00</year_month><time>21:32:52+02:00</time></t:root> \ No newline at end of file
diff --git a/tests/cxx/hybrid/built-in/test-000.std b/tests/cxx/hybrid/built-in/test-000.std
index c9a79c7..345c603 100644
--- a/tests/cxx/hybrid/built-in/test-000.std
+++ b/tests/cxx/hybrid/built-in/test-000.std
@@ -1,5 +1,5 @@
<t:root xmlns:t="test" any-simple-attr="abc123">
- <any></any>
+ <any/>
<any-res x="x">
<a>123</a>
<b>abc</b>
diff --git a/tests/cxx/hybrid/choice/test-000.std b/tests/cxx/hybrid/choice/test-000.std
index b299e90..50770ac 100644
--- a/tests/cxx/hybrid/choice/test-000.std
+++ b/tests/cxx/hybrid/choice/test-000.std
@@ -1 +1 @@
-<t:root xmlns:t="test"><test2><a>123</a></test2><test2><b>abc</b><b>def</b></test2><test2><c><a>1.23</a><b>123</b></c></test2><test2><d><a>true</a><a>false</a><b>abc</b></d></test2><test2><e></e></test2><test2><s1>1.23</s1><s2>123</s2></test2><test2><s3>1.23</s3><s4>123</s4></test2><test2><s5>1.23</s5><s6>123</s6><s5>4.56</s5><s6>456</s6></test2><test3><f1>1.23</f1><v1>true</v1><f5>1.23</f5><v5>true</v5></test3><test3><f2>123</f2><v2><a>true</a><a>false</a><b>abc</b></v2><f3>1.23</f3><v3>true</v3><f6>123</f6><f5>1.23</f5><v6><a>true</a><a>false</a><b>abc</b></v6><v5>true</v5></test3><test4><f1>1.23</f1></test4><test4><v1>true</v1></test4><test4><f5>1.23</f5></test4><test4><v5>true</v5></test4><test4><f2>123</f2></test4><test4><v2><a>true</a><a>false</a><b>abc</b></v2></test4><test4><f3>1.23</f3></test4><test4><v3>true</v3></test4><test4><f6>123</f6><f5>1.23</f5></test4><test4><v6><a>true</a><a>false</a><b>abc</b></v6><v5>true</v5></test4><test5a></test5a><test5b><d>true</d></test5b><test5c><d>true</d></test5c><test5d></test5d></t:root> \ No newline at end of file
+<t:root xmlns:t="test"><test2><a>123</a></test2><test2><b>abc</b><b>def</b></test2><test2><c><a>1.23</a><b>123</b></c></test2><test2><d><a>true</a><a>false</a><b>abc</b></d></test2><test2><e/></test2><test2><s1>1.23</s1><s2>123</s2></test2><test2><s3>1.23</s3><s4>123</s4></test2><test2><s5>1.23</s5><s6>123</s6><s5>4.56</s5><s6>456</s6></test2><test3><f1>1.23</f1><v1>true</v1><f5>1.23</f5><v5>true</v5></test3><test3><f2>123</f2><v2><a>true</a><a>false</a><b>abc</b></v2><f3>1.23</f3><v3>true</v3><f6>123</f6><f5>1.23</f5><v6><a>true</a><a>false</a><b>abc</b></v6><v5>true</v5></test3><test4><f1>1.23</f1></test4><test4><v1>true</v1></test4><test4><f5>1.23</f5></test4><test4><v5>true</v5></test4><test4><f2>123</f2></test4><test4><v2><a>true</a><a>false</a><b>abc</b></v2></test4><test4><f3>1.23</f3></test4><test4><v3>true</v3></test4><test4><f6>123</f6><f5>1.23</f5></test4><test4><v6><a>true</a><a>false</a><b>abc</b></v6><v5>true</v5></test4><test5a/><test5b><d>true</d></test5b><test5c><d>true</d></test5c><test5d/></t:root> \ No newline at end of file
diff --git a/tests/cxx/hybrid/clone/test-000.std b/tests/cxx/hybrid/clone/test-000.std
index f50ea2f..f0eaa71 100644
--- a/tests/cxx/hybrid/clone/test-000.std
+++ b/tests/cxx/hybrid/clone/test-000.std
@@ -1,5 +1,5 @@
<t:root xmlns:t="test">
- <complex af="123" afixed="abc" av="abc def">
+ <complex af="123" av="abc def" afixed="abc">
<f>123</f>
<v>abc def ghq</v>
<of>123</of>
diff --git a/tests/cxx/hybrid/default/test-000.std b/tests/cxx/hybrid/default/test-000.std
index 8d41894..6da97af 100644
--- a/tests/cxx/hybrid/default/test-000.std
+++ b/tests/cxx/hybrid/default/test-000.std
@@ -1 +1 @@
-<t:root xmlns:t="test" any="" bool1="true" bool2="true" bool3="false" bool4="false" byte="-99" decimal1="1.12345" decimal2="-0.456" double1="1.12345" double2="1123.45" double3="-0.00012345" double4="NaN" double5="-INF" fix1="123" fix2="123" fix3="abc" fix4="abc" fix5="aaa bbb ccc" fix6="aaa bbb ccc" float1="1.123" float2="1123" float3="-0.000123" float4="NaN" float5="-INF" id="this" idref="this" idrefs="this" int="-99999" integer="-99999" language="en-us" long="-99999" ncname="abcd" ninteger="-99999" nmtoken="ab:cd" nmtokens1="a:b efg aaa" nmtokens2="abc" nninteger="99999" npinteger="-99999" nstring=" a b " pinteger="99999" qname1="foo" qname2="t:bar" short="-999" string1="" string2=" a b " token="a b" ubyte="99" uint="99999" ulong="99999" uri="http://example.com" ushort="999"><union a="abc"></union><list a="123 345 678" b="ab cd ef" c="abc" d="abc def"></list><simple a="123" b="abc" c="123" d="abc" e="abc" f="abc 123"></simple><date a="2009-03-31" b="2009-03-31Z" c="2009-03-31Z" d="2009-03-31Z" e="2009-03-31+12:30" f="2009-03-31-12:30" g="2002009-03-31-12:30"></date><time a="12:03:45" b="12:03:45.123Z" c="12:03:05.123Z" d="12:03:45.123Z" e="12:03:45.123+12:30" f="12:03:45-12:30"></time><date-time a="2009-03-31T12:03:45" b="2009-03-31T12:03:45.123Z" c="2002009-03-31T12:03:05.123-12:30"></date-time><duration a="P100Y" b="P100M" c="P100D" d="PT12H" e="PT12M" f="PT12.123S" g="-P100Y10M20DT12H12M1.123S"></duration><day a="---02" b="---22Z" c="---22-12:30"></day><month a="--02" b="--12Z" c="--12+12:30"></month><year a="2009" b="-2002009Z" c="2009-12:30"></year><month-day a="--02-02" b="--12-22Z" c="--12-22+12:30"></month-day><year-month a="2009-02" b="-2002009-12Z" c="2009-12-12:30"></year-month></t:root> \ No newline at end of file
+<t:root xmlns:t="test" any="" bool1="true" bool2="true" bool3="false" bool4="false" byte="-99" ubyte="99" short="-999" ushort="999" int="-99999" uint="99999" long="-99999" ulong="99999" integer="-99999" npinteger="-99999" nninteger="99999" pinteger="99999" ninteger="-99999" float1="1.123" float2="1123" float3="-0.000123" float4="NaN" float5="-INF" double1="1.12345" double2="1123.45" double3="-0.00012345" double4="NaN" double5="-INF" decimal1="1.12345" decimal2="-0.456" string1="" string2=" a b " nstring=" a b " token="a b" nmtoken="ab:cd" nmtokens1="a:b efg aaa" nmtokens2="abc" ncname="abcd" language="en-us" id="this" idref="this" idrefs="this" uri="http://example.com" qname1="foo" qname2="t:bar" fix1="123" fix2="123" fix3="abc" fix4="abc" fix5="aaa bbb ccc" fix6="aaa bbb ccc"><union a="abc"/><list a="123 345 678" b="ab cd ef" c="abc" d="abc def"/><simple a="123" b="abc" c="123" d="abc" e="abc" f="abc 123"/><date a="2009-03-31" b="2009-03-31Z" c="2009-03-31Z" d="2009-03-31Z" e="2009-03-31+12:30" f="2009-03-31-12:30" g="2002009-03-31-12:30"/><time a="12:03:45" b="12:03:45.123Z" c="12:03:05.123Z" d="12:03:45.123Z" e="12:03:45.123+12:30" f="12:03:45-12:30"/><date-time a="2009-03-31T12:03:45" b="2009-03-31T12:03:45.123Z" c="2002009-03-31T12:03:05.123-12:30"/><duration a="P100Y" b="P100M" c="P100D" d="PT12H" e="PT12M" f="PT12.123S" g="-P100Y10M20DT12H12M1.123S"/><day a="---02" b="---22Z" c="---22-12:30"/><month a="--02" b="--12Z" c="--12+12:30"/><year a="2009" b="-2002009Z" c="2009-12:30"/><month-day a="--02-02" b="--12-22Z" c="--12-22+12:30"/><year-month a="2009-02" b="-2002009-12Z" c="2009-12-12:30"/></t:root> \ No newline at end of file
diff --git a/tests/cxx/hybrid/polymorphism/any-type/test-000.std b/tests/cxx/hybrid/polymorphism/any-type/test-000.std
index 0c40a51..b57b9ea 100644
--- a/tests/cxx/hybrid/polymorphism/any-type/test-000.std
+++ b/tests/cxx/hybrid/polymorphism/any-type/test-000.std
@@ -1,11 +1,11 @@
<t:root xmlns:t="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <t:any></t:any>
- <t:any></t:any>
+ <t:any/>
+ <t:any/>
<t:base x="abc">
<a>123</a>
<b>abc</b>
</t:base>
- <t:any x="xyz" xsi:type="t:derived">
+ <t:any xsi:type="t:derived" x="xyz">
<a>123</a>
<b>abc</b>
<c>9</c>
diff --git a/tests/cxx/hybrid/polymorphism/enumeration/test-000.std b/tests/cxx/hybrid/polymorphism/enumeration/test-000.std
index ecb1b29..62ab1f8 100644
--- a/tests/cxx/hybrid/polymorphism/enumeration/test-000.std
+++ b/tests/cxx/hybrid/polymorphism/enumeration/test-000.std
@@ -1 +1 @@
-<t:root xmlns:t="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><base xsi:type="t:derived">a</base><base xsi:type="t:derived">b</base><simple>a</simple><simple>b</simple><simple xsi:type="t:interm">b</simple><simple xsi:type="t:final">c</simple><simple x="c" xsi:type="t:complex">c</simple></t:root> \ No newline at end of file
+<t:root xmlns:t="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><base xsi:type="t:derived">a</base><base xsi:type="t:derived">b</base><simple>a</simple><simple>b</simple><simple xsi:type="t:interm">b</simple><simple xsi:type="t:final">c</simple><simple xsi:type="t:complex" x="c">c</simple></t:root> \ No newline at end of file
diff --git a/tests/cxx/hybrid/recursive/test-000.std b/tests/cxx/hybrid/recursive/test-000.std
index 6b89789..65834de 100644
--- a/tests/cxx/hybrid/recursive/test-000.std
+++ b/tests/cxx/hybrid/recursive/test-000.std
@@ -1 +1 @@
-<t:root xmlns:t="test"><test1><a>123</a></test1><test1><b><a>123</a></b></test1><test1><b><b><a>123</a></b></b></test1><test2></test2><test2><b><d><x>123</x></d></b></test2><test2><b><c></c><d><x>123</x></d></b></test2><test2><b><c><a></a></c><d><x>123</x></d></b></test2><test2><b><c><a><b><c><a></a></c><d><x>123</x></d></b></a></c><d><x>123</x></d></b></test2><test3><a>123</a><b>abc</b><c>a1</c></test3><test3><a>123</a><b>abc</b><c>a1</c><d><a>456</a><b>def</b><c>b2</c></d></test3><test3><a>123</a><b>abc</b><c>a1</c><d><a>456</a><b>def</b><c>b2</c><d><a>789</a><b>ghi</b><c>c3</c></d></d></test3><test4><a>123</a><c>abc</c></test4><test4><b><a>123</a></b><c>abc</c></test4><test4><b><b><a>123</a></b></b><c>abc</c></test4><test5><a>123</a><c>abc</c></test5><test5><b><a>123</a><c>abc</c></b><c>def</c></test5><test5><b><b><a>123</a><c>abc</c></b><c>def</c></b><c>ghi</c></test5></t:root> \ No newline at end of file
+<t:root xmlns:t="test"><test1><a>123</a></test1><test1><b><a>123</a></b></test1><test1><b><b><a>123</a></b></b></test1><test2/><test2><b><d><x>123</x></d></b></test2><test2><b><c/><d><x>123</x></d></b></test2><test2><b><c><a/></c><d><x>123</x></d></b></test2><test2><b><c><a><b><c><a/></c><d><x>123</x></d></b></a></c><d><x>123</x></d></b></test2><test3><a>123</a><b>abc</b><c>a1</c></test3><test3><a>123</a><b>abc</b><c>a1</c><d><a>456</a><b>def</b><c>b2</c></d></test3><test3><a>123</a><b>abc</b><c>a1</c><d><a>456</a><b>def</b><c>b2</c><d><a>789</a><b>ghi</b><c>c3</c></d></d></test3><test4><a>123</a><c>abc</c></test4><test4><b><a>123</a></b><c>abc</c></test4><test4><b><b><a>123</a></b></b><c>abc</c></test4><test5><a>123</a><c>abc</c></test5><test5><b><a>123</a><c>abc</c></b><c>def</c></test5><test5><b><b><a>123</a><c>abc</c></b><c>def</c></b><c>ghi</c></test5></t:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/all/test-000.std b/tests/cxx/serializer/all/test-000.std
index ec04b95..d63f7ae 100644
--- a/tests/cxx/serializer/all/test-000.std
+++ b/tests/cxx/serializer/all/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test"><test-1><a>123</a><b>234</b></test-1><test-2></test-2><test-2><a>123</a><b>234</b></test-2></g1:root> \ No newline at end of file
+<g1:root xmlns:g1="test"><test-1><a>123</a><b>234</b></test-1><test-2/><test-2><a>123</a><b>234</b></test-2></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/built-in/test-001.std b/tests/cxx/serializer/built-in/test-001.std
index b0f36cc..9ad2dc1 100644
--- a/tests/cxx/serializer/built-in/test-001.std
+++ b/tests/cxx/serializer/built-in/test-001.std
@@ -1,5 +1,5 @@
<g1:root xmlns:g1="test"><any-type foo="one" g1:foo="two"><g1:inner>hello</g1:inner></any-type><any-simple-type>hello</any-simple-type><boolean>true</boolean><boolean>false</boolean><byte>-128</byte><byte>-123</byte><byte>0</byte><byte>127</byte><unsigned-byte>0</unsigned-byte><unsigned-byte>123</unsigned-byte><unsigned-byte>255</unsigned-byte><short>-32768</short><short>-12345</short><short>0</short><short>32767</short><unsigned-short>0</unsigned-short><unsigned-short>12345</unsigned-short><unsigned-short>65535</unsigned-short><int>-2147483648</int><int>-1234567890</int><int>0</int><int>2147483647</int><unsigned-int>0</unsigned-int><unsigned-int>1234567890</unsigned-int><unsigned-int>4294967295</unsigned-int><long>-9223372036854775808</long><long>-1234567890123456789</long><long>0</long><long>9223372036854775807</long><unsigned-long>0</unsigned-long><unsigned-long>12345678901234567890</unsigned-long><unsigned-long>18446744073709551615</unsigned-long><integer>-2147483648</integer><integer>-1234567890</integer><integer>0</integer><integer>2147483647</integer><negative-integer>-2147483648</negative-integer><negative-integer>-1234567890</negative-integer><non-positive-integer>-2147483648</non-positive-integer><non-positive-integer>-1234567890</non-positive-integer><non-positive-integer>0</non-positive-integer><positive-integer>1234567890</positive-integer><positive-integer>4294967295</positive-integer><non-negative-integer>0</non-negative-integer><non-negative-integer>1234567890</non-negative-integer><non-negative-integer>4294967295</non-negative-integer><float>INF</float><float>-INF</float><float>NaN</float><float>0</float><float>1</float><float>-1</float><float>123.567</float><float>-1.23567e+07</float><float>-4.5e-06</float><double>INF</double><double>-INF</double><double>NaN</double><double>0</double><double>1</double><double>-1</double><double>123.56789</double><double>-12356789000</double><double>-4.5e-06</double><decimal>0</decimal><decimal>1</decimal><decimal>-1</decimal><decimal>123.567890000000006</decimal><decimal>-123.567890000000006</decimal><string> test
- string </string><normalized-string>test normalized string</normalized-string><token>test token</token><name>as123:345-.abs</name><nmtoken>1as123:345-.abs</nmtoken><nmtokens>one</nmtokens><nmtokens>one two three</nmtokens><ncname>as123_345-.abs</ncname><id>as123_345-.abs</id><id>one</id><id>two</id><id>three</id><idref>as123_345-.abs</idref><idrefs>one</idrefs><idrefs>two three</idrefs><language>en-us</language><uri>http://www.example.com/foo#bar</uri><qname>g1:qname</qname><qname>qname</qname><base64_binary></base64_binary><base64_binary>MTIzNDVhYmNqaw==
+ string </string><normalized-string>test normalized string</normalized-string><token>test token</token><name>as123:345-.abs</name><nmtoken>1as123:345-.abs</nmtoken><nmtokens>one</nmtokens><nmtokens>one two three</nmtokens><ncname>as123_345-.abs</ncname><id>as123_345-.abs</id><id>one</id><id>two</id><id>three</id><idref>as123_345-.abs</idref><idrefs>one</idrefs><idrefs>two three</idrefs><language>en-us</language><uri>http://www.example.com/foo#bar</uri><qname>g1:qname</qname><qname>qname</qname><base64_binary/><base64_binary>MTIzNDVhYmNqaw==
</base64_binary><base64_binary>YQ==
</base64_binary><base64_binary>YWI=
</base64_binary><base64_binary>YWJj
@@ -10,4 +10,4 @@ q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj
5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/wABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhsc
HR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RV
VldY
-</base64_binary><hex_binary></hex_binary><hex_binary>31323334356162636A6B</hex_binary><hex_binary>000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758</hex_binary><gday>---23</gday><gday>---31+02:30</gday><gday>---15Z</gday><gmonth>--06</gmonth><gmonth>--12+02:30</gmonth><gyear>2007</gyear><gyear>-2007-02:30</gyear><gmonth_day>--06-15</gmonth_day><gmonth_day>--12-31+02:30</gmonth_day><gyear_month>2007-10</gyear_month><gyear_month>-2007-12-02:30</gyear_month><date>2007-06-15</date><date>-2007-12-31-02:30</date><time>12:30:30</time><time>23:59:59.55+02:30</time><date_time>2007-06-15T12:30:30</date_time><date_time>-2007-12-31T23:59:59.55-02:30</date_time><duration>P1Y</duration><duration>-P1M</duration><duration>P1D</duration><duration>-PT1H</duration><duration>PT1M</duration><duration>-PT1.1S</duration><duration>P1Y2M3DT4H5M6.7S</duration></g1:root> \ No newline at end of file
+</base64_binary><hex_binary/><hex_binary>31323334356162636A6B</hex_binary><hex_binary>000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758</hex_binary><gday>---23</gday><gday>---31+02:30</gday><gday>---15Z</gday><gmonth>--06</gmonth><gmonth>--12+02:30</gmonth><gyear>2007</gyear><gyear>-2007-02:30</gyear><gmonth_day>--06-15</gmonth_day><gmonth_day>--12-31+02:30</gmonth_day><gyear_month>2007-10</gyear_month><gyear_month>-2007-12-02:30</gyear_month><date>2007-06-15</date><date>-2007-12-31-02:30</date><time>12:30:30</time><time>23:59:59.55+02:30</time><date_time>2007-06-15T12:30:30</date_time><date_time>-2007-12-31T23:59:59.55-02:30</date_time><duration>P1Y</duration><duration>-P1M</duration><duration>P1D</duration><duration>-PT1H</duration><duration>PT1M</duration><duration>-PT1.1S</duration><duration>P1Y2M3DT4H5M6.7S</duration></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/choice/test-000.std b/tests/cxx/serializer/choice/test-000.std
index 78a615a..87c22c0 100644
--- a/tests/cxx/serializer/choice/test-000.std
+++ b/tests/cxx/serializer/choice/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test"><test-1><a>123</a></test-1><test-1><b>234</b></test-1><test-1><c>1</c><c>2</c><c>3</c></test-1><test-2></test-2><test-2><b>234</b></test-2><test-3><a>123</a><b>234</b><a>123</a><b>234</b></test-3><test-4><a>123</a></test-4><test-4><c>234</c></test-4><test-4><d>345</d><e>456</e></test-4></g1:root> \ No newline at end of file
+<g1:root xmlns:g1="test"><test-1><a>123</a></test-1><test-1><b>234</b></test-1><test-1><c>1</c><c>2</c><c>3</c></test-1><test-2/><test-2><b>234</b></test-2><test-3><a>123</a><b>234</b><a>123</a><b>234</b></test-3><test-4><a>123</a></test-4><test-4><c>234</c></test-4><test-4><d>345</d><e>456</e></test-4></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/list/test-000.std b/tests/cxx/serializer/list/test-000.std
index c1ef004..3d36007 100644
--- a/tests/cxx/serializer/list/test-000.std
+++ b/tests/cxx/serializer/list/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test"><int-list></int-list><int-list>1</int-list><int-list>1 2 3</int-list><int-list-base base="123"></int-list-base><int-list-base base="123">1</int-list-base><int-list-base base="123">1 2 3</int-list-base></g1:root> \ No newline at end of file
+<g1:root xmlns:g1="test"><int-list/><int-list>1</int-list><int-list>1 2 3</int-list><int-list-base base="123"/><int-list-base base="123">1</int-list-base><int-list-base base="123">1 2 3</int-list-base></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/recursive/test-000.std b/tests/cxx/serializer/recursive/test-000.std
index 717654f..99f0dcc 100644
--- a/tests/cxx/serializer/recursive/test-000.std
+++ b/tests/cxx/serializer/recursive/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test" name="234"><sub name="1"><sub name="2"></sub><indir name="123"><sub name="2"></sub></indir><sub2 name="2"></sub2></sub></g1:root> \ No newline at end of file
+<g1:root name="234" xmlns:g1="test"><sub name="1"><sub name="2"/><indir name="123"><sub name="2"/></indir><sub2 name="2"/></sub></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/restriction/test-000.std b/tests/cxx/serializer/restriction/test-000.std
index 6cb29b4..8b274d8 100644
--- a/tests/cxx/serializer/restriction/test-000.std
+++ b/tests/cxx/serializer/restriction/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test"><test-1 optional="123" required="234"></test-1><test-2><a>1</a><b>2</b><c>3</c><e>5</e></test-2><test-3><b>2</b><g>7</g></test-3><test-4><b>2</b><g>7</g></test-4></g1:root> \ No newline at end of file
+<g1:root xmlns:g1="test"><test-1 optional="123" required="234"/><test-2><a>1</a><b>2</b><c>3</c><e>5</e></test-2><test-3><b>2</b><g>7</g></test-3><test-4><b>2</b><g>7</g></test-4></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/sequence/test-000.std b/tests/cxx/serializer/sequence/test-000.std
index a76f191..1185cc0 100644
--- a/tests/cxx/serializer/sequence/test-000.std
+++ b/tests/cxx/serializer/sequence/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test"><test-1><a>123</a><b>234</b><c>1</c><c>2</c><c>3</c></test-1><test-2></test-2><test-2><a>123</a><b>234</b></test-2><test-3><a>124</a><b>235</b><a>125</a><b>236</b><a>126</a><b>237</b></test-3><test-4><a>123</a><c>234</c><d>346</d><e>457</e><d>347</d><e>458</e><d>348</d><e>459</e></test-4></g1:root> \ No newline at end of file
+<g1:root xmlns:g1="test"><test-1><a>123</a><b>234</b><c>1</c><c>2</c><c>3</c></test-1><test-2/><test-2><a>123</a><b>234</b></test-2><test-3><a>124</a><b>235</b><a>125</a><b>236</b><a>126</a><b>237</b></test-3><test-4><a>123</a><c>234</c><d>346</d><e>457</e><d>347</d><e>458</e><d>348</d><e>459</e></test-4></g1:root> \ No newline at end of file
diff --git a/tests/cxx/serializer/wildcard/test-000.std b/tests/cxx/serializer/wildcard/test-000.std
index a55bc57..c853a12 100644
--- a/tests/cxx/serializer/wildcard/test-000.std
+++ b/tests/cxx/serializer/wildcard/test-000.std
@@ -1 +1 @@
-<g1:root xmlns:g1="test" xmlns:g2="foo" x="##local#x" g2:x="foo#x"><a x="123"><a>321</a></a><g2:a>0</g2:a><g2:a>1</g2:a><g2:a>2</g2:a><g3:b xmlns:g3="bar">bar#b</g3:b></g1:root> \ No newline at end of file
+<g1:root xmlns:g2="foo" g2:x="foo#x" x="##local#x" xmlns:g1="test"><a x="123"><a>321</a></a><g2:a>0</g2:a><g2:a>1</g2:a><g2:a>2</g2:a><g3:b xmlns:g3="bar">bar#b</g3:b></g1:root> \ No newline at end of file