Package commonj.sdo.helper

Examples of commonj.sdo.helper.XMLHelper.save()


            XMLHelper xmlHelper = helperContext.getXMLHelper();
            QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
            Document doc = DOMHelper.newDocument();
            DOMResult result = new DOMResult(doc);
            XMLDocument xmlDoc = xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            xmlHelper.save(xmlDoc, result, null);
            return doc.getDocumentElement();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here


    public String transform(XMLDocument source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            StringWriter writer = new StringWriter();
            xmlHelper.save(source, writer, null);
            return writer.toString();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

        }

        try {
            DOMResult domResult = new DOMResult(DOMHelper.newDocument());
            XMLDocument xmlDoc = helper.createDocument(source, null, name);
            helper.save(xmlDoc, domResult, null);
            return node2NodeInfoTransformer.transform(domResult.getNode(), context);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
View Full Code Here

            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
            XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
            Object logicalType = context.getSourceDataType().getLogical();
            if (logicalType instanceof QName) {
                QName elementName = (QName) logicalType;
                return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            } else {
                return xmlHelper.save(source, TUSCANY_SDO, "dataObject");
            }
        } catch (Exception e) {
            throw new TransformationException(e);
View Full Code Here

            Object logicalType = context.getSourceDataType().getLogical();
            if (logicalType instanceof QName) {
                QName elementName = (QName) logicalType;
                return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            } else {
                return xmlHelper.save(source, TUSCANY_SDO, "dataObject");
            }
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

    public String transform(XMLDocument source, TransformationContext context) {
        try {
            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
            XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
            StringWriter writer = new StringWriter();
            xmlHelper.save(source, writer, null);
            return writer.toString();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

    public static void serializeToSystemOut(DataObject object, String name) {
        XMLHelper helper = XMLHelper.INSTANCE;

        try {
            helper.save(object, null, name, System.out);
            System.out.println();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        XMLHelper xmlHelperLocal = xmlHelper;
        if(objectOutput instanceof SDOObjectInputStream)
        {
            xmlHelperLocal = ((SDOObjectInputStream)objectOutput).getHelperContext().getXMLHelper();
        }
        xmlHelperLocal.save(dataObject, "commonj.sdo", "dataObject", gzipOutputStream);
        gzipOutputStream.close(); // Flush the contents

        byte[] byteArray = compressedByteArrayOutputStream.toByteArray();
        objectOutput.writeInt(byteArray.length);
        objectOutput.write(byteArray);
View Full Code Here

    DataObject lastNameProperty = customerType.createDataObject("property");
    lastNameProperty.set("name", "lastName");
    lastNameProperty.set("type", stringType);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    xmlHelper.save(customerType, "commonj.sdo", "type", baos);
   
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    XMLDocument xdoc = xmlHelper.load(bais);

    customerType = xdoc.getRootObject();
View Full Code Here

    assertEquals(type.getProperty("custNum").getType(), intType);
    assertEquals(type.getProperty("firstName").getType(), stringType);
    assertEquals(type.getProperty("lastName").getType(), stringType);
   
    baos = new ByteArrayOutputStream();
    xmlHelper.save(
      customer1,
      "http://example.com/customer",
      "Customer", baos);
    assertTrue(
      TestUtil.equalXmlFiles(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.