@Test public void testXml() throws Exception { assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><node name=\"x\"><property name=\"test\"><value></value></property><property name=\"null\"></property><property name=\"string\"><value>string</value></property><property name=\"list&lt;string&gt;\"><value>item1</value><value>item2</value><value>item3</value></property><property name=\"child\"><node name=\"y\"><property name=\"outputCols\"><value>Name (string)</value><value>Year (integer)</value></property><property name=\"Join Type\"><value>INNER JOIN</value></property><property name=\"Criteria\"><value>Item.ID = History.ID</value></property><property name=\"Other\"></property></node></property></node>", example1().toXml()); }
public String toXml() { try { XMLOutputFactory outputFactory = XMLOutputFactory.newFactory(); StringWriter stringWriter = new StringWriter(); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter); writer.writeStartDocument("UTF-8", "1.0"); writePlanNode(this, writer); writer.writeEndDocument(); return stringWriter.toString(); } catch (FactoryConfigurationError e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20002, e); } catch (XMLStreamException e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20003, e); } }
PlanNode implements Externalizable { public String toXml() { try { XMLOutputFactory outputFactory = XMLOutputFactory.newFactory(); StringWriter stringWriter = new StringWriter(); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter); writer.writeStartDocument("UTF-8", "1.0"); writePlanNode(this, writer); writer.writeEndDocument(); return stringWriter.toString(); } catch (FactoryConfigurationError e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20002, e); } catch (XMLStreamException e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20003, e); } } }
PlanNode implements Externalizable { public String toXml() { try { XMLOutputFactory outputFactory = XMLOutputFactory.newFactory(); StringWriter stringWriter = new StringWriter(); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter); writer.writeStartDocument("UTF-8", "1.0"); writePlanNode(this, writer); writer.writeEndDocument(); return stringWriter.toString(); } catch (FactoryConfigurationError e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20002, e); } catch (XMLStreamException e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20003, e); } } PlanNode();  PlanNode(String name); }
PlanNode implements Externalizable { public String toXml() { try { XMLOutputFactory outputFactory = XMLOutputFactory.newFactory(); StringWriter stringWriter = new StringWriter(); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter); writer.writeStartDocument("UTF-8", "1.0"); writePlanNode(this, writer); writer.writeEndDocument(); return stringWriter.toString(); } catch (FactoryConfigurationError e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20002, e); } catch (XMLStreamException e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20003, e); } } PlanNode();  PlanNode(String name); String getName(); PlanNode getParent(); List<Property> getProperties(); void addProperty(String pname, PlanNode value); void addProperty(String pname, List<String> value); void addProperty(String pname, String value); String toXml(); static PlanNode fromXml(String planString); @Override String toString(); String toYaml(); @Override void readExternal(ObjectInput in); @Override void writeExternal(ObjectOutput out); Property getProperty(String pName); }
PlanNode implements Externalizable { public String toXml() { try { XMLOutputFactory outputFactory = XMLOutputFactory.newFactory(); StringWriter stringWriter = new StringWriter(); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter); writer.writeStartDocument("UTF-8", "1.0"); writePlanNode(this, writer); writer.writeEndDocument(); return stringWriter.toString(); } catch (FactoryConfigurationError e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20002, e); } catch (XMLStreamException e) { throw new TeiidRuntimeException(JDBCPlugin.Event.TEIID20003, e); } } PlanNode();  PlanNode(String name); String getName(); PlanNode getParent(); List<Property> getProperties(); void addProperty(String pname, PlanNode value); void addProperty(String pname, List<String> value); void addProperty(String pname, String value); String toXml(); static PlanNode fromXml(String planString); @Override String toString(); String toYaml(); @Override void readExternal(ObjectInput in); @Override void writeExternal(ObjectOutput out); Property getProperty(String pName);  }