Package commonj.sdo.helper

Examples of commonj.sdo.helper.XMLDocument


        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            Document doc = DOMHelper.promote(source);
            DOMSource domSource = new DOMSource(doc);
            XMLDocument xmlDoc = xmlHelper.load(domSource, doc.getDocumentURI(), null);
            return xmlDoc.getRootObject();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here


    @Override
    public Object copy(Object arg) {
        HelperContext context = HelperProvider.getDefaultContext();
        CopyHelper copyHelper = context.getCopyHelper();
        if (arg instanceof XMLDocument) {
            XMLDocument document = (XMLDocument)arg;
            DataObject dataObject = copyHelper.copy(document.getRootObject());
            return context.getXMLHelper().createDocument(dataObject,
                                                         document.getRootElementURI(),
                                                         document.getRootElementName());
        } else if (arg instanceof DataObject) {
            return context.getCopyHelper().copy((DataObject)arg);
        } else {
            return super.copy(arg);
        }
View Full Code Here

            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            QName elementName = SDOContextHelper.getElement(context);
            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

            return null;
        }
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
            XMLDocument target = streamHelper.load(source);
            source.close();
            return target;
        } catch (Exception e) {
            throw new TransformationException(e);
        }
View Full Code Here

                    name = xmlType.getElementName();
                }
            }
        }

        XMLDocument document = helperContext.getXMLHelper().createDocument(source,
                                                                           name.getNamespaceURI(),
                                                                           name.getLocalPart());
        SDODataSource dataSource = new SDODataSource(document, helperContext);
        OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
        return element;
View Full Code Here

            name = Character.toLowerCase(name.charAt(0)) + name.substring(1, name.length());
        }

        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

            // Load the stream into SDO
            // We are just using SDO as a convenient way to parse the XML config file
            HelperContext scope       = SDOUtil.createHelperContext();
            GenerateFactory.INSTANCE.register(scope);
            XMLDocument xmlDoc        = scope.getXMLHelper().load(fis);
            GenerateType generateType = (GenerateType)xmlDoc.getRootObject();

            // Get the file list. This is the list of XSD that is passed into the
            // the velocity templates. Each configured file holds a list of types
            // that the velocity templates expand into appropriate methods and method calls          
            List fileList = generateType.getInputFile();
View Full Code Here

            // Load the stream into SDO
            // We are just using SDO as a convenient way to parse the XML config file
            HelperContext scope       = SDOUtil.createHelperContext();
            GenerateFactory.INSTANCE.register(scope);
            XMLDocument xmlDoc        = scope.getXMLHelper().load(fis);
            GenerateType generateType = (GenerateType)xmlDoc.getRootObject();

            // Get the file list. This is the list of XSD that is passed into the
            // the velocity templates. Each configured file holds a list of types
            // that the velocity templates expand into appropriate methods and method calls          
            List fileList = generateType.getInputFile();
View Full Code Here

            is.read(b);
            String instanceDoc = new String(b);
           
            System.out.println(instanceDoc);

            XMLDocument doc = scope.getXMLHelper().load(
                    ClassLoader.getSystemResourceAsStream(SampleInfrastructure.COMPANY_DATAGRAPH_XML));
           
            commentary(
                "Now we can get the wrapper for the data graph, which in this case is the DataObject\n"+
                "of type commonj.sdo#DataGraph.  Note how there's no magic here;  no special class for\n"+
                "DataGraph,  no special handling,  this is just a standard pattern of using a built in SDO Type.\n"+
                "The wrapper is there purely because it was serialized\n"+
                "into the XML document, using the standard serialization technique.\n\n" +
                "DataObject dataObjectRepresentingDataGraph = doc.getRootObject();");
           
            DataObject dataObjectRepresentingDataGraph = doc.getRootObject();
            System.out.println(dataObjectRepresentingDataGraph);
           
            commentary(
                "If you are confused by the fact that what we really get is an instance of DataGraphTypeImpl\n"+
View Full Code Here

        "First we look at a data graph of a Purchase Order which has a fairly simple XML schema\n"
            + "and the graph's containment hierarchy has a couple of levels of depth");

    loadTypesFromXMLSchemaFile(scope, SampleInfrastructure.PO_XSD_RESOURCE);

    XMLDocument purchaseOrder = getXMLDocumentFromFile(scope,
        SampleInfrastructure.PO_XML_RESOURCE);

    printXMLDocument(purchaseOrder);

    commentary(COMMENTARY_ALWAYS,
View Full Code Here

TOP

Related Classes of commonj.sdo.helper.XMLDocument

Copyright © 2018 www.massapicom. 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.