devxlogo

April 30, 2008

Using StAX to Clone an XML Document

To clone an XML document at runtime, use the StAX XMLEventReader and XMLEventWriter classes like this: //AirWings_order.xml – the original XML in this example//AirWings_order_clone.xml – the clone of AirWings_order.xmlimport javax.xml.stream.*;import

Override a Child Class’ Parent Method

C# seems to fail in an advanced use of polymorphism, as demonstrated by the following code: class AReturn {}class BReturn : AReturn {}class A{ public virtual AReturn GetReturn() {…}}class B{