Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Creating XSDSchema from DOM Element
Creating XSDSchema from DOM Element [message #24629] Mon, 07 July 2003 18:22 Go to next message
Eclipse UserFriend
Originally posted by: cipher8000.yahoo.com

Hi,

I am looking for a way to create the XSDSchema from an DOM Element. For
example:

Here is my schema would look like:

<definitions name="FlowSample" targetNamespace="http://samples.cxdn.com"
xmlns:tns="http://samples.cxdn.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s1="http://www.autoloan.com/ns/autoloan"
>
<types>
<schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://www.autoloan.com/ns/autoloan"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="LoanApplication">
<sequence>
<element name="SSN" type="string"/>
<element name="Email" type="string"/>
<element name="CustomerName" type="string"/>
<element name="LoanAmount" type="double"/>
<element name="CarModel" type="string"/>
<element name="CarYear" type="string"/>
<element name="CreditRating" type="int"/>
</sequence>
</complexType>
</schema>
</types>
....
</definitions>

I use WSDL4J's Types to extract the <schema> DOM Element and now i want to
construct
XSDSchema from that DOM Element.

Is there any util API for constructing XSDSchema from an Element?

-Muruga
Re: Creating XSDSchema from DOM Element [message #24666 is a reply to message #24629] Mon, 07 July 2003 18:37 Go to previous message
Eclipse UserFriend
Originally posted by: cipher8000.yahoo.com

Hello,Here is a code snippet i got from XSDPrototypicalSchema, This looks
like it can load the schema from a dom element. Let me give a try! Is there
any other way of loading the schema from an Element?public XSDSchema
createSchema(org.w3c.dom.Element element) {
// Create a schema from an 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;
}
}
"Muruga" <cipher8000@yahoo.com> wrote in message
news:becdf4$5gp$1@eclipse.org...
Hi,

I am looking for a way to create the XSDSchema from an DOM Element. For
example:

Here is my schema would look like:

<definitions name="FlowSample" targetNamespace="http://samples.cxdn.com"
xmlns:tns="http://samples.cxdn.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s1="http://www.autoloan.com/ns/autoloan"
>
<types>
<schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://www.autoloan.com/ns/autoloan"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="LoanApplication">
<sequence>
<element name="SSN" type="string"/>
<element name="Email" type="string"/>
<element name="CustomerName" type="string"/>
<element name="LoanAmount" type="double"/>
<element name="CarModel" type="string"/>
<element name="CarYear" type="string"/>
<element name="CreditRating" type="int"/>
</sequence>
</complexType>
</schema>
</types>
....
</definitions>

I use WSDL4J's Types to extract the <schema> DOM Element and now i want to
construct
XSDSchema from that DOM Element.

Is there any util API for constructing XSDSchema from an Element?

-Muruga
Re: Creating XSDSchema from DOM Element [message #574001 is a reply to message #24629] Mon, 07 July 2003 18:37 Go to previous message
Eclipse UserFriend
Originally posted by: cipher8000.yahoo.com

Hello,Here is a code snippet i got from XSDPrototypicalSchema, This looks
like it can load the schema from a dom element. Let me give a try! Is there
any other way of loading the schema from an Element?public XSDSchema
createSchema(org.w3c.dom.Element element) {
// Create a schema from an 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;
}
}
"Muruga" <cipher8000@yahoo.com> wrote in message
news:becdf4$5gp$1@eclipse.org...
Hi,

I am looking for a way to create the XSDSchema from an DOM Element. For
example:

Here is my schema would look like:

<definitions name="FlowSample" targetNamespace="http://samples.cxdn.com"
xmlns:tns="http://samples.cxdn.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s1="http://www.autoloan.com/ns/autoloan"
>
<types>
<schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://www.autoloan.com/ns/autoloan"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="LoanApplication">
<sequence>
<element name="SSN" type="string"/>
<element name="Email" type="string"/>
<element name="CustomerName" type="string"/>
<element name="LoanAmount" type="double"/>
<element name="CarModel" type="string"/>
<element name="CarYear" type="string"/>
<element name="CreditRating" type="int"/>
</sequence>
</complexType>
</schema>
</types>
....
</definitions>

I use WSDL4J's Types to extract the <schema> DOM Element and now i want to
construct
XSDSchema from that DOM Element.

Is there any util API for constructing XSDSchema from an Element?

-Muruga
Previous Topic:Creating XSDSchema from DOM Element
Next Topic:Re: getAnnotaion().getUserInfomation() returns an org.w3c.dom.Node withemty nodeValue
Goto Forum:
  


Current Time: Thu Apr 18 09:07:29 GMT 2024

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

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

Back to the top