//Provided by Dave Watt
package com.jxml.quick.examples.idref;

import java.util.*;
import java.io.*;
import com.jxml.quick.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import com.jxml.protocol.*;

public class Test
{
  public ChildElemId childElemId;
  public ChildElemRef childElemRef;

  public static void main(String[] args)
  throws Exception
  {
	Protocol.addJXMLProtocolPackage();
 	QDoc testSchema = Quick.parseSchema(args[0]);

        Test vTest = new Test();
        vTest.childElemId = new ChildElemId();
	vTest.childElemRef = new ChildElemRef();
        vTest.childElemRef.elem = vTest.childElemId;

	QDoc testDoc = Quick.createDoc( vTest, testSchema );

	String sXml = Quick.express( testDoc );
	System.out.println( sXml );

	QDoc testDoc2 = Quick.parseString( testSchema, sXml );
	Test test2 = (Test)Quick.getRoot( testDoc2 );

	QDoc testDoc3 = Quick.createDoc( test2, testSchema );
	String sXML2 = Quick.express( testDoc3 );
	System.out.println( sXML2 );
  }
}