Probleme mit Eclipse Modeling Framework (EMF)

Status
Nicht offen für weitere Antworten.

dafti

Neues Mitglied
Da ich hier neu bin, anfangs mal ein großes HALLO!

und nun zu meinem Problem:

ich muss über EMF ein XML rausschreiben. Modellbildung, Code-Generation und auch rausschreiben eines XMLs hat grundsätzlich funktioniert.
Das Modell wurde aus einer vorhandenen XSD generiert.
Das Problem jedoch ist, dass es schon im Ecore kein simples Element ( <name> TEST </name> ) mehr gibt, sondern diese zu Attributen im übergordneten Element wurden.

Im XSD2Ecore Mapping wird beim XSD zwar noch das Element name angezeigt, im Ecore jedoch nur mehr als Attribut.

Kennt jemand das Problem? Hat jemand eine Lösung?

LG David
 

Wildcard

Top Contributor
Liegt wohl daran wie die XSD definiert wurde. XML Schemata sind sehr vielfälltig. Kannst du das Schema hier posten?
 

dafti

Neues Mitglied
Hi,
dass hab ich mir auch schon gedacht. Das Problem is zum Beispiel so:

Also es sollte eigentlich sowas auf die Art rauskommen(nur ein Beispiel):

Code:
<node uri="office@fh-salzburg.ac.at" type="SME" name="SUAS">
          <name>SUAS</name>
</node>

und nach dem rausschreiben mit dem EMF schauts dann so aus(das mit name und name1 is mal egal, aber name oder name1 sollte halt draussen stehen):

Code:
<node uri="office@fh-salzburg.ac.at" type="SME" name="SUAS" name1="SUAS"/>

das XSD sieht so aus:


Code:
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="networkDescription">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="nodes"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="nodes">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="node" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="node">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="name"/>
				<xs:element ref="accessMethods" minOccurs="0"/>
				<xs:element ref="location" minOccurs="0"/>
				<xs:element ref="connections"/>
				<xs:element ref="servicePool" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="type" type="xs:string" use="required"/>
			<xs:attribute name="name" type="xs:string" use="required"/>
			<xs:attribute name="uri" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="servicePool">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="service" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="type" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="localServicePool"/>
						<xs:enumeration value="onDemand"/>
						<xs:enumeration value="onOffer"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="service">
		<xs:complexType>
			<xs:sequence minOccurs="0">
				<xs:element ref="name"/>
				<xs:element ref="description"/>
				<xs:element ref="accessMethods" minOccurs="0"/>
			</xs:sequence>
			<xs:attribute name="uri" type="xs:string" use="optional"/>
			<xs:attribute name="name" type="xs:string" use="optional"/>
			<xs:attribute name="id" type="xs:integer" use="required"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="name" type="xs:string"/>
	<xs:element name="location">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="lat" type="xs:string"/>
					<xs:attribute name="lng" type="xs:string"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="description" type="xs:string"/>
	<xs:element name="connections">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="connection" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="connection">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="description" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="type" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="producer"/>
						<xs:enumeration value="benchmark"/>
						<xs:enumeration value="social"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="to" type="xs:string" use="required"/>
			<xs:attribute name="strength" type="xs:byte" use="required"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="accessMethod">
		<xs:complexType>
			<xs:attribute name="uri" type="xs:string" use="required"/>
			<xs:attribute name="type" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="accessMethods">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="accessMethod" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
[/code]
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
Kirby.exe Probleme mit XML XPATH Select XML & JSON 3
N Probleme bei der Formatierung beim Einfügen und löschen über DOM XML & JSON 7
G Probleme mit Jsoup in .jar File XML & JSON 11
K JAX-WS Bindin-Probleme XML & JSON 1
B Probleme mit RelativeLayout XML & JSON 1
L Jackson JSON: Probleme beim einlesen XML & JSON 1
K XOM Builder Probleme XML & JSON 3
N Jsoup: PHP-Tags bereiten Probleme? XML & JSON 2
M SAX-Parsing Probleme XML & JSON 23
M Probleme mit XPath bei Java XML & JSON 5
hdi Probleme beim Erstellen einer XML XML & JSON 7
F Probleme beim html parsen mit tagsoup XML & JSON 4
M Probleme beim Parsen eines gefilterten XML-Dokuments XML & JSON 6
H JAXB Probleme beim Unmarshalling XML & JSON 3
G Probleme mit XML und JTree XML & JSON 9
klattiator Probleme mit Codierung XML & JSON 3
S Probleme beim erstellen einer Jar XML & JSON 12
T XML und Sonderzeichen, Probleme mit ASP.NET Server XML & JSON 2
G Probleme mit Namespaces XML & JSON 5
S PDF Erzeugung - Probleme mit der XML Datei bei Schema-Infos XML & JSON 2
C SAX Probleme beim lesen XML & JSON 4
F JAXB - Nachträglich hinzugefügter Code macht Probleme XML & JSON 2
D Probleme beim SAX parsing XML & JSON 4
P Probleme mit JDom . addContent(int index,Collection c) XML & JSON 2
F Unmarshall Probleme XML & JSON 5
byte Probleme beim Parsen von XHTML-Datei XML & JSON 4
R Probleme mit Transformer und StreamResult XML & JSON 4
C Probleme mit Include XML & JSON 10
C POI + jXLS Probleme XML & JSON 3
B DOM DTD laden abschalten, Probleme mit Doctypes und PIs XML & JSON 2
S Probleme mit Jdom XML & JSON 3
G probleme mit package XML & JSON 12
M Probleme mit String XML & JSON 3
H Probleme mit xmlrpc und php XML & JSON 13
B Probleme mit Zugriff auf eXist-Datenbank XML & JSON 9
H Neu bei JAVA- Probleme mit der Integration von Xerces XML & JSON 3
P Probleme mit jdom XML & JSON 5
R JAVA und DOM, probleme beim einfügen von elementen ?????? XML & JSON 6
P Eclipse - Ant Skript - jar erstellen mit Referenced Libraries - build.xml XML & JSON 5
P Eclipse Rinzo - Schema muss mit DOCTYPE "root" übereinstimmen XML & JSON 0
S XML file lässt sich in Eclipse nicht erstellen XML & JSON 2
P (Eclipse)Ant Script, .jar Datei erstellen mit MANIFEST.MF XML & JSON 12
P "XPath is deprecated" XML eclipse XML & JSON 3
N Eclipse - XSD zu Javacode XML & JSON 2
G jdom-Klassen in Eclipse importieren XML & JSON 2
E web.xml bei Eclipse JSP-Webanwendung XML & JSON 2
ruutaiokwu jaxb eclipse plugin... XML & JSON 3
R XML-Validierung mittels XSD unter Eclipse XML & JSON 2
D xsd->java mit Eclipse?! oder wie? XML & JSON 27
S Graphischer XML / XSD Editor Plugin Eclipse XML & JSON 1
T jdom.jar als Relativer Pfad in Eclipse einbinden XML & JSON 4
H Einstieg in das Eclipse Modeling Framework XML & JSON 27
P SAXBuilder wird von Eclipse nicht als ObjektTyp erkannt XML & JSON 3
D XML-file mit Eclipse erstellen + Namespaces XML & JSON 2

Ähnliche Java Themen

Neue Themen


Oben