[
Lists Home |
Date Index |
Thread Index
]
"David G. Durand" wrote:
> ...
>
> I might want to put a colon prefix on a tag that is not (and will
> never be) associated with a namespace, for instance. More commonly,
> it's not uncommon to want to omit a NS declaration in an output
> file because it's to be an external entity body that be included in
> another parsing context at a later time, and in which that namespace
> prefix will be properly bound.
If I understand your description, you mean that, where one has a
document fragment like
? (defParameter *node*
(make-elem-node :name '{xslt}element
:attributes (list (make-string-attr-node :name '{}name
:value "asdf"))))
*NODE*
instead of encoding it like this
? (write-node *node* *trace-output*)
==>
<xsl:element name='asdf'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' />
#<ELEM-NODE #<UNAME {xsl}element #x8B1F32E> #x8B58C7E>
one might need to encode it like this
? (write-node *node* *trace-output*
:default-namespace "http://www.w3.org/1999/XSL/Transform")
==>
<element name='asdf' />
#<ELEM-NODE #<UNAME {xsl}element #x8B1F32E> #x8B58C7E>
or like this
? (write-node *node* *trace-output*
:namespace-bindings `(("TLSX" . "http://www.w3.org/1999/XSL/Transform")))
==>
<TLSX:element name='asdf' />
#<ELEM-NODE #<UNAME {xsl}element #x8B1F32E> #x8B58C7E>
?
as i noted in one of my earlier notes, these are matters for the parser
and serializer.
for them only.
>
> > > or non-xml results.
> >
> >i am unaware of this issue and would appreciate examples.
>
> I'm outputting some other data format, but I want to embed a little
> piece of XML in the middle. The other data might establish a
> "namespace" binding in some other syntax. Or I might, as discussed
> above, be using colon prefixes to mean something else.
see above. perhaps one even needs to encode it like this
? (write-node *node* *trace-output*
:namespace-bindings `(("TLSX:too:" . "http://www.w3.org/1999/XSL/Transform")))
==>
<TLSX:too::element name='asdf' />
#<ELEM-NODE #<UNAME {xsl}element #x8B1F32E> #x8B5766E>
?
>
> I might be needing to force colon prefixes to change in some odd way
> to accomodate a DTD that I want to conform to. Since DTDs don't know
> about the "semantics" of namespaces, that requires syntactic control
> over the prefixes.
the issues related to being able to do something like this:
? (write-node (parse-document
"<!DOCTYPE element [
<!ELEMENT qwer:element EMPTY >
<!ATTLIST qwer:element
name CDATA 'asdf'
xmlns:qwer CDATA
'http://www.w3.org/1999/XSL/Transform' > ]>
<asdf:element
xmlns:asdf='http://www.w3.org/1999/XSL/Transform' />")
*trace-output* :pretty t :encoding :usascii
:default-namespace "http://www.w3.org/1999/XSL/Transform")
==>
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<!DOCTYPE element [
<!ELEMENT element EMPTY >
<!ATTLIST element
xmlns:qwer CDATA 'http://www.w3.org/1999/XSL/Transform'
name CDATA 'asdf' >
]>
<element xmlns:asdf='http://www.w3.org/1999/XSL/Transform'
xmlns:qwer='http://www.w3.org/1999/XSL/Transform'
name='asdf' />
#<DOC-NODE <no uri> #x8B75C8E>
?
are the same: operations have to be described in terms of the semantic
domains only and the parser/serializer have to map between the semantic
domains and the concrete syntax.
> There's surely an annotation that could be added
> to a system like the one you want to ask for particular prefixes in
> particular places, but that starts to be a lot of complication to
> prevent a pretty easy to avoid error.
>
the only complexity arises in where the serializer automatically
generates prefixes in the presence of defaults and/or conflicts. this is
confined to the serializer and requires no annotation.
or, should one say that prefixes are themselves primary and the
namespace names are just the licenses.
> It's a tradeoff of flexibility versus automation of error prevention.
|