SDO

 

XML -> SDO Object

            ResourceSet resourceSet = new ResourceSetImpl();
            resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
                .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());

           

            resourceSet.getPackageRegistry().put(V2PackageImpl.eNS_URI,  
                                                 V2PackageImpl.eINSTANCE);
           
            URI uri = URI.createFileURI(new File("c:/response.xml")  
            .getAbsolutePath());  

            Resource resource = resourceSet.createResource(uri);
            resource.load(null);

 

object-> XML

 

     resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put
            (Resource.Factory.Registry.DEFAULT_EXTENSION,
             new V2ResourceFactoryImpl());
        resourceSet.getPackageRegistry().put(V2PackageImpl.eNS_URI, V2PackageImpl.eINSTANCE);

  

            try {
                Resource resource = resourceSet.createResource(URI.createURI("http:///My.v2"));
                DocumentRoot documentRoot = V2FactoryImpl.eINSTANCE.createDocumentRoot();
               
                documentRoot.setRetrieveConsolidatedPartyIdentifiersResponse(response);
                resource.getContents().add(documentRoot);
                resource.save(System.out, null);
            }
            catch (IOException exception) {
                exception.printStackTrace();
            }

你可能感兴趣的:(C++,c,xml,C#)