stax Problem

Status
Nicht offen für weitere Antworten.

YAT

Mitglied
hey...
ich wieder ^^

oehm ich hab ein kleines Prograemmschen geschrieben das eine xml datei ausliest ...
an den attribut namen kommen ohne Probleme nur an den Inhalt der attribut komm ich einfach nich ran...

hier mal der code
Code:
public class TestEventStaX {

	private String configFile;

	public void setFile(String configFile) {
		this.configFile = configFile;
	}

	public void readConfig() {
		try {	String att;
			String output;
			XMLInputFactory inputFactory = XMLInputFactory.newInstance();
			InputStream in = new FileInputStream(configFile);
		XMLEventReader eventReader = inputFactory.createXMLEventReader(in);

			Scanner input = new Scanner(System.in);
			System.out.print("Type which attributes you want to display: ");
			att = input.nextLine();
			while (eventReader.hasNext()) {       
				
				XMLEvent event = eventReader.nextEvent();
				if (event.isStartElement()) {
		String vergleich = event.asStartElement().getName().toString();
					if (vergleich.equals(att)) {
						System.out.println(event+"\t"+[COLOR="Red"]??VALUE????[/COLOR]);
						event = eventReader.nextEvent();
						
					}
				}
			}
		} catch (FileNotFoundException e) {
				System.out.println("FILE NOT FOUND");
		} catch (XMLStreamException e) {	
			System.out.println("XML FEHLER");
		}

	}

	public static void main(String args[]) {
		Scanner input = new Scanner(System.in);
		TestEventStaX read = new TestEventStaX();
		String file="ncbi.xml";
		read.setFile(file);
		read.readConfig();
	}
}

kann mir jemand sagen wie ich das value komme??
Danke :):):)


gruß
YAT
 

YAT

Mitglied
hi cool
danke danke
habs hinbekommen :D

idiotischer fehler =( *schaem*

Java:
System.out.println(event.asCharacters().getData());
hatte ich schon ausprobiert gehabt aber ich hatte es nicht nach

Java:
	event = eventReader.nextEvent();


naja kann passieren :D:D:D:D

Danke ;)
 

YAT

Mitglied
mhm zu frueh gefreut.... >.<

hab ein weiteres Problem..
ich hab das programm erst lokal getestet einwandfrei hats funktioniert jetzt hab ichs auf nen server geschoben un da is der heap space voll...

hab gelesen das stax unter java 6 nich ganz einwandfrei laeuft...
lokal hab ich java 5

nun stellt sich die frage wie bekomm ich das Problem geloest?
habt ihr eine idee??
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
K stax problem XML & JSON 2
A Interfaces bei StAX XML & JSON 2
R sax, stax, jdom, jaxb? List von Objekten speichern und laden XML & JSON 6
T StAX und Reihenfolge in XML XML & JSON 6
D Stax mehrere "Kindelemente" zusammen XML & JSON 2
P mehrere Parameter in XML (stax) XML & JSON 3
H JAXB und STAX XML & JSON 2
T StAX / SAX => Wie XML Datenstruktur in Java abbilden? XML & JSON 2
N STAX Serializer (Formatierer)? XML & JSON 2
T StAX und Codierung XML & JSON 3
G Wie Attribute aus XML in ein Model schreiben (StAX)? XML & JSON 7
A StAX formatierung oder auch newline! XML & JSON 2
J StAX -- Woodstox Implementation nutzen XML & JSON 6
A StAX API: Cannot Cast from QName to String! XML & JSON 2
O XPATH Problem - Anfänger XML & JSON 4
so_ein_Komischer Problem mit Clean and Build XML & JSON 1
P JAXB-Problem XML & JSON 1
W Problem mit dem mit XML sortierung XML & JSON 2
S Jaxb Unmarshalling Problem XML & JSON 4
E einfaches Problem XML + XSD + jedit XML & JSON 2
S Xslt Problem XML & JSON 2
B JasperReport Problem in Runtime XML & JSON 2
S Problem with JAXB unmarshalling classes that have the same name in @XmlRootElement XML & JSON 2
R Problem bei: XML und XSL zu HTML XML & JSON 2
M Read / write Problem beim ByteStrom XML & JSON 2
M XML write Problem zweiter Ansatz XML & JSON 3
M XML read Problem XML & JSON 4
M XML write Problem XML & JSON 2
whitenexx Problem beim parsen von Facebook XML XML & JSON 3
M XML Unicode Problem XML & JSON 2
S XJC --> Java-Objects compile Problem XML & JSON 4
F XPath-Problem mit DOM4J XML & JSON 8
B JPA + JAXB Mapping Problem XML & JSON 2
T XPath Problem: finden einer Node nach Attributswert XML & JSON 2
G Problem beim schreiben von XML in eine File XML & JSON 2
S Encoding Problem XML & JSON 7
K JAXB und Maps -> Marshalling-Problem XML & JSON 6
B Problem beim löschen von ChildNodes aus einem XML-DOM XML & JSON 3
E JDOM - Problem beim Zusammenfügen zweier Dateien XML & JSON 2
M JExcelAPI (JXL) Encoding Problem XML & JSON 11
S DOM Parsen Problem mit HTML Sonderzeichen XML & JSON 4
A aus xml --> html Problem XML & JSON 3
slawaweis Problem mit XSLT (wahrscheinlich ein Bug in Java 6) XML & JSON 16
T Problem beim Parsen von Attribut xmlns="urn:com:test&qu XML & JSON 6
P XPath Problem XML & JSON 2
J Problem beim XML-Lesen XML & JSON 2
M Problem mit FOP in Java Programm XML & JSON 2
S Problem mit XPath XML & JSON 4
J Problem mit compile einer XSD XML & JSON 3
N jdom problem beim lesen von child elementen XML & JSON 5
N problem bei xml lesen mit jdom XML & JSON 2
A XPath Problem XML & JSON 2
W JDOM element ändern funzt nich :( [problem gelöst] XML & JSON 3
G Problem mit XML-Schema Validierung mit Java XML & JSON 12
B jdom: getChildren() problem XML & JSON 4
H XSL-FO Problem mit If XML & JSON 2
loadbrain XPath Problem XML & JSON 2
T addContent / Problem mit Variable XML & JSON 2
F Problem mit JAXB Unmarshaller XML & JSON 2
F JDOM und XPath - Problem mit Namespace ohne Prefix XML & JSON 5
8 SAXParser Problem, startElement wird nicht ausgeführt XML & JSON 2
M Java und XSLT: Performanz-Problem XML & JSON 5
X JDOM SAXBuilder Validationschema - Problem XML & JSON 8
G Problem mit getContent XML & JSON 4
S Problem mit SAX XML & JSON 6
A Problem mit JasperReport XML & JSON 6
G DOCTYPE Problem beim Transformer/TransformerFactory etc. XML & JSON 13
C XSD Problem XML & JSON 16
R Problem bei Erstellung von XML(JDOM) XML & JSON 3
R Problem mit SAX-Parser characters() XML & JSON 7
M XPath Problem im Zusammenhang mit document() XML & JSON 2
P Problem beim erstellen eines neuen Elements (JDOM) XML & JSON 5
Z Problem mit getNodeValue() und setNodeValue() in DOM XML & JSON 6
H JAXB CUSTOMIZATION PROBLEM XML & JSON 2
M XPATH und RSS (Problem namespaces) XML & JSON 7
P SAXParser problem? XML & JSON 2
S Problem beim Erstellen eines pdfs XML & JSON 3
V Problem mit xsd XML & JSON 2
P XML mit hilfe von JDOM abspeichern macht Problem XML & JSON 6
G Problem mit addContent() XML & JSON 4
B DTD Problem - Reihenfolge der Einträge XML & JSON 2
R Problem beim Auslesen von Attributen XML & JSON 4
K Problem mit ant/java web services XML & JSON 4
K xml Datei mit JDOM erzeugen, Problem Namespaces XML & JSON 1
P Problem mit XML und DOM XML & JSON 2

Ähnliche Java Themen

Neue Themen


Oben