[
Lists Home |
Date Index |
Thread Index
]
> > No explicit end-start-tag is used or needed. The writer can tell
when a
> > start tag needs to end; in fact, the convention helps to produce
empty
> > element tags without backtracking. Use is simple and natural.
> XmlWriter from trang is tailored to the particular use in trang;
namely
> for tree traversal. It is only one test case of many.
FWIW, we discussed this pattern rather extensively in XmlWriter design
for .NET and nearly decided to introduce a WriteStartContent (same as
what you call genxStartTagClose) method for V2, but ultimately decided
against it. We felt that StartContent was less usable for 80% of users,
who would have regarded it as unnecessary and perhaps confusing. It's
also more consistent with the way that the XML data model views things
-- anything between a "start" and "end" is a child of that start and end
and increments depth:
StartElement
StartAttribute
Text
EndAttribute
StartElement
Text
EndElement
EndElement
Any state between EndAttribute and StartElement would be a dummy state
that did not represent anything in the data model, but instead
represented a lexical token of "</>"
The main reason we even considered this state was for potential
performance. The idea was that in pipelining scenarios we could have
the inner writer be a "raw" text writer that always assumes that the
calls will occur in the correct order, and would do absolutely *no*
checking. The outermost writer would do all of the checking, insert
missing calls to EndAttribute, StartContent, etc. and then each layer of
the pipeline up to the final text output could be "raw". This would
eliminate need for multiple layers to maintain stack, check for
duplicate attributes, etc.
Another consideration was that, when serializing to alternate private
binary format, we don't actually need a token that represents the end of
an attribute -- we could store "SE:SA:Value:Value:SA:Value:SC:...".
This way, the writer could insert proper SC content for the private
binary format without having to keep track that attributes have closed.
In any case, I doubt that either consideration applies to genx, and even
despite these considerations we did not feel there was enough
justification for StartContent on XmlWriter in .NET.
|