|
Re: Binding XML to Java [message #71477 is a reply to message #71458] |
Mon, 29 January 2007 13:09   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Elena,
You could build an Ecore model for the XMLSchema.xsd and use that, or
you could use the extended metadata's demandFeature to create the
element name and namespace you want just as for any other XML name and
namespace you might want to produce. The XSD model itself requires the
specialized behavior of an XSDResourceImpl to serialize, so you can't
use it directly for the purposes of embedding it in some XML data
represented as an EMF AnyType.
elena t wrote:
> I'm creating an XML as described here:
> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava.
>
> Is it possible to add an element which represents a schema
> (org.eclipse.xsd.XSDSchema) to the XML resource?
>
> If yes, can you give some clues?
>
> Thanks.
> elena
>
|
|
|
Re: Binding XML to Java [message #71496 is a reply to message #71477] |
Mon, 29 January 2007 16:58   |
Eclipse User |
|
|
|
Originally posted by: elena.tibrea.gmail.com
Hi again,
Using the EMF model generated from mySchema.xsd file, I could have smth
like:
StructuralFeature feature =
MyPackage.eINSTANCE.getDocumentRoot().getEStructuralFeature( "myFeature");
MyType featureType=MyFactory.eINSTANCE.createMyFeatureType();
rootMixed.add(feature,featureType);
which would result in <myFeature> being included in my XML Resource,
but what I want to have in the end is a XML file looking like
...
<document>
<data>
<xs:schema>
<!--everything which belongs to a schema declaration, basically
mySchema.xsd file-->
</xs:schema>
</data>
</document>
....
Help :-)
Thanks.
elena
|
|
|
Re: Binding XML to Java [message #71515 is a reply to message #71496] |
Mon, 29 January 2007 18:23  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------000705080308080905060006
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Elena,
The paper shows how to use demandFeature and how to use AnyType.
AnyType rootTreeNode = XMLTypeFactory.eINSTANCE.createAnyType();
documentRoot.eSet(rootNodeFeature, rootTreeNode);
That same technique could be used to build anything. Or, as I
suggested, you could generate a <My>Package for the schema for schemas
and use that:
http://www.w3.org/2001/XMLSchema.xsd
elena t wrote:
> Hi again,
>
> Using the EMF model generated from mySchema.xsd file, I could have
> smth like:
>
> StructuralFeature feature =
> MyPackage.eINSTANCE.getDocumentRoot().getEStructuralFeature( "myFeature");
> MyType featureType=MyFactory.eINSTANCE.createMyFeatureType();
> rootMixed.add(feature,featureType);
>
> which would result in <myFeature> being included in my XML Resource,
> but what I want to have in the end is a XML file looking like
> ...
> <document>
> <data>
> <xs:schema>
> <!--everything which belongs to a schema declaration, basically
> mySchema.xsd file-->
> </xs:schema>
> </data>
> </document>
> ....
>
> Help :-)
>
> Thanks.
> elena
>
>
>
--------------000705080308080905060006
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Elena,<br>
<br>
The paper shows how to use demandFeature and how to use AnyType.
|
|
|
Re: Binding XML to Java [message #599555 is a reply to message #71458] |
Mon, 29 January 2007 13:09  |
Eclipse User |
|
|
|
Elena,
You could build an Ecore model for the XMLSchema.xsd and use that, or
you could use the extended metadata's demandFeature to create the
element name and namespace you want just as for any other XML name and
namespace you might want to produce. The XSD model itself requires the
specialized behavior of an XSDResourceImpl to serialize, so you can't
use it directly for the purposes of embedding it in some XML data
represented as an EMF AnyType.
elena t wrote:
> I'm creating an XML as described here:
> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
>
> Is it possible to add an element which represents a schema
> (org.eclipse.xsd.XSDSchema) to the XML resource?
>
> If yes, can you give some clues?
>
> Thanks.
> elena
>
|
|
|
Re: Binding XML to Java [message #602063 is a reply to message #71477] |
Mon, 29 January 2007 16:58  |
Eclipse User |
|
|
|
Originally posted by: elena.tibrea.gmail.com
Hi again,
Using the EMF model generated from mySchema.xsd file, I could have smth
like:
StructuralFeature feature =
MyPackage.eINSTANCE.getDocumentRoot().getEStructuralFeature( "myFeature");
MyType featureType=MyFactory.eINSTANCE.createMyFeatureType();
rootMixed.add(feature,featureType);
which would result in <myFeature> being included in my XML Resource,
but what I want to have in the end is a XML file looking like
...
<document>
<data>
<xs:schema>
<!--everything which belongs to a schema declaration, basically
mySchema.xsd file-->
</xs:schema>
</data>
</document>
....
Help :-)
Thanks.
elena
|
|
|
Re: Binding XML to Java [message #602074 is a reply to message #71496] |
Mon, 29 January 2007 18:23  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------000705080308080905060006
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Elena,
The paper shows how to use demandFeature and how to use AnyType.
AnyType rootTreeNode = XMLTypeFactory.eINSTANCE.createAnyType();
documentRoot.eSet(rootNodeFeature, rootTreeNode);
That same technique could be used to build anything. Or, as I
suggested, you could generate a <My>Package for the schema for schemas
and use that:
http://www.w3.org/2001/XMLSchema.xsd
elena t wrote:
> Hi again,
>
> Using the EMF model generated from mySchema.xsd file, I could have
> smth like:
>
> StructuralFeature feature =
> MyPackage.eINSTANCE.getDocumentRoot().getEStructuralFeature( "myFeature");
> MyType featureType=MyFactory.eINSTANCE.createMyFeatureType();
> rootMixed.add(feature,featureType);
>
> which would result in <myFeature> being included in my XML Resource,
> but what I want to have in the end is a XML file looking like
> ...
> <document>
> <data>
> <xs:schema>
> <!--everything which belongs to a schema declaration, basically
> mySchema.xsd file-->
> </xs:schema>
> </data>
> </document>
> ....
>
> Help :-)
>
> Thanks.
> elena
>
>
>
--------------000705080308080905060006
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Elena,<br>
<br>
The paper shows how to use demandFeature and how to use AnyType.
|
|
|
Powered by
FUDForum. Page generated in 0.04673 seconds