[m-rev.] For review: Allow custom functor to element mappings in term_to_xml

Ian MacLarty maclarty at cs.mu.OZ.AU
Thu Dec 9 17:12:57 AEDT 2004


On Thu, Dec 09, 2004 at 04:44:30PM +1100, Julien Fischer wrote:
> 
> On Thu, 9 Dec 2004, Ian MacLarty wrote:
> 
> ...
> > Add a check to see if a DTD can be generated for a type under a custom mapping
> > scheme.  This involves checking that the mapping scheme does not generate the
> > same element for any two distinct functors that could appear in ground terms of
> > the type.
> >
> > Also do not generate DTDs for types other that discriminated unions, arrays,
> s/that/than/
> 
Fixed.

> ...
> 
> > 	that the previously mentioned runtime bug doesn't bite.  This is one
> > 	line of code that just needs to be uncommented when the bug is fixed -
> Just make this: "This line of code just needs to be uncommented ..."
> 
Done.

> > +++ library/term_to_xml.m	9 Dec 2004 01:14:30 -0000
> > @@ -14,31 +14,25 @@
> >  % an output stream as XML.
> >  %
> >  % Each functor in a term is given a corresponding well-formed element name
> > -% in the XML document.
> > +% in the XML document according to a mapping.  Some predefined mappings are
> > +% prodice, but user defined mappings may also be used.
> s/prodice/provided/
> 

Done.

> >  % functor - the original functor name as returned by
> > -% 	deconstruct.deconstruct/5.  This attribute will be present for
> > -%	every element except elements for builtin types.
> > -%
> > -% typename - the type name of the Mercury type the element represents.
> > -%	This attribute will also always be present for all elements except
> > -%	elements for builtin types.
> > +% 	deconstruct.deconstruct/5.
> > +%
> Should deconstruct.deconstruct/5 be there?
> 

Yes.  It's a continuation of this line:
"functor - the original functor name as returned by"

> > @@ -47,6 +41,21 @@
> >  %
> >  % To support third parties generating XML which is compatible with the XML
> >  % generated by this library, a DTD for a Mercury type can also be generated.
> > +% A DTD for a given type and functo-to-element mapping may be generated
> s/functo/functor/
>

Fixed.

> > +% provided the following conditions hold:
> > +%
> > +%	1. If the type is a discriminated union then there must be only
> > +%	one top-level functor for the type.  This is because the top
> > +%	level functor will be used to generate the document type name.
> > +%
> > +%	2. The provided functor to element mapping must map each functor
> > +%	to a unique element name for every functor that could appear in
> > +%	terms of the type.
> Remove the word provided there, it's redundant.
>

Done.

> > +		)
> > +	;	no_stylesheet.
> > +
> >  	% Values of this type indicate whether a DTD was successfully
> >  	% generated or not.  A DTD cannot be generated for a type with more
> >  	% than one top-level functor since only one root element can be
> > -	% specified by a DTD.
> > +	% specified by a DTD.  A DTD also cannot be generated for a
> > +	% type where the mapping from functors of the type to
> > +	% elements is not unique (since then the legal children DTD rules
> > +	% cannot be expressed properly).
> >  	%
> since then the DTD rules for legal children cannot be expressed properly
>

Okay.

> > +			% At the moment we only support generation of DTDs for
> > +			% types made up of discriminated unions, arrays,
> > +			% strings, ints, characters and floats.
> > +			%
> > +		unsupported_dtd_type(type_desc).
> > +
> > +	% Values of this type specify what mapping from functors to elements
> s/what/which/ or s/what/the/
> 

Right.

> > +	% to use when generating XML.  The role of a mapping is two fold:
> s/two fold/twofold/
>

Okay.

> > -	% will be returned in DTDResult and nothing will be written.
> > +	% will be canonicalized.  If an embedded DTD is requested, but it is
> > +	% not possible to generated a DTD for Term using ElementMapping, then a
> s/generated/generate/
> 

Fixed.

> > +	% value other than `ok' is returned in DTDResult and nothing is written
> > +	% out.  See the documentatin of the dtd_generation_result type for more
> s/documentatin/documentation/
> 

Fixed.

> > +	% information of DTDResult when it is not `ok'.
> >  	%
> s/of/about/?  That last sentence doesn't make a great deal of sense
> as written.
> 

How about "See the dtd_generation_result type for a list of the other
possible values of DTDResult and their meanings."?

Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list