60 likes | 130 Views
Explore the philosophical considerations and practical implications of designing XML for streaming, with examples illustrating how to modify XML structure for streamability using attributes.
E N D
XML Design for Streamability Roger L. Costello November 24, 2013
Design XML for Streaming? Philosophically I'm somewhat opposed to designing XML for streaming or for any particular process or processing paradigm. This is sometimes necessary, but more often I think it would be optimizing in the wrong place. Would you be comfortable if someone said you can't have cross-references in your user manual because they prevent you from streaming in your production process? I'd rather have the cross-references, and then if I need to stream, I can figure out how to do that. Wendell Piez xsl-list, 11/22/2013
Design XML for Streaming? • Wendell makes a really good point. • However, sometimes with a small tweak here and there, an XML design can be changed from one that is not streamable to one that is streamable. See next slide.
An XML Design That Is Not Suited For Streaming • Below is an XML document that contains data about a military mission. It describes the type-of-mission (training, actual, simulation) and the weapons used. <Mission><Type>simulation</Type><WeaponRelease><Munition>CBU-89</Munition><Quantity>20</Quantity><Target>Enemy terrorists</Target><DateTime>2013-05-11T08:00:00</DateTime></WeaponRelease></Mission> Suppose that processing this requires knowing the type-of-mission. Since the type is in a preceding node (and XSLT streaming prohibits access to preceding nodes), the XSLT program cannot process WeaponRelease.
Revised XML Design So That It Is Suited For Streaming <Mission type="simulation"><WeaponRelease><Munition>CBU-89</Munition><Quantity>20</Quantity><Target>Enemy terrorists</Target><DateTime>2013-05-11T08:00:00</DateTime></WeaponRelease></Mission> The data about the type-of-mission is now in an ancestor’s attribute, so the XSLT can process WeaponRelease.
Lesson Learned • A simple change in XML design can make the difference between a streamable XML versus a non-streamable XML.