EMF und lesen von Tag-Values

borobudur

Aktives Mitglied
Hallo,
ich habe mir von einem XML das XSD gebaut und dazu den EMF code generiert.

Nun lese ich das XML ein, das funktioniert auch, ich kann auf die tags, dessen attribute und die werte des attributs zugreifen.
Was ich nicht finde ist der wert oder inhalt vom tag:
Code:
<tag attribute="wert> der tag-inhalt </tag>

Frisst das EMF ev. gar nicht?
 

borobudur

Aktives Mitglied
Hier das schema:
[XML]<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:lib="http://www.example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" targetNamespace="http://www.example.org">
<xs:simpleType name="ST_Name">
<xs:restriction base="xs:string">
<xs:enumeration value="MimeType"/>
<xs:enumeration value="category"/>
<xs:enumeration value="gate.SourceURL"/>
<xs:enumeration value="kind"/>
<xs:enumeration value="length"/>
<xs:enumeration value="majorType"/>
<xs:enumeration value="minorType"/>
<xs:enumeration value="orth"/>
<xs:enumeration value="position"/>
<xs:enumeration value="string"/>
<xs:enumeration value="subkind"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Value">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="className" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="java.lang.String"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="Name">
<xs:simpleContent>
<xs:extension base="lib:ST_Name">
<xs:attribute name="className" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="java.lang.String"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="GateDocument">
<xs:sequence>
<xs:element name="annotationSet" type="lib:AnnotationSet"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Feature">
<xs:sequence>
<xs:element name="name" type="lib:Name"/>
<xs:element name="value" type="lib:Value"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AnnotationSet">
<xs:sequence>
<xs:element name="annotation" type="lib:Annotation" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Annotation">
<xs:sequence>
<xs:element name="feature" type="lib:Feature" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="startNode" type="xs:integer" use="required"/>
<xs:attribute name="id" type="xs:integer" use="required"/>
<xs:attribute name="endNode" type="xs:integer" use="required"/>
</xs:complexType>
</xs:schema>
[/XML]
Und das versuche ich einzulesen:
[XML]
<?xml version="1.0" encoding="windows-1252"?>
<GateDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.example.org" xsi:schemaLocation="http://www.example.org">
<AnnotationSet>
<Annotation id="71195" type="Token" startNode="2811" endNode="2820">
<Feature>
<Name className="java.lang.String">length</Name>
<Value className="java.lang.String">9</Value>
</Feature>
<Feature>
<Name className="java.lang.String">category</Name>
<Value className="java.lang.String">NNP</Value>
</Feature>
<Feature>
<Name className="java.lang.String">orth</Name>
<Value className="java.lang.String">upperInitial</Value>
</Feature>
<Feature>
<Name className="java.lang.String">kind</Name>
<Value className="java.lang.String">word</Value>
</Feature>
<Feature>
<Name className="java.lang.String">string</Name>
<Value className="java.lang.String">Agreement</Value>
</Feature>
</Annotation>
</AnnotationSet>
</GateDocument>
[/XML]
 
Zuletzt bearbeitet:

Ähnliche Java Themen

Neue Themen


Oben