Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Create from XML document
Create from XML document [message #3242] Wed, 16 October 2002 15:29 Go to next message
Eclipse UserFriend
Originally posted by: michael.hartmeier.softwareag.com

Hi,

is there any code that creates an XMLSchema instance from its XML
representation? I.e. is there a method like "public static XSDSchema
parse(InputStream src)" that reads an XML file containing an XML schema
and create the appropriate XMLSchema instance? I had a quick look at the
source code but I didn't find anything like this.

Michael
Re: Create from XML document [message #3274 is a reply to message #3242] Wed, 16 October 2002 18:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------44E3B560501CC788C56D5520
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael,

Did you look at this yet?

http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)

If you really need to create an instance directly from an input stream,
that's possible too:

Resource xsdSchemaResource =
resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);

Michael Hartmeier wrote:

> Hi,
>
> is there any code that creates an XMLSchema instance from its XML
> representation? I.e. is there a method like "public static XSDSchema
> parse(InputStream src)" that reads an XML file containing an XML schema
> and create the appropriate XMLSchema instance? I had a quick look at the
> source code but I didn't find anything like this.
>
> Michael

--
Ed Merks


--------------44E3B560501CC788C56D5520
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Michael,
<p>Did you look at this yet?
<p>&nbsp;<a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)</a>
<p>If you really need to create an instance directly from an input stream,
that's possible too:
<blockquote>&nbsp;Resource xsdSchemaResource = resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
<br>&nbsp;xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);</blockquote>

<p><br>Michael Hartmeier wrote:
<blockquote TYPE=CITE>Hi,
<p>is there any code that creates an XMLSchema instance from its XML
<br>representation? I.e. is there a method like "public static XSDSchema
<br>parse(InputStream src)" that reads an XML file containing an XML schema
<br>and create the appropriate XMLSchema instance? I had a quick look at
the
<br>source code but I didn't find anything like this.
<p>Michael</blockquote>

<p>--
<br>Ed Merks
<br>&nbsp;</html>

--------------44E3B560501CC788C56D5520--
Re: Create from XML document [message #3308 is a reply to message #3274] Thu, 17 October 2002 07:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: michael.hartmeier.softwareag.com

Thank you for the quick response!

Sorry if I still don't get it ... I had a look at the class you suggested
and the code sippet below. Doesn't this code kind of de-serialize an
XSDSchema that has previously been saved? I'm looking for a way to create
an XSDSchema from its XML representation.

The class you suggested creates two example schemas by manually creating
every XSDComponents with Java code. It's it possible to provide an XML
file with your example schema and just load and XSDSchema from this file?

Michael

Ed Merks wrote:


> --------------44E3B560501CC788C56D5520
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Michael,

> Did you look at this yet?

>
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)

> If you really need to create an instance directly from an input stream,
> that's possible too:

> Resource xsdSchemaResource =
> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);

> Michael Hartmeier wrote:

> > Hi,
> >
> > is there any code that creates an XMLSchema instance from its XML
> > representation? I.e. is there a method like "public static XSDSchema
> > parse(InputStream src)" that reads an XML file containing an XML schema
> > and create the appropriate XMLSchema instance? I had a quick look at the
> > source code but I didn't find anything like this.
> >
> > Michael

> --
> Ed Merks


> --------------44E3B560501CC788C56D5520
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Michael,
> <p>Did you look at this yet?
> <p> <a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)</a>
> <p>If you really need to create an instance directly from an input stream,
> that's possible too:
> <blockquote> Resource xsdSchemaResource =
resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> <br> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);</blockquote>

> <p><br>Michael Hartmeier wrote:
> <blockquote TYPE=CITE>Hi,
> <p>is there any code that creates an XMLSchema instance from its XML
> <br>representation? I.e. is there a method like "public static XSDSchema
> <br>parse(InputStream src)" that reads an XML file containing an XML schema
> <br>and create the appropriate XMLSchema instance? I had a quick look at
> the
> <br>source code but I didn't find anything like this.
> <p>Michael</blockquote>

> <p>--
> <br>Ed Merks
> <br> </html>

> --------------44E3B560501CC788C56D5520--
Re: Create from XML document [message #3342 is a reply to message #3308] Thu, 17 October 2002 12:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------3354C7A5B162D181E2A538C8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael,

The specific link I gave you is for a sample printSchema method that given the URI of a schema, i.e., the URI of a document containing a serialized XML representation of a schema, will print it, E.g.,

prototypicalSchema.print("file:/x:/myschema.xsd")

will load and print the indicated schema.

Your question implied that you had a stream already, so I showed how you could change the code in the sample to use an existing stream rather using the URI of an existing document. Didn't your question about having a stream imply that you have a serialized XML representation already? If you have a DOM node, you can create
an XSDSchema object (from the factory) and call setNode to populate the XSD model implied by that DOM. Maybe this is what you are asking?

Michael Hartmeier wrote:

> Thank you for the quick response!
>
> Sorry if I still don't get it ... I had a look at the class you suggested
> and the code sippet below. Doesn't this code kind of de-serialize an
> XSDSchema that has previously been saved? I'm looking for a way to create
> an XSDSchema from its XML representation.
>
> The class you suggested creates two example schemas by manually creating
> every XSDComponents with Java code. It's it possible to provide an XML
> file with your example schema and just load and XSDSchema from this file?
>
> Michael
>
> Ed Merks wrote:
>
> > --------------44E3B560501CC788C56D5520
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Michael,
>
> > Did you look at this yet?
>
> >
> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)
>
> > If you really need to create an instance directly from an input stream,
> > that's possible too:
>
> > Resource xsdSchemaResource =
> > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);
>
> > Michael Hartmeier wrote:
>
> > > Hi,
> > >
> > > is there any code that creates an XMLSchema instance from its XML
> > > representation? I.e. is there a method like "public static XSDSchema
> > > parse(InputStream src)" that reads an XML file containing an XML schema
> > > and create the appropriate XMLSchema instance? I had a quick look at the
> > > source code but I didn't find anything like this.
> > >
> > > Michael
>
> > --
> > Ed Merks
>
> > --------------44E3B560501CC788C56D5520
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Michael,
> > <p>Did you look at this yet?
> > <p> <a
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String> <p>If
> you really need to create an instance directly from an input stream,
> > that's possible too:
> > <blockquote> Resource xsdSchemaResource =
> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > <br> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);</blockquote>
>
> > <p><br>Michael Hartmeier wrote:
> > <blockquote TYPE=CITE>Hi,
> > <p>is there any code that creates an XMLSchema instance from its XML
> > <br>representation? I.e. is there a method like "public static XSDSchema
> > <br>parse(InputStream src)" that reads an XML file containing an XML schema
> > <br>and create the appropriate XMLSchema instance? I had a quick look at
> > the
> > <br>source code but I didn't find anything like this.
> > <p>Michael</blockquote>
>
> > <p>--
> > <br>Ed Merks
> > <br> </html>
>
> > --------------44E3B560501CC788C56D5520--

--
Ed Merks


--------------3354C7A5B162D181E2A538C8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Michael,
<p>The specific link I gave you is for a sample printSchema method that
given the URI of a schema, i.e., the URI of a document containing a serialized
XML representation of a schema, will print it, E.g.,
<blockquote>prototypicalSchema.print("<A HREF="file:/x:/myschema.xsd">file:/x:/myschema.xsd</A>") </blockquote>
will load and print the indicated schema.
<p>Your question implied that you had a stream already, so I showed how
you could change the code in the sample to use an existing stream rather
using the URI of an existing document.&nbsp; Didn't your question about
having a stream imply that you have a serialized XML representation already?&nbsp;
If you have a DOM node, you can create an XSDSchema object (from the factory)
and call setNode to populate the XSD model implied by that DOM.&nbsp; Maybe
this is what you are asking?&nbsp;
<p>Michael Hartmeier wrote:
<blockquote TYPE=CITE>Thank you for the quick response!
<p>Sorry if I still don't get it ... I had a look at the class you suggested
<br>and the code sippet below. Doesn't this code kind of de-serialize an
<br>XSDSchema that has previously been saved? I'm looking for a way to
create
<br>an XSDSchema from its XML representation.
<p>The class you suggested creates two example schemas by manually creating
<br>every XSDComponents with Java code. It's it possible to provide an
XML
<br>file with your example schema and just load and XSDSchema from this
file?
<p>Michael
<p>Ed Merks wrote:
<p>> --------------44E3B560501CC788C56D5520
<br>> Content-Type: text/plain; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> Michael,
<p>> Did you look at this yet?
<p>>
<br><a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)
<p>> If you really need to create an instance directly from an input stream,
<br>> that's possible too:
<p>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Resource xsdSchemaResource =
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xsdSchemaResource.load(inputStream,
Collections.EMPTY_MAP);
<p>> Michael Hartmeier wrote:
<p>> > Hi,
<br>> >
<br>> > is there any code that creates an XMLSchema instance from its XML
<br>> > representation? I.e. is there a method like "public static XSDSchema
<br>> > parse(InputStream src)" that reads an XML file containing an XML
schema
<br>> > and create the appropriate XMLSchema instance? I had a quick look
at the
<br>> > source code but I didn't find anything like this.
<br>> >
<br>> > Michael
<p>> --
<br>> Ed Merks
<p>> --------------44E3B560501CC788C56D5520
<br>> Content-Type: text/html; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> &lt;!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<br>> &lt;html>
<br>> Michael,
<br>> &lt;p>Did you look at this yet?
<br>> &lt;p> &lt;a
<br>href="<a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)"><a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>>
&lt;p>If you really need to create an instance directly from an input stream,
<br>> that's possible too:
<br>> &lt;blockquote> Resource xsdSchemaResource =
<br> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
<br>> &lt;br> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);&lt;/blockquote>
<p>> &lt;p>&lt;br>Michael Hartmeier wrote:
<br>> &lt;blockquote TYPE=CITE>Hi,
<br>> &lt;p>is there any code that creates an XMLSchema instance from its
XML
<br>> &lt;br>representation? I.e. is there a method like "public static
XSDSchema
<br>> &lt;br>parse(InputStream src)" that reads an XML file containing
an XML schema
<br>> &lt;br>and create the appropriate XMLSchema instance? I had a quick
look at
<br>> the
<br>> &lt;br>source code but I didn't find anything like this.
<br>> &lt;p>Michael&lt;/blockquote>
<p>> &lt;p>--
<br>> &lt;br>Ed Merks
<br>> &lt;br> &lt;/html>
<p>> --------------44E3B560501CC788C56D5520--</blockquote>

<p>--
<br>Ed Merks
<br>&nbsp;</html>

--------------3354C7A5B162D181E2A538C8--
Re: Create from XML document [message #3374 is a reply to message #3342] Fri, 18 October 2002 12:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: michael.hartmeier.softwareag.com

I finally manged to read and print my schema from an InputStream :-)

However, it didn't work with Resources, probably because my Classpath is
incomplete (plus: my code has to run outside of Eclise). As a work-around,
I just loaded the DOM tree and used the schema's setElement method:

doc = readDOM(inputStream); // use xerces to load DOM tree
schema = XSDFactory.eINSTANCE.createXSDSchema();
schema.setElement((Element) doc.getFirstChild());

Here's my next problems: how can I get ElementDeclaration objects for this
schema? I tried
schema.getElementDeclarations()
which returned an empty list ...

Thank you for you patience!


Michael



Ed Merks wrote:


> --------------3354C7A5B162D181E2A538C8
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Michael,

> The specific link I gave you is for a sample printSchema method that given
the URI of a schema, i.e., the URI of a document containing a serialized XML
representation of a schema, will print it, E.g.,

> prototypicalSchema.print("file:/x:/myschema.xsd")

> will load and print the indicated schema.

> Your question implied that you had a stream already, so I showed how you
could change the code in the sample to use an existing stream rather using the
URI of an existing document. Didn't your question about having a stream imply
that you have a serialized XML representation already? If you have a DOM
node, you can create
> an XSDSchema object (from the factory) and call setNode to populate the XSD
model implied by that DOM. Maybe this is what you are asking?

> Michael Hartmeier wrote:

> > Thank you for the quick response!
> >
> > Sorry if I still don't get it ... I had a look at the class you suggested
> > and the code sippet below. Doesn't this code kind of de-serialize an
> > XSDSchema that has previously been saved? I'm looking for a way to create
> > an XSDSchema from its XML representation.
> >
> > The class you suggested creates two example schemas by manually creating
> > every XSDComponents with Java code. It's it possible to provide an XML
> > file with your example schema and just load and XSDSchema from this file?
> >
> > Michael
> >
> > Ed Merks wrote:
> >
> > > --------------44E3B560501CC788C56D5520
> > > Content-Type: text/plain; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > Michael,
> >
> > > Did you look at this yet?
> >
> > >
> >
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)
> >
> > > If you really need to create an instance directly from an input stream,
> > > that's possible too:
> >
> > > Resource xsdSchemaResource =
> > > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);
> >
> > > Michael Hartmeier wrote:
> >
> > > > Hi,
> > > >
> > > > is there any code that creates an XMLSchema instance from its XML
> > > > representation? I.e. is there a method like "public static XSDSchema
> > > > parse(InputStream src)" that reads an XML file containing an XML schema
> > > > and create the appropriate XMLSchema instance? I had a quick look at
the
> > > > source code but I didn't find anything like this.
> > > >
> > > > Michael
> >
> > > --
> > > Ed Merks
> >
> > > --------------44E3B560501CC788C56D5520
> > > Content-Type: text/html; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > > <html>
> > > Michael,
> > > <p>Did you look at this yet?
> > > <p> <a
> >
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String>
<p>If
> > you really need to create an instance directly from an input stream,
> > > that's possible too:
> > > <blockquote> Resource xsdSchemaResource =
> > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > <br> xsdSchemaResource.load(inputStream,
Collections.EMPTY_MAP);</blockquote>
> >
> > > <p><br>Michael Hartmeier wrote:
> > > <blockquote TYPE=CITE>Hi,
> > > <p>is there any code that creates an XMLSchema instance from its XML
> > > <br>representation? I.e. is there a method like "public static XSDSchema
> > > <br>parse(InputStream src)" that reads an XML file containing an XML
schema
> > > <br>and create the appropriate XMLSchema instance? I had a quick look at
> > > the
> > > <br>source code but I didn't find anything like this.
> > > <p>Michael</blockquote>
> >
> > > <p>--
> > > <br>Ed Merks
> > > <br> </html>
> >
> > > --------------44E3B560501CC788C56D5520--

> --
> Ed Merks


> --------------3354C7A5B162D181E2A538C8
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Michael,
> <p>The specific link I gave you is for a sample printSchema method that
> given the URI of a schema, i.e., the URI of a document containing a
serialized
> XML representation of a schema, will print it, E.g.,
> <blockquote>prototypicalSchema.print("<A
HREF="file:/x:/myschema.xsd">file:/x:/myschema.xsd</a>") </blockquote>
> will load and print the indicated schema.
> <p>Your question implied that you had a stream already, so I showed how
> you could change the code in the sample to use an existing stream rather
> using the URI of an existing document. Didn't your question about
> having a stream imply that you have a serialized XML representation already?
> If you have a DOM node, you can create an XSDSchema object (from the factory)
> and call setNode to populate the XSD model implied by that DOM. Maybe
> this is what you are asking?
> <p>Michael Hartmeier wrote:
> <blockquote TYPE=CITE>Thank you for the quick response!
> <p>Sorry if I still don't get it ... I had a look at the class you suggested
> <br>and the code sippet below. Doesn't this code kind of de-serialize an
> <br>XSDSchema that has previously been saved? I'm looking for a way to
> create
> <br>an XSDSchema from its XML representation.
> <p>The class you suggested creates two example schemas by manually creating
> <br>every XSDComponents with Java code. It's it possible to provide an
> XML
> <br>file with your example schema and just load and XSDSchema from this
> file?
> <p>Michael
> <p>Ed Merks wrote:
> <p>> --------------44E3B560501CC788C56D5520
> <br>> Content-Type: text/plain; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> Michael,
> <p>> Did you look at this yet?
> <p>>
> <br><a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)
> <p>> If you really need to create an instance directly from an input stream,
> <br>> that's possible too:
> <p>> Resource xsdSchemaResource =
> <br>> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> <br>> xsdSchemaResource.load(inputStream,
> Collections.EMPTY_MAP);
> <p>> Michael Hartmeier wrote:
> <p>> > Hi,
> <br>> >
> <br>> > is there any code that creates an XMLSchema instance from its XML
> <br>> > representation? I.e. is there a method like "public static XSDSchema
> <br>> > parse(InputStream src)" that reads an XML file containing an XML
> schema
> <br>> > and create the appropriate XMLSchema instance? I had a quick look
> at the
> <br>> > source code but I didn't find anything like this.
> <br>> >
> <br>> > Michael
> <p>> --
> <br>> Ed Merks
> <p>> --------------44E3B560501CC788C56D5520
> <br>> Content-Type: text/html; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <br>> <html>
> <br>> Michael,
> <br>> <p>Did you look at this yet?
> <br>> <p> <a
> <br>href="<a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)"><a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>>
> <p>If you really need to create an instance directly from an input stream,
> <br>> that's possible too:
> <br>> <blockquote> Resource xsdSchemaResource =
> <br> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> <br>> <br> xsdSchemaResource.load(inputStream,
Collections.EMPTY_MAP);</blockquote>
> <p>> <p><br>Michael Hartmeier wrote:
> <br>> <blockquote TYPE=CITE>Hi,
> <br>> <p>is there any code that creates an XMLSchema instance from its
> XML
> <br>> <br>representation? I.e. is there a method like "public static
> XSDSchema
> <br>> <br>parse(InputStream src)" that reads an XML file containing
> an XML schema
> <br>> <br>and create the appropriate XMLSchema instance? I had a quick
> look at
> <br>> the
> <br>> <br>source code but I didn't find anything like this.
> <br>> <p>Michael</blockquote>
> <p>> <p>--
> <br>> <br>Ed Merks
> <br>> <br> </html>
> <p>> --------------44E3B560501CC788C56D5520--</blockquote>

> <p>--
> <br>Ed Merks
> <br> </html>

> --------------3354C7A5B162D181E2A538C8--
Re: Create from XML document [message #3408 is a reply to message #3374] Fri, 18 October 2002 17:34 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Michael,

The xsd.test plugin is designed to be a complete working example that demonstrates both headless execution and standalone execution. It includes scripts in the test subdirectory to drive the tests. The script xsd-standalone-test.bat will be relevant to you, since it drives a main method via a CLASSPATH. Getting the CLASSPATH
right is very important, including the xsd.resource.jar, since it contains the schema for schemas, and nothing works without it. The file XSDMainTest.java has more details (maybe too many). It's best to start with something that's already working and slim it down from there...

You really need to use a ResourceSet if you want imports and includes to resolve; they work by demand loading new resources into the set...


Michael Hartmeier wrote:

> I finally manged to read and print my schema from an InputStream :-)
>
> However, it didn't work with Resources, probably because my Classpath is
> incomplete (plus: my code has to run outside of Eclise). As a work-around,
> I just loaded the DOM tree and used the schema's setElement method:
>
> doc = readDOM(inputStream); // use xerces to load DOM tree
> schema = XSDFactory.eINSTANCE.createXSDSchema();
> schema.setElement((Element) doc.getFirstChild());
>
> Here's my next problems: how can I get ElementDeclaration objects for this
> schema? I tried
> schema.getElementDeclarations()
> which returned an empty list ...
>
> Thank you for you patience!
>
> Michael
>
> Ed Merks wrote:
>
> > --------------3354C7A5B162D181E2A538C8
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Michael,
>
> > The specific link I gave you is for a sample printSchema method that given
> the URI of a schema, i.e., the URI of a document containing a serialized XML
> representation of a schema, will print it, E.g.,
>
> > prototypicalSchema.print("file:/x:/myschema.xsd")
>
> > will load and print the indicated schema.
>
> > Your question implied that you had a stream already, so I showed how you
> could change the code in the sample to use an existing stream rather using the
> URI of an existing document. Didn't your question about having a stream imply
> that you have a serialized XML representation already? If you have a DOM
> node, you can create
> > an XSDSchema object (from the factory) and call setNode to populate the XSD
> model implied by that DOM. Maybe this is what you are asking?
>
> > Michael Hartmeier wrote:
>
> > > Thank you for the quick response!
> > >
> > > Sorry if I still don't get it ... I had a look at the class you suggested
> > > and the code sippet below. Doesn't this code kind of de-serialize an
> > > XSDSchema that has previously been saved? I'm looking for a way to create
> > > an XSDSchema from its XML representation.
> > >
> > > The class you suggested creates two example schemas by manually creating
> > > every XSDComponents with Java code. It's it possible to provide an XML
> > > file with your example schema and just load and XSDSchema from this file?
> > >
> > > Michael
> > >
> > > Ed Merks wrote:
> > >
> > > > --------------44E3B560501CC788C56D5520
> > > > Content-Type: text/plain; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > Michael,
> > >
> > > > Did you look at this yet?
> > >
> > > >
> > >
> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)
> > >
> > > > If you really need to create an instance directly from an input stream,
> > > > that's possible too:
> > >
> > > > Resource xsdSchemaResource =
> > > > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > > xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);
> > >
> > > > Michael Hartmeier wrote:
> > >
> > > > > Hi,
> > > > >
> > > > > is there any code that creates an XMLSchema instance from its XML
> > > > > representation? I.e. is there a method like "public static XSDSchema
> > > > > parse(InputStream src)" that reads an XML file containing an XML schema
> > > > > and create the appropriate XMLSchema instance? I had a quick look at
> the
> > > > > source code but I didn't find anything like this.
> > > > >
> > > > > Michael
> > >
> > > > --
> > > > Ed Merks
> > >
> > > > --------------44E3B560501CC788C56D5520
> > > > Content-Type: text/html; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > > > <html>
> > > > Michael,
> > > > <p>Did you look at this yet?
> > > > <p> <a
> > >
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String<p>If
> > > you really need to create an instance directly from an input stream,
> > > > that's possible too:
> > > > <blockquote> Resource xsdSchemaResource =
> > > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > > <br> xsdSchemaResource.load(inputStream,
> Collections.EMPTY_MAP);</blockquote>
> > >
> > > > <p><br>Michael Hartmeier wrote:
> > > > <blockquote TYPE=CITE>Hi,
> > > > <p>is there any code that creates an XMLSchema instance from its XML
> > > > <br>representation? I.e. is there a method like "public static XSDSchema
> > > > <br>parse(InputStream src)" that reads an XML file containing an XML
> schema
> > > > <br>and create the appropriate XMLSchema instance? I had a quick look at
> > > > the
> > > > <br>source code but I didn't find anything like this.
> > > > <p>Michael</blockquote>
> > >
> > > > <p>--
> > > > <br>Ed Merks
> > > > <br> </html>
> > >
> > > > --------------44E3B560501CC788C56D5520--
>
> > --
> > Ed Merks
>
> > --------------3354C7A5B162D181E2A538C8
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Michael,
> > <p>The specific link I gave you is for a sample printSchema method that
> > given the URI of a schema, i.e., the URI of a document containing a
> serialized
> > XML representation of a schema, will print it, E.g.,
> > <blockquote>prototypicalSchema.print("<A
> HREF="file:/x:/myschema.xsd">file:/x:/myschema.xsd</a>") </blockquote>
> > will load and print the indicated schema.
> > <p>Your question implied that you had a stream already, so I showed how
> > you could change the code in the sample to use an existing stream rather
> > using the URI of an existing document. Didn't your question about
> > having a stream imply that you have a serialized XML representation already?
> > If you have a DOM node, you can create an XSDSchema object (from the factory)
> > and call setNode to populate the XSD model implied by that DOM. Maybe
> > this is what you are asking?
> > <p>Michael Hartmeier wrote:
> > <blockquote TYPE=CITE>Thank you for the quick response!
> > <p>Sorry if I still don't get it ... I had a look at the class you suggested
> > <br>and the code sippet below. Doesn't this code kind of de-serialize an
> > <br>XSDSchema that has previously been saved? I'm looking for a way to
> > create
> > <br>an XSDSchema from its XML representation.
> > <p>The class you suggested creates two example schemas by manually creating
> > <br>every XSDComponents with Java code. It's it possible to provide an
> > XML
> > <br>file with your example schema and just load and XSDSchema from this
> > file?
> > <p>Michael
> > <p>Ed Merks wrote:
> > <p>> --------------44E3B560501CC788C56D5520
> > <br>> Content-Type: text/plain; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> Michael,
> > <p>> Did you look at this yet?
> > <p>>
> > <br><a
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String> <p>> If
> you really need to create an instance directly from an input stream,
> > <br>> that's possible too:
> > <p>> Resource xsdSchemaResource =
> > <br>> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > <br>> xsdSchemaResource.load(inputStream,
> > Collections.EMPTY_MAP);
> > <p>> Michael Hartmeier wrote:
> > <p>> > Hi,
> > <br>> >
> > <br>> > is there any code that creates an XMLSchema instance from its XML
> > <br>> > representation? I.e. is there a method like "public static XSDSchema
> > <br>> > parse(InputStream src)" that reads an XML file containing an XML
> > schema
> > <br>> > and create the appropriate XMLSchema instance? I had a quick look
> > at the
> > <br>> > source code but I didn't find anything like this.
> > <br>> >
> > <br>> > Michael
> > <p>> --
> > <br>> Ed Merks
> > <p>> --------------44E3B560501CC788C56D5520
> > <br>> Content-Type: text/html; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <br>> <html>
> > <br>> Michael,
> > <br>> <p>Did you look at this yet?
> > <br>> <p> <a
> > <br>href="<a
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>>
> <p>If you really need to create an instance directly from an input stream,
> > <br>> that's possible too:
> > <br>> <blockquote> Resource xsdSchemaResource =
> > <br> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > <br>> <br> xsdSchemaResource.load(inputStream,
> Collections.EMPTY_MAP);</blockquote>
> > <p>> <p><br>Michael Hartmeier wrote:
> > <br>> <blockquote TYPE=CITE>Hi,
> > <br>> <p>is there any code that creates an XMLSchema instance from its
> > XML
> > <br>> <br>representation? I.e. is there a method like "public static
> > XSDSchema
> > <br>> <br>parse(InputStream src)" that reads an XML file containing
> > an XML schema
> > <br>> <br>and create the appropriate XMLSchema instance? I had a quick
> > look at
> > <br>> the
> > <br>> <br>source code but I didn't find anything like this.
> > <br>> <p>Michael</blockquote>
> > <p>> <p>--
> > <br>> <br>Ed Merks
> > <br>> <br> </html>
> > <p>> --------------44E3B560501CC788C56D5520--</blockquote>
>
> > <p>--
> > <br>Ed Merks
> > <br> </html>
>
> > --------------3354C7A5B162D181E2A538C8--

--
Ed Merks
Re: Create from XML document [message #562943 is a reply to message #3242] Wed, 16 October 2002 18:14 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
--------------44E3B560501CC788C56D5520
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael,

Did you look at this yet?

http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)

If you really need to create an instance directly from an input stream,
that's possible too:

Resource xsdSchemaResource =
resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);

Michael Hartmeier wrote:

> Hi,
>
> is there any code that creates an XMLSchema instance from its XML
> representation? I.e. is there a method like "public static XSDSchema
> parse(InputStream src)" that reads an XML file containing an XML schema
> and create the appropriate XMLSchema instance? I had a quick look at the
> source code but I didn't find anything like this.
>
> Michael

--
Ed Merks


--------------44E3B560501CC788C56D5520
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Michael,
<p>Did you look at this yet?
<p>&nbsp;<a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)</a>
<p>If you really need to create an instance directly from an input stream,
that's possible too:
<blockquote>&nbsp;Resource xsdSchemaResource = resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
<br>&nbsp;xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);</blockquote>

<p><br>Michael Hartmeier wrote:
<blockquote TYPE=CITE>Hi,
<p>is there any code that creates an XMLSchema instance from its XML
<br>representation? I.e. is there a method like "public static XSDSchema
<br>parse(InputStream src)" that reads an XML file containing an XML schema
<br>and create the appropriate XMLSchema instance? I had a quick look at
the
<br>source code but I didn't find anything like this.
<p>Michael</blockquote>

<p>--
<br>Ed Merks
<br>&nbsp;</html>

--------------44E3B560501CC788C56D5520--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Create from XML document [message #562974 is a reply to message #3274] Thu, 17 October 2002 07:57 Go to previous message
Michael Hartmeier is currently offline Michael HartmeierFriend
Messages: 21
Registered: July 2009
Junior Member
Thank you for the quick response!

Sorry if I still don't get it ... I had a look at the class you suggested
and the code sippet below. Doesn't this code kind of de-serialize an
XSDSchema that has previously been saved? I'm looking for a way to create
an XSDSchema from its XML representation.

The class you suggested creates two example schemas by manually creating
every XSDComponents with Java code. It's it possible to provide an XML
file with your example schema and just load and XSDSchema from this file?

Michael

Ed Merks wrote:


> --------------44E3B560501CC788C56D5520
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Michael,

> Did you look at this yet?

>
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)

> If you really need to create an instance directly from an input stream,
> that's possible too:

> Resource xsdSchemaResource =
> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);

> Michael Hartmeier wrote:

> > Hi,
> >
> > is there any code that creates an XMLSchema instance from its XML
> > representation? I.e. is there a method like "public static XSDSchema
> > parse(InputStream src)" that reads an XML file containing an XML schema
> > and create the appropriate XMLSchema instance? I had a quick look at the
> > source code but I didn't find anything like this.
> >
> > Michael

> --
> Ed Merks


> --------------44E3B560501CC788C56D5520
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Michael,
> <p>Did you look at this yet?
> <p> <a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)</a>
> <p>If you really need to create an instance directly from an input stream,
> that's possible too:
> <blockquote> Resource xsdSchemaResource =
resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> <br> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);</blockquote>

> <p><br>Michael Hartmeier wrote:
> <blockquote TYPE=CITE>Hi,
> <p>is there any code that creates an XMLSchema instance from its XML
> <br>representation? I.e. is there a method like "public static XSDSchema
> <br>parse(InputStream src)" that reads an XML file containing an XML schema
> <br>and create the appropriate XMLSchema instance? I had a quick look at
> the
> <br>source code but I didn't find anything like this.
> <p>Michael</blockquote>

> <p>--
> <br>Ed Merks
> <br> </html>

> --------------44E3B560501CC788C56D5520--
Re: Create from XML document [message #563000 is a reply to message #3308] Thu, 17 October 2002 12:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
--------------3354C7A5B162D181E2A538C8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael,

The specific link I gave you is for a sample printSchema method that given the URI of a schema, i.e., the URI of a document containing a serialized XML representation of a schema, will print it, E.g.,

prototypicalSchema.print("file:/x:/myschema.xsd")

will load and print the indicated schema.

Your question implied that you had a stream already, so I showed how you could change the code in the sample to use an existing stream rather using the URI of an existing document. Didn't your question about having a stream imply that you have a serialized XML representation already? If you have a DOM node, you can create
an XSDSchema object (from the factory) and call setNode to populate the XSD model implied by that DOM. Maybe this is what you are asking?

Michael Hartmeier wrote:

> Thank you for the quick response!
>
> Sorry if I still don't get it ... I had a look at the class you suggested
> and the code sippet below. Doesn't this code kind of de-serialize an
> XSDSchema that has previously been saved? I'm looking for a way to create
> an XSDSchema from its XML representation.
>
> The class you suggested creates two example schemas by manually creating
> every XSDComponents with Java code. It's it possible to provide an XML
> file with your example schema and just load and XSDSchema from this file?
>
> Michael
>
> Ed Merks wrote:
>
> > --------------44E3B560501CC788C56D5520
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Michael,
>
> > Did you look at this yet?
>
> >
> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)
>
> > If you really need to create an instance directly from an input stream,
> > that's possible too:
>
> > Resource xsdSchemaResource =
> > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);
>
> > Michael Hartmeier wrote:
>
> > > Hi,
> > >
> > > is there any code that creates an XMLSchema instance from its XML
> > > representation? I.e. is there a method like "public static XSDSchema
> > > parse(InputStream src)" that reads an XML file containing an XML schema
> > > and create the appropriate XMLSchema instance? I had a quick look at the
> > > source code but I didn't find anything like this.
> > >
> > > Michael
>
> > --
> > Ed Merks
>
> > --------------44E3B560501CC788C56D5520
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Michael,
> > <p>Did you look at this yet?
> > <p> <a
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String> <p>If
> you really need to create an instance directly from an input stream,
> > that's possible too:
> > <blockquote> Resource xsdSchemaResource =
> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > <br> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);</blockquote>
>
> > <p><br>Michael Hartmeier wrote:
> > <blockquote TYPE=CITE>Hi,
> > <p>is there any code that creates an XMLSchema instance from its XML
> > <br>representation? I.e. is there a method like "public static XSDSchema
> > <br>parse(InputStream src)" that reads an XML file containing an XML schema
> > <br>and create the appropriate XMLSchema instance? I had a quick look at
> > the
> > <br>source code but I didn't find anything like this.
> > <p>Michael</blockquote>
>
> > <p>--
> > <br>Ed Merks
> > <br> </html>
>
> > --------------44E3B560501CC788C56D5520--

--
Ed Merks


--------------3354C7A5B162D181E2A538C8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Michael,
<p>The specific link I gave you is for a sample printSchema method that
given the URI of a schema, i.e., the URI of a document containing a serialized
XML representation of a schema, will print it, E.g.,
<blockquote>prototypicalSchema.print("<A HREF="file:/x:/myschema.xsd">file:/x:/myschema.xsd</A>") </blockquote>
will load and print the indicated schema.
<p>Your question implied that you had a stream already, so I showed how
you could change the code in the sample to use an existing stream rather
using the URI of an existing document.&nbsp; Didn't your question about
having a stream imply that you have a serialized XML representation already?&nbsp;
If you have a DOM node, you can create an XSDSchema object (from the factory)
and call setNode to populate the XSD model implied by that DOM.&nbsp; Maybe
this is what you are asking?&nbsp;
<p>Michael Hartmeier wrote:
<blockquote TYPE=CITE>Thank you for the quick response!
<p>Sorry if I still don't get it ... I had a look at the class you suggested
<br>and the code sippet below. Doesn't this code kind of de-serialize an
<br>XSDSchema that has previously been saved? I'm looking for a way to
create
<br>an XSDSchema from its XML representation.
<p>The class you suggested creates two example schemas by manually creating
<br>every XSDComponents with Java code. It's it possible to provide an
XML
<br>file with your example schema and just load and XSDSchema from this
file?
<p>Michael
<p>Ed Merks wrote:
<p>> --------------44E3B560501CC788C56D5520
<br>> Content-Type: text/plain; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> Michael,
<p>> Did you look at this yet?
<p>>
<br><a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)
<p>> If you really need to create an instance directly from an input stream,
<br>> that's possible too:
<p>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Resource xsdSchemaResource =
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xsdSchemaResource.load(inputStream,
Collections.EMPTY_MAP);
<p>> Michael Hartmeier wrote:
<p>> > Hi,
<br>> >
<br>> > is there any code that creates an XMLSchema instance from its XML
<br>> > representation? I.e. is there a method like "public static XSDSchema
<br>> > parse(InputStream src)" that reads an XML file containing an XML
schema
<br>> > and create the appropriate XMLSchema instance? I had a quick look
at the
<br>> > source code but I didn't find anything like this.
<br>> >
<br>> > Michael
<p>> --
<br>> Ed Merks
<p>> --------------44E3B560501CC788C56D5520
<br>> Content-Type: text/html; charset=us-ascii
<br>> Content-Transfer-Encoding: 7bit
<p>> &lt;!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<br>> &lt;html>
<br>> Michael,
<br>> &lt;p>Did you look at this yet?
<br>> &lt;p> &lt;a
<br>href="<a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)"><a href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>>
&lt;p>If you really need to create an instance directly from an input stream,
<br>> that's possible too:
<br>> &lt;blockquote> Resource xsdSchemaResource =
<br> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
<br>> &lt;br> xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);&lt;/blockquote>
<p>> &lt;p>&lt;br>Michael Hartmeier wrote:
<br>> &lt;blockquote TYPE=CITE>Hi,
<br>> &lt;p>is there any code that creates an XMLSchema instance from its
XML
<br>> &lt;br>representation? I.e. is there a method like "public static
XSDSchema
<br>> &lt;br>parse(InputStream src)" that reads an XML file containing
an XML schema
<br>> &lt;br>and create the appropriate XMLSchema instance? I had a quick
look at
<br>> the
<br>> &lt;br>source code but I didn't find anything like this.
<br>> &lt;p>Michael&lt;/blockquote>
<p>> &lt;p>--
<br>> &lt;br>Ed Merks
<br>> &lt;br> &lt;/html>
<p>> --------------44E3B560501CC788C56D5520--</blockquote>

<p>--
<br>Ed Merks
<br>&nbsp;</html>

--------------3354C7A5B162D181E2A538C8--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Create from XML document [message #563031 is a reply to message #3342] Fri, 18 October 2002 12:41 Go to previous message
Michael Hartmeier is currently offline Michael HartmeierFriend
Messages: 21
Registered: July 2009
Junior Member
I finally manged to read and print my schema from an InputStream :-)

However, it didn't work with Resources, probably because my Classpath is
incomplete (plus: my code has to run outside of Eclise). As a work-around,
I just loaded the DOM tree and used the schema's setElement method:

doc = readDOM(inputStream); // use xerces to load DOM tree
schema = XSDFactory.eINSTANCE.createXSDSchema();
schema.setElement((Element) doc.getFirstChild());

Here's my next problems: how can I get ElementDeclaration objects for this
schema? I tried
schema.getElementDeclarations()
which returned an empty list ...

Thank you for you patience!


Michael



Ed Merks wrote:


> --------------3354C7A5B162D181E2A538C8
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Michael,

> The specific link I gave you is for a sample printSchema method that given
the URI of a schema, i.e., the URI of a document containing a serialized XML
representation of a schema, will print it, E.g.,

> prototypicalSchema.print("file:/x:/myschema.xsd")

> will load and print the indicated schema.

> Your question implied that you had a stream already, so I showed how you
could change the code in the sample to use an existing stream rather using the
URI of an existing document. Didn't your question about having a stream imply
that you have a serialized XML representation already? If you have a DOM
node, you can create
> an XSDSchema object (from the factory) and call setNode to populate the XSD
model implied by that DOM. Maybe this is what you are asking?

> Michael Hartmeier wrote:

> > Thank you for the quick response!
> >
> > Sorry if I still don't get it ... I had a look at the class you suggested
> > and the code sippet below. Doesn't this code kind of de-serialize an
> > XSDSchema that has previously been saved? I'm looking for a way to create
> > an XSDSchema from its XML representation.
> >
> > The class you suggested creates two example schemas by manually creating
> > every XSDComponents with Java code. It's it possible to provide an XML
> > file with your example schema and just load and XSDSchema from this file?
> >
> > Michael
> >
> > Ed Merks wrote:
> >
> > > --------------44E3B560501CC788C56D5520
> > > Content-Type: text/plain; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > Michael,
> >
> > > Did you look at this yet?
> >
> > >
> >
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)
> >
> > > If you really need to create an instance directly from an input stream,
> > > that's possible too:
> >
> > > Resource xsdSchemaResource =
> > > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);
> >
> > > Michael Hartmeier wrote:
> >
> > > > Hi,
> > > >
> > > > is there any code that creates an XMLSchema instance from its XML
> > > > representation? I.e. is there a method like "public static XSDSchema
> > > > parse(InputStream src)" that reads an XML file containing an XML schema
> > > > and create the appropriate XMLSchema instance? I had a quick look at
the
> > > > source code but I didn't find anything like this.
> > > >
> > > > Michael
> >
> > > --
> > > Ed Merks
> >
> > > --------------44E3B560501CC788C56D5520
> > > Content-Type: text/html; charset=us-ascii
> > > Content-Transfer-Encoding: 7bit
> >
> > > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > > <html>
> > > Michael,
> > > <p>Did you look at this yet?
> > > <p> <a
> >
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String>
<p>If
> > you really need to create an instance directly from an input stream,
> > > that's possible too:
> > > <blockquote> Resource xsdSchemaResource =
> > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > <br> xsdSchemaResource.load(inputStream,
Collections.EMPTY_MAP);</blockquote>
> >
> > > <p><br>Michael Hartmeier wrote:
> > > <blockquote TYPE=CITE>Hi,
> > > <p>is there any code that creates an XMLSchema instance from its XML
> > > <br>representation? I.e. is there a method like "public static XSDSchema
> > > <br>parse(InputStream src)" that reads an XML file containing an XML
schema
> > > <br>and create the appropriate XMLSchema instance? I had a quick look at
> > > the
> > > <br>source code but I didn't find anything like this.
> > > <p>Michael</blockquote>
> >
> > > <p>--
> > > <br>Ed Merks
> > > <br> </html>
> >
> > > --------------44E3B560501CC788C56D5520--

> --
> Ed Merks


> --------------3354C7A5B162D181E2A538C8
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Michael,
> <p>The specific link I gave you is for a sample printSchema method that
> given the URI of a schema, i.e., the URI of a document containing a
serialized
> XML representation of a schema, will print it, E.g.,
> <blockquote>prototypicalSchema.print("<A
HREF="file:/x:/myschema.xsd">file:/x:/myschema.xsd</a>") </blockquote>
> will load and print the indicated schema.
> <p>Your question implied that you had a stream already, so I showed how
> you could change the code in the sample to use an existing stream rather
> using the URI of an existing document. Didn't your question about
> having a stream imply that you have a serialized XML representation already?
> If you have a DOM node, you can create an XSDSchema object (from the factory)
> and call setNode to populate the XSD model implied by that DOM. Maybe
> this is what you are asking?
> <p>Michael Hartmeier wrote:
> <blockquote TYPE=CITE>Thank you for the quick response!
> <p>Sorry if I still don't get it ... I had a look at the class you suggested
> <br>and the code sippet below. Doesn't this code kind of de-serialize an
> <br>XSDSchema that has previously been saved? I'm looking for a way to
> create
> <br>an XSDSchema from its XML representation.
> <p>The class you suggested creates two example schemas by manually creating
> <br>every XSDComponents with Java code. It's it possible to provide an
> XML
> <br>file with your example schema and just load and XSDSchema from this
> file?
> <p>Michael
> <p>Ed Merks wrote:
> <p>> --------------44E3B560501CC788C56D5520
> <br>> Content-Type: text/plain; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> Michael,
> <p>> Did you look at this yet?
> <p>>
> <br><a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)
> <p>> If you really need to create an instance directly from an input stream,
> <br>> that's possible too:
> <p>> Resource xsdSchemaResource =
> <br>> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> <br>> xsdSchemaResource.load(inputStream,
> Collections.EMPTY_MAP);
> <p>> Michael Hartmeier wrote:
> <p>> > Hi,
> <br>> >
> <br>> > is there any code that creates an XMLSchema instance from its XML
> <br>> > representation? I.e. is there a method like "public static XSDSchema
> <br>> > parse(InputStream src)" that reads an XML file containing an XML
> schema
> <br>> > and create the appropriate XMLSchema instance? I had a quick look
> at the
> <br>> > source code but I didn't find anything like this.
> <br>> >
> <br>> > Michael
> <p>> --
> <br>> Ed Merks
> <p>> --------------44E3B560501CC788C56D5520
> <br>> Content-Type: text/html; charset=us-ascii
> <br>> Content-Transfer-Encoding: 7bit
> <p>> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <br>> <html>
> <br>> Michael,
> <br>> <p>Did you look at this yet?
> <br>> <p> <a
> <br>href="<a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>)"><a
href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>>
> <p>If you really need to create an instance directly from an input stream,
> <br>> that's possible too:
> <br>> <blockquote> Resource xsdSchemaResource =
> <br> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> <br>> <br> xsdSchemaResource.load(inputStream,
Collections.EMPTY_MAP);</blockquote>
> <p>> <p><br>Michael Hartmeier wrote:
> <br>> <blockquote TYPE=CITE>Hi,
> <br>> <p>is there any code that creates an XMLSchema instance from its
> XML
> <br>> <br>representation? I.e. is there a method like "public static
> XSDSchema
> <br>> <br>parse(InputStream src)" that reads an XML file containing
> an XML schema
> <br>> <br>and create the appropriate XMLSchema instance? I had a quick
> look at
> <br>> the
> <br>> <br>source code but I didn't find anything like this.
> <br>> <p>Michael</blockquote>
> <p>> <p>--
> <br>> <br>Ed Merks
> <br>> <br> </html>
> <p>> --------------44E3B560501CC788C56D5520--</blockquote>

> <p>--
> <br>Ed Merks
> <br> </html>

> --------------3354C7A5B162D181E2A538C8--
Re: Create from XML document [message #563057 is a reply to message #3374] Fri, 18 October 2002 17:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Michael,

The xsd.test plugin is designed to be a complete working example that demonstrates both headless execution and standalone execution. It includes scripts in the test subdirectory to drive the tests. The script xsd-standalone-test.bat will be relevant to you, since it drives a main method via a CLASSPATH. Getting the CLASSPATH
right is very important, including the xsd.resource.jar, since it contains the schema for schemas, and nothing works without it. The file XSDMainTest.java has more details (maybe too many). It's best to start with something that's already working and slim it down from there...

You really need to use a ResourceSet if you want imports and includes to resolve; they work by demand loading new resources into the set...


Michael Hartmeier wrote:

> I finally manged to read and print my schema from an InputStream :-)
>
> However, it didn't work with Resources, probably because my Classpath is
> incomplete (plus: my code has to run outside of Eclise). As a work-around,
> I just loaded the DOM tree and used the schema's setElement method:
>
> doc = readDOM(inputStream); // use xerces to load DOM tree
> schema = XSDFactory.eINSTANCE.createXSDSchema();
> schema.setElement((Element) doc.getFirstChild());
>
> Here's my next problems: how can I get ElementDeclaration objects for this
> schema? I tried
> schema.getElementDeclarations()
> which returned an empty list ...
>
> Thank you for you patience!
>
> Michael
>
> Ed Merks wrote:
>
> > --------------3354C7A5B162D181E2A538C8
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > Michael,
>
> > The specific link I gave you is for a sample printSchema method that given
> the URI of a schema, i.e., the URI of a document containing a serialized XML
> representation of a schema, will print it, E.g.,
>
> > prototypicalSchema.print("file:/x:/myschema.xsd")
>
> > will load and print the indicated schema.
>
> > Your question implied that you had a stream already, so I showed how you
> could change the code in the sample to use an existing stream rather using the
> URI of an existing document. Didn't your question about having a stream imply
> that you have a serialized XML representation already? If you have a DOM
> node, you can create
> > an XSDSchema object (from the factory) and call setNode to populate the XSD
> model implied by that DOM. Maybe this is what you are asking?
>
> > Michael Hartmeier wrote:
>
> > > Thank you for the quick response!
> > >
> > > Sorry if I still don't get it ... I had a look at the class you suggested
> > > and the code sippet below. Doesn't this code kind of de-serialize an
> > > XSDSchema that has previously been saved? I'm looking for a way to create
> > > an XSDSchema from its XML representation.
> > >
> > > The class you suggested creates two example schemas by manually creating
> > > every XSDComponents with Java code. It's it possible to provide an XML
> > > file with your example schema and just load and XSDSchema from this file?
> > >
> > > Michael
> > >
> > > Ed Merks wrote:
> > >
> > > > --------------44E3B560501CC788C56D5520
> > > > Content-Type: text/plain; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > Michael,
> > >
> > > > Did you look at this yet?
> > >
> > > >
> > >
> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)
> > >
> > > > If you really need to create an instance directly from an input stream,
> > > > that's possible too:
> > >
> > > > Resource xsdSchemaResource =
> > > > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > > xsdSchemaResource.load(inputStream, Collections.EMPTY_MAP);
> > >
> > > > Michael Hartmeier wrote:
> > >
> > > > > Hi,
> > > > >
> > > > > is there any code that creates an XMLSchema instance from its XML
> > > > > representation? I.e. is there a method like "public static XSDSchema
> > > > > parse(InputStream src)" that reads an XML file containing an XML schema
> > > > > and create the appropriate XMLSchema instance? I had a quick look at
> the
> > > > > source code but I didn't find anything like this.
> > > > >
> > > > > Michael
> > >
> > > > --
> > > > Ed Merks
> > >
> > > > --------------44E3B560501CC788C56D5520
> > > > Content-Type: text/html; charset=us-ascii
> > > > Content-Transfer-Encoding: 7bit
> > >
> > > > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > > > <html>
> > > > Michael,
> > > > <p>Did you look at this yet?
> > > > <p> <a
> > >
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String)"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String<p>If
> > > you really need to create an instance directly from an input stream,
> > > > that's possible too:
> > > > <blockquote> Resource xsdSchemaResource =
> > > resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > > > <br> xsdSchemaResource.load(inputStream,
> Collections.EMPTY_MAP);</blockquote>
> > >
> > > > <p><br>Michael Hartmeier wrote:
> > > > <blockquote TYPE=CITE>Hi,
> > > > <p>is there any code that creates an XMLSchema instance from its XML
> > > > <br>representation? I.e. is there a method like "public static XSDSchema
> > > > <br>parse(InputStream src)" that reads an XML file containing an XML
> schema
> > > > <br>and create the appropriate XMLSchema instance? I had a quick look at
> > > > the
> > > > <br>source code but I didn't find anything like this.
> > > > <p>Michael</blockquote>
> > >
> > > > <p>--
> > > > <br>Ed Merks
> > > > <br> </html>
> > >
> > > > --------------44E3B560501CC788C56D5520--
>
> > --
> > Ed Merks
>
> > --------------3354C7A5B162D181E2A538C8
> > Content-Type: text/html; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Michael,
> > <p>The specific link I gave you is for a sample printSchema method that
> > given the URI of a schema, i.e., the URI of a document containing a
> serialized
> > XML representation of a schema, will print it, E.g.,
> > <blockquote>prototypicalSchema.print("<A
> HREF="file:/x:/myschema.xsd">file:/x:/myschema.xsd</a>") </blockquote>
> > will load and print the indicated schema.
> > <p>Your question implied that you had a stream already, so I showed how
> > you could change the code in the sample to use an existing stream rather
> > using the URI of an existing document. Didn't your question about
> > having a stream imply that you have a serialized XML representation already?
> > If you have a DOM node, you can create an XSDSchema object (from the factory)
> > and call setNode to populate the XSD model implied by that DOM. Maybe
> > this is what you are asking?
> > <p>Michael Hartmeier wrote:
> > <blockquote TYPE=CITE>Thank you for the quick response!
> > <p>Sorry if I still don't get it ... I had a look at the class you suggested
> > <br>and the code sippet below. Doesn't this code kind of de-serialize an
> > <br>XSDSchema that has previously been saved? I'm looking for a way to
> > create
> > <br>an XSDSchema from its XML representation.
> > <p>The class you suggested creates two example schemas by manually creating
> > <br>every XSDComponents with Java code. It's it possible to provide an
> > XML
> > <br>file with your example schema and just load and XSDSchema from this
> > file?
> > <p>Michael
> > <p>Ed Merks wrote:
> > <p>> --------------44E3B560501CC788C56D5520
> > <br>> Content-Type: text/plain; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> Michael,
> > <p>> Did you look at this yet?
> > <p>>
> > <br><a
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String> <p>> If
> you really need to create an instance directly from an input stream,
> > <br>> that's possible too:
> > <p>> Resource xsdSchemaResource =
> > <br>> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > <br>> xsdSchemaResource.load(inputStream,
> > Collections.EMPTY_MAP);
> > <p>> Michael Hartmeier wrote:
> > <p>> > Hi,
> > <br>> >
> > <br>> > is there any code that creates an XMLSchema instance from its XML
> > <br>> > representation? I.e. is there a method like "public static XSDSchema
> > <br>> > parse(InputStream src)" that reads an XML file containing an XML
> > schema
> > <br>> > and create the appropriate XMLSchema instance? I had a quick look
> > at the
> > <br>> > source code but I didn't find anything like this.
> > <br>> >
> > <br>> > Michael
> > <p>> --
> > <br>> Ed Merks
> > <p>> --------------44E3B560501CC788C56D5520
> > <br>> Content-Type: text/html; charset=us-ascii
> > <br>> Content-Transfer-Encoding: 7bit
> > <p>> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <br>> <html>
> > <br>> Michael,
> > <br>> <p>Did you look at this yet?
> > <br>> <p> <a
> > <br>href="<a
> href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>href=" http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String"> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/xsd- home/docs/javadoc/org/eclipse/xsd/util/XSDPrototypicalSchema .html#printSchema(java.lang.String</a>>
> <p>If you really need to create an instance directly from an input stream,
> > <br>> that's possible too:
> > <br>> <blockquote> Resource xsdSchemaResource =
> > <br> resourceSet.createResource(URI.createDeviceURI(xsdSchemaURI) );
> > <br>> <br> xsdSchemaResource.load(inputStream,
> Collections.EMPTY_MAP);</blockquote>
> > <p>> <p><br>Michael Hartmeier wrote:
> > <br>> <blockquote TYPE=CITE>Hi,
> > <br>> <p>is there any code that creates an XMLSchema instance from its
> > XML
> > <br>> <br>representation? I.e. is there a method like "public static
> > XSDSchema
> > <br>> <br>parse(InputStream src)" that reads an XML file containing
> > an XML schema
> > <br>> <br>and create the appropriate XMLSchema instance? I had a quick
> > look at
> > <br>> the
> > <br>> <br>source code but I didn't find anything like this.
> > <br>> <p>Michael</blockquote>
> > <p>> <p>--
> > <br>> <br>Ed Merks
> > <br>> <br> </html>
> > <p>> --------------44E3B560501CC788C56D5520--</blockquote>
>
> > <p>--
> > <br>Ed Merks
> > <br> </html>
>
> > --------------3354C7A5B162D181E2A538C8--

--
Ed Merks


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Create from XML document
Next Topic:First schema loading time
Goto Forum:
  


Current Time: Fri Apr 26 02:25:38 GMT 2024

Powered by FUDForum. Page generated in 0.05055 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top