| | |
help with web services. parse xml string with dom parser
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2009
Posts: 19
Reputation:
Solved Threads: 0
Hi, this is my final project. I have generated an xml string, this is my code:
whenever i run it in my browser, there will be error like this:
An error occurred at line: 39 in the jsp file: /assignment2/domrecipe.jsp
InputSource cannot be resolved to a type
36: // Create an instance of the DOM parser and parse the document
37: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
38: DocumentBuilder db = dbf.newDocumentBuilder();
39: Document doc = db.parse(new InputSource(new StringReader(xmlResult)));
40:
41: // Begin traversing the document
42: traverseTree(doc, out);
and this:
root cause
java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="UTF-8"?>
(and then the xml string)
so, basically, the xml string has been read, but there are errors in it... can someone help me..
thanks..
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
import java.io.StringReader; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.CharacterData; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; <%@ page import="javax.xml.parsers.*" %> <%@ page import="org.w3c.dom.*" %> <%@ page import="java.io.*" %> <%@page import="recipe.*" %> <html> <head> <title>RECIPE</title> </head> <body> <% // Instantiate the generated Service Recipe service = new Recipe(); // Get the port using port getter method generated in CalculatorService RecipePortType port= service.getRecipePort(); // Invoke the remote method FilterRequestType req = new FilterRequestType(); FilterResponseType resp = port.filter(req); String xmlResult = resp.getRecipelist(); // Create an instance of the DOM parser and parse the document DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(new StringReader(xmlResult))); // Begin traversing the document traverseTree(doc, out); %> <% .......................................(the rest of the code)
whenever i run it in my browser, there will be error like this:
An error occurred at line: 39 in the jsp file: /assignment2/domrecipe.jsp
InputSource cannot be resolved to a type
36: // Create an instance of the DOM parser and parse the document
37: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
38: DocumentBuilder db = dbf.newDocumentBuilder();
39: Document doc = db.parse(new InputSource(new StringReader(xmlResult)));
40:
41: // Begin traversing the document
42: traverseTree(doc, out);
and this:
root cause
java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="UTF-8"?>
(and then the xml string)
so, basically, the xml string has been read, but there are errors in it... can someone help me..
thanks..
Last edited by peter_budo; May 27th, 2009 at 12:59 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Oct 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi,
i am very new to webservices.My webservice has to return xmlstring as response. like..
I have to develop webservices using JAX-WS ,JBoss Application server,JBossWS-native......
Can anyone plz..help me out with steps.....
Thanx in Advance....
i am very new to webservices.My webservice has to return xmlstring as response. like..
<xml version.....><Returncode>G</ReturnCode><folder name = 'salesfolder' value ='100'></folder> I got simple samples which return a string,but not xmlstring how can i proceed.....plz....I have to develop webservices using JAX-WS ,JBoss Application server,JBossWS-native......
Can anyone plz..help me out with steps.....
Thanx in Advance....
Last edited by peter_budo; 24 Days Ago at 2:47 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
•
•
Join Date: Oct 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi,
thanks for replying i have gone through that thread before posting,but i am not getting it.
Is that thread is a service or client as i am seeing jsp tags and also its not returning..
I have gone through some links and this is what i got.Please correct me ....
1. i wrote a method which takes string as a parameter.
2. In the method, i am generating a xml Document and transforming that DOM to string and returning that string.
Is i am folowing the correct way?.
In some articles i came to know that it should returning a document type,so that will as string i correct format(tags).Is it correct...
please suggest me.....
thanks for replying i have gone through that thread before posting,but i am not getting it.
Is that thread is a service or client as i am seeing jsp tags and also its not returning..
I have gone through some links and this is what i got.Please correct me ....
1. i wrote a method which takes string as a parameter.
2. In the method, i am generating a xml Document and transforming that DOM to string and returning that string.
Is i am folowing the correct way?.
In some articles i came to know that it should returning a document type,so that will as string i correct format(tags).Is it correct...
please suggest me.....
•
•
•
•
Hi, this is my final project. I have generated an xml string, this is my code:
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
import java.io.StringReader; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.CharacterData; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; <%@ page import="javax.xml.parsers.*" %> <%@ page import="org.w3c.dom.*" %> <%@ page import="java.io.*" %> <%@page import="recipe.*" %> <html> <head> <title>RECIPE</title> </head> <body> <% // Instantiate the generated Service Recipe service = new Recipe(); // Get the port using port getter method generated in CalculatorService RecipePortType port= service.getRecipePort(); // Invoke the remote method FilterRequestType req = new FilterRequestType(); FilterResponseType resp = port.filter(req); String xmlResult = resp.getRecipelist(); // Create an instance of the DOM parser and parse the document DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(new StringReader(xmlResult))); // Begin traversing the document traverseTree(doc, out); %> <% .......................................(the rest of the code)
whenever i run it in my browser, there will be error like this:
An error occurred at line: 39 in the jsp file: /assignment2/domrecipe.jsp
InputSource cannot be resolved to a type
36: // Create an instance of the DOM parser and parse the document
37: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
38: DocumentBuilder db = dbf.newDocumentBuilder();
39: Document doc = db.parse(new InputSource(new StringReader(xmlResult)));
40:
41: // Begin traversing the document
42: traverseTree(doc, out);
and this:
root cause
java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="UTF-8"?>
(and then the xml string)
so, basically, the xml string has been read, but there are errors in it... can someone help me..
thanks..
![]() |
Similar Threads
- Urgent - Need (2) PHP Web Developers - Seattle, WA only (Web Development Job Offers)
- Sending & receiving XML file using VB.NET Web services (VB.NET)
- pls Help!! how to search for string in a file with C# and Web Services?? (C#)
- pls Help!! how to search for string in a file with C# and Web Services?? (RSS, Web Services and SOAP)
- Inserting dynamic values into Javascript variables (JavaScript / DHTML / AJAX)
- How to read the parsed XML file (DOM parser) (Java)
- Eliminating Whitespace characters while parsing XML Files using DOM (Java)
- How to Parse XML file (RSS, Web Services and SOAP)
- Differences between web services and xml web services (ASP.NET)
- Parse XML from ASP!!! (ASP)
Other Threads in the RSS, Web Services and SOAP Forum
- Previous Thread: htaccess not working
- Next Thread: JBoss Webservice
| Thread Tools | Search this Thread |
.htaccess 301 accept access alltop api authentication binarysecuritytoken blog card collaboration credit data development ebay email evernote flash google government highrise htaccess intel internet legal live patent paypal php podcast proxy redirect rss rssfeeds searchmonkey server service soap software swappingxmlfromflash swappingxmlnodes url web webservices webservicesecurity wiki wikipedia xml xslt y!os yahoo ydn





