/** * Loads a new {@link XSDResourceImpl} into the resource set. * @param inputStream the contents of the new resource. * @param options any options to influence loading behavior. */ @Override protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException { InputSource inputSource = inputStream instanceof URIConverter.ReadableInputStream ? new InputSource(((URIConverter.ReadableInputStream)inputStream).asReader()) : new InputSource(inputStream); if (getURI() != null) { String id = getURI().toString(); inputSource.setPublicId(id); inputSource.setSystemId(id); } doLoad(inputSource, options); }
public ReadableInputStream(String xmlString) { this(new StringReader(xmlString), getEncoding(xmlString)); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ public static StrucDocText createStrucDocText(Section section, String xmlString) { StrucDocText text = null; try { Resource.Factory factory = new GenericXMLResourceFactoryImpl(); XMLResource resource = (XMLResource) factory.createResource(null); resource.load(new URIConverter.ReadableInputStream("<text>" + xmlString + "</text>"), null); XMLTypeDocumentRoot root = (XMLTypeDocumentRoot) resource.getContents().get(0); AnyType value = (AnyType) root.getMixed().getValue(0); text = CDAFactory.eINSTANCE.createStrucDocText(); text.getMixed().addAll(value.getMixed()); section.setText(text); } catch (Exception e) { } return text; }
/** * Loads a new {@link XSDResourceImpl} into the resource set. * @param inputStream the contents of the new resource. * @param options any options to influence loading behavior. * @return a new XSDResourceImpl. */ @Override protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException { InputSource inputSource = inputStream instanceof URIConverter.ReadableInputStream ? new InputSource(((URIConverter.ReadableInputStream)inputStream).asReader()) : new InputSource(inputStream); if (getURI() != null) { String id = getURI().toString(); inputSource.setPublicId(id); inputSource.setSystemId(id); } doLoad(inputSource, options); }
/** * Loads a new {@link WSDLResourceImpl} into the resource set. * @param inputStream the contents of the new resource. * @param options any options to influence loading behavior. */ protected void doLoad(InputStream inputStream, Map options) throws IOException { InputSource inputSource = inputStream instanceof URIConverter.ReadableInputStream ? new InputSource( ((URIConverter.ReadableInputStream)inputStream).asReader()) : new InputSource(inputStream); if (getURI() != null) { String id = getURI().toString(); inputSource.setPublicId(id); inputSource.setSystemId(id); } doLoad(inputSource, options); }
public static EObject loadEObjectFromString(String myModelXml, EPackage ePackage) throws IOException { // Create a ResourceSet ResourceSet resourceSet = new ResourceSetImpl(); // register XMIRegistryResourceFactoryIml resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put (Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); // register your epackage to the resource set so it has a reference to your ecore // you can get an instance to your epackage by calling YourEPackageClass.getInstace(); resourceSet.getPackageRegistry().put(ePackage.getNsURI(), ePackage); Resource resource = resourceSet.createResource(URI.createURI("*.modelextension")); resource.load(new URIConverter.ReadableInputStream(myModelXml), null); // return the root model object and there you have it, all you need is to // cast it to the right EObject based on your model return resource.getContents().get(0); }
public int describe(Reader reader, IContentDescription description) throws IOException { return describe(new URIConverter.ReadableInputStream(reader), description); }
public ReadableInputStream(String xmlString) { this(new StringReader(xmlString), getEncoding(xmlString)); }
public int describe(Reader reader, IContentDescription description) throws IOException { return describe(new URIConverter.ReadableInputStream(reader), description); }
/** * @since 2.4 */ public ReadableInputStream(Reader xmlReader) { super(); this.reader = xmlReader.markSupported() ? xmlReader : new BufferedReader(xmlReader); this.encoding = getEncoding(this.reader); }
/** * @since 2.4 */ public ReadableInputStream(Reader xmlReader) { super(); this.reader = xmlReader.markSupported() ? xmlReader : new BufferedReader(xmlReader); this.encoding = getEncoding(this.reader); }