[erlang-questions] how: xmerl export without "

Hugo Mills hugo@REDACTED
Thu Sep 19 09:42:02 CEST 2013


On Thu, Sep 19, 2013 at 08:32:39AM +0200, Bengt Kleberg wrote:
> Greetings,
> 
> I would like to get rid of " when xmerl export a structure.
> 
> I have the following structure:
> [{bike, [{year, 2000}], [{name, ["Suzuki"]}]}]
> 
> When I do
> lists:flatten( xmerl:export_simple_content(Bike, xmerl_xml) ).
> 
> the result is
> "<bike year=\"2000\"><name>Suzuki</name></bike>"
> 
> How should I do to get
> "<bike year=2000><name>Suzuki</name></bike>"

   That's not well-formed XML -- XML *requires* the use of the quotes
containing attribute values. I would be surprised if you could make a
conformant XML processor do what you're asking.

   If you need to know that the value of the "year" attribute is an
integer (or an xsd:gYear), then you should either hard-code that
knowledge in your consumer (with an appropriate human-readable
standard for anyone else reading the data format), or use a schema
document to formalise it.

   Hugo.

-- 
=== Hugo Mills: hugo@REDACTED carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
    --- The most exciting phrase to hear in science, the one that ---    
               heralds new discoveries,  is not "Eureka!",               
                          but "That's funny..."                          
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130919/7acbba70/attachment.bin>


More information about the erlang-questions mailing list