- foundLists.add( child.getNodeType() );
- }
- }
- else if (childSchema instanceof ContainerSchemaNode) {
- Preconditions.checkState(child instanceof CompositeNode,
- "Data representation of Container should be CompositeNode - " + child.getNodeType());
- writeContainer(writer, (CompositeNode) child, (ContainerSchemaNode) childSchema);
- } else if (childSchema instanceof ListSchemaNode) {
- if (!foundLists.contains( child.getNodeType() ) ) {
- Preconditions.checkState(child instanceof CompositeNode,
- "Data representation of List should be CompositeNode - " + child.getNodeType());
- foundLists.add( child.getNodeType() );
- writeList(writer, parent, (CompositeNode) child, (ListSchemaNode) childSchema);
- }
- } else if (childSchema instanceof LeafListSchemaNode) {
- if (!foundLists.contains( child.getNodeType() ) ) {
- Preconditions.checkState(child instanceof SimpleNode<?>,
- "Data representation of LeafList should be SimpleNode - " + child.getNodeType());
- foundLists.add( child.getNodeType() );
- writeLeafList(writer, parent, (SimpleNode<?>) child, (LeafListSchemaNode) childSchema);
- }
- } else if (childSchema instanceof LeafSchemaNode) {
- Preconditions.checkState(child instanceof SimpleNode<?>,
- "Data representation of LeafList should be SimpleNode - " + child.getNodeType());
- writeLeaf(writer, (SimpleNode<?>) child, (LeafSchemaNode) childSchema);
- } else if (childSchema instanceof AnyXmlSchemaNode) {
- if( child instanceof CompositeNode ) {
- writeContainer(writer, (CompositeNode) child, null);
- }
- else {
- handleNoSchemaFound( writer, child, parent );
+ foundLists.add( child.getNodeType() );
+ }
+ }
+ else if (childSchema instanceof ContainerSchemaNode) {
+ Preconditions.checkState(child instanceof CompositeNode,
+ "Data representation of Container should be CompositeNode - %s", child.getNodeType());
+ writeContainer(writer, (CompositeNode) child, (ContainerSchemaNode) childSchema);
+ } else if (childSchema instanceof ListSchemaNode) {
+ if (!foundLists.contains( child.getNodeType() ) ) {
+ Preconditions.checkState(child instanceof CompositeNode,
+ "Data representation of List should be CompositeNode - %s", child.getNodeType());
+ foundLists.add( child.getNodeType() );
+ writeList(writer, parent, (CompositeNode) child, (ListSchemaNode) childSchema);
+ }
+ } else if (childSchema instanceof LeafListSchemaNode) {
+ if (!foundLists.contains( child.getNodeType() ) ) {
+ Preconditions.checkState(child instanceof SimpleNode<?>,
+ "Data representation of LeafList should be SimpleNode - %s", child.getNodeType());
+ foundLists.add( child.getNodeType() );
+ writeLeafList(writer, parent, (SimpleNode<?>) child, (LeafListSchemaNode) childSchema);
+ }
+ } else if (childSchema instanceof LeafSchemaNode) {
+ Preconditions.checkState(child instanceof SimpleNode<?>,
+ "Data representation of LeafList should be SimpleNode - %s", child.getNodeType());
+ writeLeaf(writer, (SimpleNode<?>) child, (LeafSchemaNode) childSchema);
+ } else if (childSchema instanceof AnyXmlSchemaNode) {
+ if( child instanceof CompositeNode ) {
+ writeContainer(writer, (CompositeNode) child, null);
+ }
+ else {
+ handleNoSchemaFound( writer, child, parent );
+ }
+ } else {
+ throw new UnsupportedDataTypeException("Schema can be ContainerSchemaNode, ListSchemaNode, "
+ + "LeafListSchemaNode, or LeafSchemaNode. Other types are not supported yet.");
+ }