473,788 Members | 3,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML parsing without startelement

Hi,

I'm looking at the examples on http://java.sun.com/xml/jaxp/dist/1....x/2a_echo.html

I want to parse an XML file that has just events, like this:
==>start of file
<event type="1"/>
<event type="2"/>
<method type="warning"/>
<===end of file

so there are no <start> and </start> -tags.
Using the examples on that java site I get the following fatal error:

org.xml.sax.SAX ParseException: Illegal character at end of document, &#x3c;.
at org.apache.crim son.parser.Pars er2.fatal(Unkno wn Source)
at org.apache.crim son.parser.Pars er2.fatal(Unkno wn Source)
at org.apache.crim son.parser.Pars er2.parseIntern al(Unknown Source)
at org.apache.crim son.parser.Pars er2.parse(Unkno wn Source)
at org.apache.crim son.parser.XMLR eaderImpl.parse (Unknown Source)
at javax.xml.parse rs.SAXParser.pa rse(Unknown Source)
at javax.xml.parse rs.SAXParser.pa rse(Unknown Source)

It should be possible, right?
Aug 1 '05 #1
1 5217
No, that is not an XML file. You will need to reformat or wrap the bytes in
a faked document element node.

Regards,

Silvio Bierman
Aug 8 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6008
by: wenke | last post by:
Hi, I am using the following code (see below) from php.net (http://www.php.net/manual/en/ref.xml.php, example 1) to parse an XML file (encoded in UTF-8). I changed the code slightly so that the cdata sections will be echoed an not the element names as in the original example. In the cdata sections of my XML file I have terms like this:
2
3155
by: Noyb | last post by:
I've set up a news links section using the RSS parsing tutorial found here: http://www.sitepoint.com/article/560 Everything works great but depending on the feed source there may be 3 news links or 30. How can I limit the amount of titles, descriptions, and links output to be no more than 10? Thanks, Steve.
6
3903
by: doug | last post by:
How can I parse a large XML file that is to large for memory? I am currently using php 5.0.3 and the libxml parser, I would like to read it incrementally from a file, but the parser gets the entire contents from as String?
1
1602
by: Nick Webster | last post by:
Hi, I have a slight problem with parsing XML: If the tag was say - <Something ID="12"> - My parser is only retrieving the 'Something' part, and discarding the 'ID="12"'. Code: function startElement($xml_parser, $name, $attrs) {
3
3661
by: Willem Ligtenberg | last post by:
I decided to use SAX to parse my xml file. But the parser crashes on: File "/usr/lib/python2.3/site-packages/_xmlplus/sax/handler.py", line 38, in fatalError raise exception xml.sax._exceptions.SAXParseException: NCBI_Entrezgene.dtd:8:0: error in processing external entity reference This is caused by: <!DOCTYPE Entrezgene-Set PUBLIC "-//NCBI//NCBI Entrezgene/EN" "NCBI_Entrezgene.dtd">
0
1563
by: Naren | last post by:
I have an XML like the one below. I am using SAX parsing and I need to get the information between the tags of the Email element. First i try to access the content and print it out and it gives me weird results. XML: /www.xmlspy.com) by AB(Co) --><!--Sample XML file generated by XML Spy v4.0.1 U (http://www.xmlspy.com)--> <RoomResRQ xmlns:commonelements="http://*.com/schema/CommonElements"
1
3110
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP Transformer convert that via XSLT to valid XSL-FO. So I define a SAXReader which fires the SAX Events for the Java Object. This works fine and the Transformation to PDF is ok. However, I have one object which contains an XHTML String and the tags
4
2659
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. <txtNameUSState>CALIFORNIA</txtNameUSState>
5
4931
by: amjadcsu | last post by:
I am a newbie in python I am trying to parse a xml file and write its content in a txt file. The txt contains null elements. Any reason what iam doing wrong here Here is the code that i wrote import sys,os import xml.sax import xml.sax.handler
3
4515
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude error-trapping (if it finds an error in one of the xml files, the script stops). Recently, the script has stopped working because one of the xml files is badly formed. So I decided to rewrite the script with better error trapping; the script should...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.