473,976 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FW: [Jython-users] ERROR : parsing xml in jython

Hi

But I am unable to parse all the nodes of the tree .....especially the
subtree of the main tree

It displays only the sibling not the subtree
Regards
Divya

-----Original Message-----
From: Matthias Berth [mailto:be***@de codon.com]
Sent: Tuesday, December 19, 2006 3:18 PM
To: Divya Prakash
Subject: Re: [Jython-users] ERROR : parsing xml in jython

Hi,

looks like you have to make an InputSource from the file, like so:
from java.io import File, FileReader, StringReader

textReader = FileReader(File (filename))
inputSource = InputSource(tex tReader)
dp.parse(inputS ource)

Hope this helps

Matthias

Divya Prakash schrieb:
Hi All,

I m facing the problem while parsing xml file ..

My code is :-

import sys

from org.apache.xerc es.parsers import DOMParser as dp

import javax.xml.parse rs

infilename = open("mos.xml", "r")

print infilename
def test(infilename ):

"""Parse XML document and show attributes and names.

"""

print infilename

parser = dp()

print parser

gh = parser.parse(in filename)

print gh

doc = parser.getDocum ent()

node = doc.getFirstChi ld()

print "Attributes :"

show_attrs(node )

print "Names:"

show_names(node )
Dec 19 '06 #1
0 1064

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

Similar topics

2
10241
by: Rubal Jain | last post by:
Hello - While installing ASP.Net on Windows 2003 I am getting the followin error : Error parsing C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config Parser returned error 0x80070003. I find it its not creating the CONFIG folder and related files under it.
0
6480
by: Marc van Boven | last post by:
I'm stuck with the following problem: My nusoap-client calls a server-function giveCombination(). The function giveCombination should return something like array( => array( 'a_id' => 6, 'b_id' => 9, 'c_id' => 3,
0
895
by: Juky | last post by:
Hi all I need to create a document from Url in VB .Net. I used the following code --------------------------------------------- using mshtm Dim objMSHTML As New HTMLDocumen Dim objDocument As HTMLDocumen objDocument = objMSHTML.createDocumentFromUrl(txtUrl.Text, vbNullString
2
10371
by: Tom | last post by:
I have a function which finds the x and y coordinate of any object in the document by referring to offsetLeft or offsetTop value of the object's offsetParent, all the way to the top of the DOM, i.e.: function get_y(obj) { var coord = 0; while (obj.offsetParent) { coord += obj.offsetTop; obj = obj.offsetParent; }
1
4946
by: janakivenk | last post by:
Hello, I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the following error. SQL> execute domsample('c:\','song.xml','error.txt') BEGIN domsample('c:\','song.xml','error.txt * ERROR at line 1: ORA-31001: Invalid resource handle or path
0
2283
by: palabat | last post by:
Hello. I'm getting this error , "XML error parsing SOAP payload : Empty Document" when I try to execute a NuSOAP client in consuming a .NET web service. The response from the web service server looks fine - I can see the line of data from the SOAP response. The problem is in the parsing of the SOAP response from the server. I noticed that the xml_parse() function returns FALSE all the time during the parsing. Please HELP. Thanks. palabat
0
2007
by: =?Utf-8?B?VWxmIFRob3JzZW4=?= | last post by:
I use Visual Studio 2005 for a C-project using an external compiler, and came up with the idea that error parsing would be neat, i.e. enabling the functionality available for a "normal" build where you can double click a compile error/warning message and be guided to the file/line in question. Using sed to filter output from the compiler i managed to make the error output look like the ones generated from the regular compiler, and...
3
4612
by: =?Utf-8?B?RGFuYQ==?= | last post by:
I am re-posting this message after registering my posting alias. When I specify an end tag for the clear element of namespaces in my web.config file, the parser error "Unrecognized element 'add'" is reported. .... <pages> <namespaces> <clear></clear> <add namespace="System"/>
0
1266
by: r.battistoni | last post by:
Hy to everyone I have created a simple SAX parser for a very simple XML file. When I run the code that follows I get this error: "Invalid hexadecimal character reference" The strange thing is If I change the "chunk size" for the data I send to the parser, the error row changes. This behaviour is very strange!
0
10353
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
11819
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...
0
11408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10084
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6415
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
6558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5153
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
4731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3761
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.