Lists Home |
Date Index |
OK, I got C14n wrong (ERH has given me a test suite so it won't happen
again). Here's how I'm thinking I'm going to change Genx to do the
Among my c14n mistakes was the belief that you can't have default
namespaces in C14nized XML.
1. The existing modes work. You declare namespaces whenever you want,
Genx will make sure they're in effect if you emit an element or
attribute that's in a namespace.
2. You can now say
genxDeclareNamespace(w, "http://example.com", "", &status)
to make this the default namespace whenever it's in effect.
IF there is a default namespace in effect and you try to insert an
element/attribute that's not in a namespace, that's an error.
3. There's a new call genxAddNamespace(genxWriter w, genxNamespace ns)
that you can mix up with genxAddAttribute calls immediately following a
genxStartElement call. The idea is that if you want to control the
placement of NS declarations, you can. Normally, you'd do this if you
knew you were going to have qnames in content and needed to be sure the
prefixes were declared.
4. There's a new call genxAddAllNamespaces(genxWriter w) which makes
sure all the namespaces you've declared so far are in scope. Normally,
you'd do this on the root element.
5. There's a new call genxAddQName(genxWriter w, genxNamespace ns, utf8
value) which will emit a QName with the appropriate prefix if you
(gack, gag) wanted a QName in Element Content.
6. There's a new call
genxAddAttributeWithQName(genxWriter w, genxAttribute a, genxNamespace
ns, utf8 value)
where the ns prefix and "value" arg are put together to make qname
Anyone have a better idea? Simon Fell, would this address your issues?