Load XSDSchema from DOM rather than file [message #60456] |
Mon, 02 May 2005 22:23 |
Eclipse User |
|
|
|
Originally posted by: gvv_.pe.com
Hi,
I usually create an XSDSchema object from a file resource:
XSDSchema schema = xsdResource.getSchema();
where xsdResource is created from a resourceSet.
In this case all I have is a DOM Node that corresponds to the root of a
schema document that has already been parsed in.
is it possible to create an XSDSchema object using a DOM Node as input?
Thanks
Gary
|
|
|
Re: Load XSDSchema from DOM rather than file [message #60476 is a reply to message #60456] |
Mon, 02 May 2005 22:32 |
Eclipse User |
|
|
|
Originally posted by: gvv_.pe.com
I think I found the answer to my question by downloading a few more headers
from this newsgroup.
There's a method in XSDPrototypicalSchema that seems to do just what I want.
Here's a copy for anyone else who's looking for the same thing.
// Create a schema from an element.
public XSDSchema createSchema(org.w3c.dom.Element element)
{
// Test if the element is really a schema element.
//
if (element.getLocalName().equals("schema")
&& XSDConstants.isSchemaForSchemaNamespace(element.getNamespace URI()))
{
// Create the schema.
//
XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
// Set the element to the schema.
// This it will build the corresponding component structure.
//
xsdSchema.setElement(element);
return xsdSchema;
}
else
{
return null;
}
"Gary J" <gvv_@pe.com> wrote in message
news:d569jm$3cr$1@news.eclipse.org...
Hi,
I usually create an XSDSchema object from a file resource:
XSDSchema schema = xsdResource.getSchema();
where xsdResource is created from a resourceSet.
In this case all I have is a DOM Node that corresponds to the root of a
schema document that has already been parsed in.
is it possible to create an XSDSchema object using a DOM Node as input?
Thanks
Gary
|
|
|
|
Powered by
FUDForum. Page generated in 0.03521 seconds