xml design for streamability roger l. costello november 24, 2013 1

6
XML Design for Streamability Roger L. Costello November 24, 2013 1

Upload: lesley-mccarthy

Post on 17-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XML Design for Streamability Roger L. Costello November 24, 2013 1

1

XML Design for Streamability

Roger L. CostelloNovember 24, 2013

Page 2: XML Design for Streamability Roger L. Costello November 24, 2013 1

2

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

Page 3: XML Design for Streamability Roger L. Costello November 24, 2013 1

3

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.

Page 4: XML Design for Streamability Roger L. Costello November 24, 2013 1

4

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.

Page 5: XML Design for Streamability Roger L. Costello November 24, 2013 1

5

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.

Page 6: XML Design for Streamability Roger L. Costello November 24, 2013 1

6

Lesson Learned

• A simple change in XML design can make the difference between a streamable XML versus a non-streamable XML.