* XML/Ada 1.0 - SAX - Attribute converted from String to Integer @ 2005-08-27 17:29 Frank 2005-08-27 20:58 ` Simon Wright 2005-08-28 19:32 ` Georg Bauhaus 0 siblings, 2 replies; 3+ messages in thread From: Frank @ 2005-08-27 17:29 UTC (permalink / raw) Hi! I am programming an interface that reads an XML file, that contains integers in Attributes. E.g <Data height="21" width="91"></Data> I am using SAX from XML/Ada 1.0. I wish to retrieve the data from the attributes (e.g from height) and put them into variables of their respective types in Ada (Integers) Current solution: I have created: package XML_Integer_IO is new Ada.Text_IO.Integer_IO(Integer); I Get_Value the height fromt the element and get Unicode.CES.Byte_Sequence as result. I converted this Unicode.CES.Byte_Sequence to String Then I use Get from XML_Integer_IO to grab the integer out of the string into a Integer variable. Is this the way it should be done? I would imagine some kind of "Get_Value_As_Integer" readymade in the XML library. Frank ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: XML/Ada 1.0 - SAX - Attribute converted from String to Integer 2005-08-27 17:29 XML/Ada 1.0 - SAX - Attribute converted from String to Integer Frank @ 2005-08-27 20:58 ` Simon Wright 2005-08-28 19:32 ` Georg Bauhaus 1 sibling, 0 replies; 3+ messages in thread From: Simon Wright @ 2005-08-27 20:58 UTC (permalink / raw) You could use Ada.Integer_Text_IO, which is a ready-prepared instantiation; or you could try Integer'Value (your-string). Note the latter works for any scalar type. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: XML/Ada 1.0 - SAX - Attribute converted from String to Integer 2005-08-27 17:29 XML/Ada 1.0 - SAX - Attribute converted from String to Integer Frank 2005-08-27 20:58 ` Simon Wright @ 2005-08-28 19:32 ` Georg Bauhaus 1 sibling, 0 replies; 3+ messages in thread From: Georg Bauhaus @ 2005-08-28 19:32 UTC (permalink / raw) Frank wrote: > I would imagine some kind of > "Get_Value_As_Integer" readymade in the XML library. Not really in an XML library, as an XML document is just text, and XML proper is only aware of it's own types. These do not include numeric types. (SGML has them, syntax-wise.) Relax NG adds support for type libraries, XML Schema defines some basic types. These types may or may not match the types used in Ada programs. But XML Schema type value notations and Ada value notations are not 1:1, so XML is really an external format. Once you have an XML attribute value as a String value, you can use the features that Simon Wright has suggested. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-28 19:32 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-08-27 17:29 XML/Ada 1.0 - SAX - Attribute converted from String to Integer Frank 2005-08-27 20:58 ` Simon Wright 2005-08-28 19:32 ` Georg Bauhaus
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox