Parse XML through Oracle10g
I wanted to parse a XML gfile and store the data in my defined schema and tables. How can that be done ?
Do a search for threads about creating relational views over XML Data. That should provide you with some ideas. There are many complete examples posted in this forum.
Similar Messages
-
Need help on parsing xml file...
Hi all,
I need to collect some data from an Xml file using java. I have the following code with me but I am unable to get the required result. I am unable to get the data from the tags belonging to the header and footer elements. Please find the code and the sample xml file below.
Program to parse XML:
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class JobLogDetails3{
//No generics
List myJobs;
Document dom;
public JobLogDetails3(){
//create a list to hold the job objects
myJobs = new ArrayList();
public void runJobDetails() {
//parse the xml file and get the dom object
parseXmlFile();
//get each joblog element and create a job object
parseDocument();
//Iterate through the list and print the data
printData();
private void parseXmlFile(){
//get the factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
//Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
//parse using builder to get DOM representation of the XML file
dom = db.parse("test.xml");
}catch(ParserConfigurationException pce) {
pce.printStackTrace();
}catch(SAXException se) {
se.printStackTrace();
}catch(IOException ioe) {
ioe.printStackTrace();
private void parseDocument(){
//get the root elememt
Element docEle = dom.getDocumentElement();
//get a nodelist of <joblog> elements
NodeList nl = dom.getElementsByTagName("*");
if(nl != null && nl.getLength() > 0) {
for(int i = 0 ; i < nl.getLength();i++) {
//get the joblog element
Element el = (Element)nl.item(i);
//get the joblog object
Job J = getJob(el);
//add it to list
myJobs.add(J);
* I take an joblog element and read the values in, create
* an joblog object and return it
* @param JobEl
* @return
private Job getJob(Element JobEl) {
//for each <joblog> element get text or int values of
//name ,id, age and name
String jobServer = getTextValue(JobEl,"server");
String jobName = getTextValue(JobEl,"name");
String jobClient = getTextValue(JobEl,"machine_name");
String jobStart = getTextValue(JobEl,"start_time");
String jobType = getTextValue(JobEl,"type");
String jobEnd = getTextValue(JobEl,"end_time");
String jobSize = getTextValue(JobEl,"new_processed_bytes");
//Create a new Job with the value read from the xml nodes
Job J = new Job(jobServer,jobName,jobClient,jobStart,jobType,jobEnd,jobSize);
return J;
* I take a xml element and the tag name, look for the tag and get
* the text content
* i.e for <employee><name>John</name></employee> xml snippet if
* the Element points to employee node and tagName is name I will return John
* @param ele
* @param tagName
* @return
private String getTextValue(Element ele, String tagName) {
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
if(nl != null && nl.getLength() > 0) {
Element el = (Element)nl.item(0);
textVal = el.getFirstChild().getNodeValue();
return textVal;
* Calls getTextValue and returns a int value
* @param ele
* @param tagName
* @return
private int getIntValue(Element ele, String tagName) {
//in production application you would catch the exception
return Integer.parseInt(getTextValue(ele,tagName));
* Iterate through the list and print the
* content to console
private void printData(){
System.out.println("No of Jobs '" + myJobs.size() + "'.");
Iterator it = myJobs.iterator();
while(it.hasNext()) {
System.out.println(it.next().toString());
public static void main(String[] args){
//create an instance
JobLogDetails JLD = new JobLogDetails();
//call run example
JLD.runJobDetails();
Job Class
public class Job {
private String jobServer;
private String jobName;
private String jobClient;
private String jobStart;
private String jobType;
private String jobEnd;
private String jobSize;
public Job(){
public Job(String jobServer,String jobName,String jobClient,String jobStart,String jobType,String jobEnd,String jobSize ) {
this.jobServer = jobServer;
this.jobName = jobName;
this.jobClient = jobClient;
this.jobStart = jobStart;
this.jobType = jobType;
this.jobEnd = jobEnd;
this.jobSize = jobSize;
public String getjobServer() {
return jobServer;
public void setjobServer(String jobServer) {
this.jobServer = jobServer;
public String getjobName() {
return jobName;
public void setjobname(String jobName) {
this.jobName = jobName;
public String getjobClient() {
return jobClient;
public void setjobClient(String jobClient) {
this.jobClient = jobClient;
public String getjobStart() {
return jobStart;
public void setjobStart(String jobStart) {
this.jobStart = jobStart;
public String getjobType() {
return jobType;
public void setjobType(String jobType) {
this.jobType = jobType;
public String getjobEnd() {
return jobEnd;
public void setjobEnd(String jobEnd) {
this.jobEnd = jobEnd;
public String getjobSize() {
return jobSize;
public void setjobSize(String jobSize) {
this.jobSize = jobSize;
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(getjobServer());
sb.append(",");
sb.append(getjobName());
sb.append(",");
sb.append(getjobClient());
sb.append(",");
sb.append(getjobType());
sb.append(",");
sb.append(getjobStart());
sb.append(",");
sb.append(getjobEnd());
sb.append(",");
sb.append(getjobSize());
sb.append(",");
return sb.toString();
Sample XML File:
<?xml version="1.0" encoding="UTF-16" ?>
- <joblog>
<job_log_version version="2.0" />
- <header>
<filler>======================================================================</filler>
<server>Job server: TGBBAK</server>
<name>Job name: TGBSAP4-SQL-SQL DB Servers S2T - High-Weekly Full Backup</name>
<start_time>Job started: 26 September 2011 at 01:00:04</start_time>
<type>Job type: Backup</type>
<log_name>Job Log: GFD_TGBBAK_71887.xml</log_name>
<filler>======================================================================</filler>
</header>
<media_mount_date>Drive and media mount requested: 26/09/2011 01:00:04</media_mount_date>
- <media_drive_and_media_info>
<media_mount_date>Drive and media information from media mount: 26/09/2011 01:00:39</media_mount_date>
<robotic_library_name>Robotic Library Name: HP 1</robotic_library_name>
<drive_name>Drive Name: LTO4_2</drive_name>
<slot>Slot: 43</slot>
<media_label>Media Label: 000059L</media_label>
<media_guid>Media GUID: {a6ca0062-7a6f-4b4b-8144-732ca25f2f9d}</media_guid>
<media_overwrite_date>Overwrite Protected Until: 25/10/2011 19:24:58</media_overwrite_date>
<media_append_date>Appendable Until: 02/10/2011 14:00:30</media_append_date>
<media_set_target>Targeted Media Set Name: Weekly Tape</media_set_target>
</media_drive_and_media_info>
- <backup>
<filler>======================================================================</filler>
<title>Job Operation - Backup</title>
<append_or_overwrite>Media operation - append.</append_or_overwrite>
<compression>Compression Type: Hardware [if available, otherwise none]</compression>
<verify_option>WARNING: The option 'Verify after backup completes' was not selected. Performing a verify operation to make sure that media can be read after the backup has completed is recommended.</verify_option>
<filler>======================================================================</filler>
- <machine>
<machine_name>TGBSAP4.Tetley.Grp</machine_name>
<info>Network control connection is established between 10.22.2.18:3271 <--> 10.22.2.4:10000</info>
<info>Network data connection is established between 10.22.2.18:3301 <--> 10.22.2.4:3094</info>
- <set>
<set_resource_name>TGBSAP4.Tetley.Grp</set_resource_name>
<tape_name>Family Name: "Media created 25/09/2011 13:59:55"</tape_name>
- <volume>
<display_volume>Backup of "TGBSAP4.Tetley.Grp "</display_volume>
</volume>
<description>Backup set #45 on storage media #1 Backup set description: "Weekly Full Backup"</description>
<backup_type>Backup Method: Full - Back up entire database or filegroup</backup_type>
<agent_started>Microsoft SQL Server Agent: Started</agent_started>
<start_time>Backup started on 26/09/2011 at 01:01:45.</start_time>
- <database>
<database>Database PRD</database>
</database>
- <database>
<database>Database master</database>
</database>
- <database>
<database>Database model</database>
</database>
- <database>
<database>Database msdb</database>
</database>
<end_time>Backup completed on 26/09/2011 at 02:42:25.</end_time>
- <summary>
<backed_up_database>Backed up 4 databases</backed_up_database>
<new_processed_bytes>Processed 573363576542 bytes in 1 hour, 40 minutes, and 40 seconds.</new_processed_bytes>
<vlm_hist_rateformat2>Throughput rate: 5432 MB/min</vlm_hist_rateformat2>
</summary>
<filler>----------------------------------------------------------------------</filler>
</set>
</machine>
</backup>
- <footer>
<filler>======================================================================</filler>
<end_time>Job ended: 26 September 2011 at 02:43:12</end_time>
<engine_completion_status>Job completion status: Successful</engine_completion_status>
<filler>======================================================================</filler>
<completeStatus>19</completeStatus>
</footer>
</joblog>1. your code does not compile (in your main method you try to create an instance of a class which does not exist).
2. your XML document is not well formed.
+[Fatal Error] test.xml:34:74: The content of elements must consist of well-formed character data or markup.+
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
Maybe there are other problems but you can start by fixing these. -
How to parse XML in server side javascript (XSJS)?
Hi Experts,
I can get the XML file content through this method:var xmlString = $.response.body.asString() and I need to parse XML. If there XML parser in server side javascript? thanks very much!Hi Wenwen Hou,
There is a blog available at
Parse XML in server side javascript (XSJS)
This can help you achieve parsing xml in server side javascript.
Regards,
Anjali. -
what is the best method for loading external XML (with
inherent HTML) content into Flash and into the TextArea component?
here is the requirement:
i have an image loader and a TextArea together on the screen.
a "story" is loaded which will present a series of images (in the
image loading) associated with a corresponding text (in the
TextArea). a "story" has multiple image/text sections that are
navigatied through with FRWD/BACK buttons. any given section can
also have multiple sub-sections or "frames".
here is a diagram of the flow (in this case there would be 5
click throughs: 5 text/image sequences, but all contained only
within 4 sections):
http://jalaka.com/lab/ia/story_nav.jpg
below is my proposed sample XML structure. i want Flash to
recognize how many sections and frames within sections there are in
each story XML document - in order to generate a corresponding
navigation structure (a tab for each section). HTML content will be
immediate availble to loadinto TextArea as user move forward in
sequence with nav. and images references can also be preloaded into
available MC containers to be swapped into place as user navigates
forward in sequence. also need to read and store attributes for
each node in the XML to come up in MCs in sequence. and must also
be able to parse XML in a way to place simple HTML formatted
content (within XML) into the TextArea.
would Arrays be used?
<story title = "Story Title">
<section num = "1" title = "Section One Title" >
<frame image = "1.jpg" caption = "caption text
here"><b>Content</b><br><br>content
content content</frame>
</section>
<section num = "2" title = "Section Two Title" >
<frame image = "1.jpg" caption = "caption text
here"><b>Content</b><br><br>content
content content</frame>
<frame image = "2.jpg" caption = "caption text
here"><b>Content</b><br><br>content
content content</frame>
</section>
</story>Placing the XML into an array is a great plan. What you want
is each array element to be an object containing the section data.
Another plan is to use a List or Combox component. Again each
data property element would be an object containing the section
data. -
XML parser to parse XML inside HTML file
Hi,
I wish to know is there any other parsers apart from JAXP to parse xml content present inside HTML file. For example,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form id="j_id_jsp_1394907664_1" name="j_id_jsp_1394907664_1" method="post" action="/msaiphoneportal1.1c/pages/xmlchech.faces;jsessionid=5666F0E1CF0E44B978940F021012AA41" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_id_jsp_1394907664_1" value="j_id_jsp_1394907664_1" />
<?xml version="1.0" encoding="UTF-8"?>
<hospital>
<Users>
<User id="1" password="x" type="staff" username="x"/>
<User id="2" password="y" type="staff" username="y"/>
<User id="3" password="z" type="staff" username="z"/>
</Users>
<Survey/>
<Patients>staaatus</Patients>
</hospital>
<input type="hidden" name="j_id_jsp_1394907664_1:j_id_jsp_1394907664_2" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-4298162632826268059:-1507671971163298623" autocomplete="off" />
</form>
</body>
</html>
I need to read the XML content inside. Is there any way please let me know
Edited by: DHURAI on Jul 22, 2010 12:59 AMDHURAI wrote:
while reading, we can fetch the starting of XML through <?xml> tag, but how we know the ending of the XML as it seems to be dynamic.1) Extract the document root element which follows the <?xml ... ?>
2) From this root element , construct the associated root element terminal by inserting a / after the <.
3) Search for the terminal.
If the root name can also be the name of an enclosed element then you will have to count the number of terminals. -
BusinessService error in msg parsing: xml was empty, didn't parse!
Hi
I'm trying to consuming a WebService implemented in PHP, the WS its internal
http://192.168.2.15:81/project/service/ws.wsdl
I created a BusinessService from that WSDL, but when i test the businessService through the sbconsole i get this
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"/>
<faultstring xsi:type="xsd:string">
error in msg parsing:
xml was empty, didn't parse!
</faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<con:metadata xmlns:con="http://www.bea.com/wli/sb/test/config">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:user-header name="X-Powered-By" value="PHP/5.2.1"/>
<tran:user-header name="X-SOAP-Server" value="NuSOAP/0.9.5 (1.123)"/>
<http:Connection>close</http:Connection>
<http:Content-Length>689</http:Content-Length>
<http:Content-Type>text/xml; charset=ISO-8859-1</http:Content-Type>
<http:Date>Wed, 15 Aug 2012 14:55:28 GMT</http:Date>
<http:Server>Apache/2.2.4 (Win32)</http:Server>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">2</tran:response-code>
<tran:response-message xmlns:tran="http://www.bea.com/wli/sb/transports">Internal Server Error</tran:response-message>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">ISO-8859-1</tran:encoding>
<http:http-response-code xmlns:http="http://www.bea.com/wli/sb/transports/http">500</http:http-response-code>
</con:metadata>
-- Added
I forgot to say that the WS works well when i tested with SoapUI
Any help would be apreciated.
Thanks
Edited by: user4159641 on 15-ago-2012 8:00Using the new URL i am able to createBusiness Service, i have pasted the content of the wsdl generated.
wsSitidataEstandar.php.wsdl
<definitions targetNamespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name="arrayData">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="headerArray">
<xsd:all>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="addressOrCoordinate" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfString">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:headerArray[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="sequence">
<xsd:all>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="sequence" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfSequence">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:sequence[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="itinerary">
<xsd:all>
<xsd:element name="text" type="xsd:string"/>
<xsd:element name="cx" type="xsd:string"/>
<xsd:element name="cy" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfItinerary">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:itinerary[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="invalid">
<xsd:all>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="address" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfInvalid">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:invalid[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="arrayresult">
<xsd:all>
<xsd:element name="sequence" type="tns:arrayOfSequence"/>
<xsd:element name="itinerary" type="tns:arrayOfItinerary"/>
<xsd:element name="invalid" type="tns:arrayOfInvalid"/>
<xsd:element name="message" type="xsd:string"/>
<xsd:element name="totalTime" type="xsd:string"/>
<xsd:element name="totalDistanceCalculated" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayresult2">
<xsd:all>
<xsd:element name="geo" type="tns:arrayData"/>
<xsd:element name="message" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<message name="enriquecerRequest">
<part name="direccion" type="xsd:string"/>
<part name="ciudad" type="xsd:string"/>
<part name="barrio" type="xsd:string"/>
<part name="usuario" type="xsd:string"/>
<part name="clave" type="xsd:string"/></message>
<message name="enriquecerResponse">
<part name="return" type="tns:arrayresult2"/></message>
<message name="enriquecerAsistidoRequest">
<part name="direccion" type="xsd:string"/>
<part name="ciudad" type="xsd:string"/>
<part name="barrio" type="xsd:string"/>
<part name="usuario" type="xsd:string"/>
<part name="clave" type="xsd:string"/></message>
<message name="enriquecerAsistidoResponse">
<part name="return" type="tns:arrayresult2"/></message>
<message name="enriquecerXmlLotesRequest">
<part name="xmlEnvio" type="xsd:string"/>
<part name="usuario" type="xsd:string"/>
<part name="clave" type="xsd:string"/></message>
<message name="enriquecerXmlLotesResponse">
<part name="return" type="xsd:string"/></message>
<portType name="wsSitidataEstandarPortType">
<operation name="enriquecer">
<input message="tns:enriquecerRequest"/>
<output message="tns:enriquecerResponse"/>
</operation>
<operation name="enriquecerAsistido">
<input message="tns:enriquecerAsistidoRequest"/>
<output message="tns:enriquecerAsistidoResponse"/>
</operation>
<operation name="enriquecerXmlLotes">
<input message="tns:enriquecerXmlLotesRequest"/>
<output message="tns:enriquecerXmlLotesResponse"/>
</operation>
</portType>
<binding name="wsSitidataEstandarBinding" type="tns:wsSitidataEstandarPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="enriquecer">
<soap:operation soapAction="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php/enriquecer" style="rpc"/>
<input><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="enriquecerAsistido">
<soap:operation soapAction="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php/enriquecerAsistido" style="rpc"/>
<input><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="enriquecerXmlLotes">
<soap:operation soapAction="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php/enriquecerXmlLotes" style="rpc"/>
<input><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="wsSitidataEstandar">
<port name="wsSitidataEstandarPort" binding="tns:wsSitidataEstandarBinding">
<soap:address location="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php"/>
</port>
</service>
</definitions> -
Does JMS parse xml content in TextMessages
Hi
I am working on WLS 6.1sp2 and I am using jms TextMessage type of message to
send XML messages from one subsystem to another. I have added an XML registry
for my version of XML parser. Now I do not have any entries for the entity declarations
nor for the parser entries in the registry.
When I send in an XML message in a TextMessage envelope I find the following
errors in the log.
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML document.
Failed to retrieve PUBLIC id. The root element is required in a well-formed docu
ment.>
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to open XML document. Failed
to retrieve PUBLIC id or SYSTEM id from the document. Decrease the number of cha
r between the beginning of the document and its root element.>
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML document.
Failed to retrieve SYSTEM id. The root element is required in a well-formed docu
ment.>
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to open XML document. Failed
to retrieve PUBLIC id or SYSTEM id from the document. Decrease the number of cha
r between the beginning of the document and its root element.>
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML document.
Failed to retrieve root tag. The root element is required in a well-formed docum
ent.>
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Could not instantiate factory class
specified in the Server console. Invalid parameters: at least one of publicId,
s
ystemId, rootTag must be non-null>
[ChangeAwareClassLoader] : Name is : META-INF/services/org.apache.xerces.xni.par
ser.XMLParserConfiguration
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to open XML document. Failed
to retrieve PUBLIC id or SYSTEM id from the document. Decrease the number of cha
r between the beginning of the document and its root element.>
<Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML document.
Failed to retrieve PUBLIC id. The root element is required in a well-formed docu
ment.>
Now from the logs I understand that the message is being parsed and since the
parser does not find any PUBLIC ID or SYSTEM id it dumps the error, since I am
using schemas there is none of the PUBLIC and SYSTEM ids in my xml, also this
is not logged by any component of my subsystems, this is a weblogic XML Service
log and when I trace through the code I find that it comes up after the first
subsystem sends the message and before the second subsystem receives it.
The question then is does JMS parse XML content in TextMessages and if so how
can I disable that parsing?
Thanks
Sandeep
JMS does not automatically parse TextMessages. Check the XML declaration in
your application's deployment descriptors. That's often the source of this
error.
FYI, you can use XMLMessage for xml payloads. As far as I can remember, the
XMLMessage is an extension of the TextMessage with xml parsing built in.
Adarsh
"Sandeep Nayak" <[email protected]> wrote in message
news:[email protected]...
>
> Hi
>
> I am working on WLS 6.1sp2 and I am using jms TextMessage type of message
to
> send XML messages from one subsystem to another. I have added an XML
registry
> for my version of XML parser. Now I do not have any entries for the entity
declarations
> nor for the parser entries in the registry.
>
> When I send in an XML message in a TextMessage envelope I find the
following
> errors in the log.
>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML
document.
> Failed to retrieve PUBLIC id. The root element is required in a
well-formed docu
> ment.>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to open XML document.
Failed
> to retrieve PUBLIC id or SYSTEM id from the document. Decrease the number
of cha
> r between the beginning of the document and its root element.>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML
document.
> Failed to retrieve SYSTEM id. The root element is required in a
well-formed docu
> ment.>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to open XML document.
Failed
> to retrieve PUBLIC id or SYSTEM id from the document. Decrease the number
of cha
> r between the beginning of the document and its root element.>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML
document.
> Failed to retrieve root tag. The root element is required in a well-formed
docum
> ent.>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Could not instantiate factory
class
> specified in the Server console. Invalid parameters: at least one of
publicId,
> s
> ystemId, rootTag must be non-null>
> [ChangeAwareClassLoader] : Name is :
META-INF/services/org.apache.xerces.xni.par
> ser.XMLParserConfiguration
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to open XML document.
Failed
> to retrieve PUBLIC id or SYSTEM id from the document. Decrease the number
of cha
> r between the beginning of the document and its root element.>
> <Jun 9, 2003 3:56:57 PM PDT> <Error> <XML> <Failed to parse given XML
document.
> Failed to retrieve PUBLIC id. The root element is required in a
well-formed docu
> ment.>
>
> Now from the logs I understand that the message is being parsed and since
the
> parser does not find any PUBLIC ID or SYSTEM id it dumps the error, since
I am
> using schemas there is none of the PUBLIC and SYSTEM ids in my xml, also
this
> is not logged by any component of my subsystems, this is a weblogic XML
Service
> log and when I trace through the code I find that it comes up after the
first
> subsystem sends the message and before the second subsystem receives it.
>
> The question then is does JMS parse XML content in TextMessages and if so
how
> can I disable that parsing?
>
> Thanks
>
> Sandeep
-
I need help with parsing xml data in PL/SQL. I was able to read the attribute name & values but not able to read the element text.Any help is greatly appreciated.Following is the anonymous block and the desired output -
Declare
nl xmldom.DOMNodeList;
len1 number;
len2 number;
n xmldom.DOMNode;
e xmldom.DOMElement;
nnm xmldom.DOMNamedNodeMap;
attrname varchar2(100);
attrval varchar2(100);
doc xmldom.DOMDocument;
p xmlparser.Parser;
in_xml clob;
begin
-- get all elements
p := xmlparser.newParser;
in_xml := '<?xml version="1.0" encoding="utf-8"?>
<Issue>
<T_ISSUE_TITLE ID = "1">Test Issue</T_ISSUE_TITLE>
<T_ISSUE_DESC ID = "2">Update Test Issue</T_ISSUE_DESC>
<STATUS ID = "3">2</STATUS>
<ISSUE_SD ID = "4">07/09/10</ISSUE_SD>
<ISSUE_ED ID = "5">09/09/10</ISSUE_ED>
<CREATE_DT ID = "6">07/09/10</CREATE_DT>
<CREATE_USER_ID ID = "7">John</CREATE_USER_ID>
<LST_UPD_USER_ID ID = "8">John</LST_UPD_USER_ID>
</Issue>';
xmlparser.parseClob(p,in_xml);
doc :=xmlparser.getDocument(p);
nl := xmldom.getElementsByTagName(doc, '*');
len1 := xmldom.getLength(nl);
-- loop through elements
for j in 0..len1-1 loop
n := xmldom.item(nl, j);
e := xmldom.makeElement(n);
dbms_output.put_line(xmldom.getTagName(e) || ':');
-- get all attributes of element
nnm := xmldom.getAttributes(n);
len2 := xmldom.getLength(nnm);
if (xmldom.isNull(nnm) = FALSE) then
len2 := xmldom.getLength(nnm);
-- loop through attributes
for i in 0..len2-1 loop
n := xmldom.item(nnm, i);
--dbms_output.put_line(n);
attrname := xmldom.getNodeName(n);
attrval := xmldom.getNodeValue(n);
dbms_output.put_line(' ' || attrname || ' = ' || attrval);
end loop;
end if;
end loop;
end;
/** Output
Issue:
T_ISSUE_TITLE:
ID = 1, Test Issue
T_ISSUE_DESC:
ID = 2, Update Test Issue
STATUS:
ID = 3, 2
ISSUE_SD:
ID = 4, 07/09/10
ISSUE_ED:
ID = 5, 09/09/10
CREATE_DT:
ID = 6, 07/09/10
CREATE_USER_ID:
ID = 7, John
LST_UPD_USER_ID:
ID = 8, John
Thank You.Use dbms_xslprocessor.valueOf and dbms_xmldom.getnodevalue to get the value of node
eg: l_doc is paresed XML doc with nodes as partdetails and part
declare
l_n dbms_xmldom.DOMNode;
l_nl dbms_xmldom.DOMNodeList;
l_partname varchar2(100);
begin
---parsing code--
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/PartDetails/Part');
FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_emp);
dbms_xslprocessor.valueOf(l_n,'Name/text()',l_partname);
dbms_output.put_line(l_partname);
end loop;
end;Edited by: SBH on Jul 13, 2010 11:06 AM -
I need to parse XML DOM in flash......
server side script is sending one var "req" through that XML
DOM
And after parsing that XML DOM i'll get a XML again from
which i need to parse the path to load an imageJSTL has an <x:parse> element, doesn't it? At any rate "I need JSP code" sounds very much like a JSP question to me. There's a JSP forum.
-
Parse XML Inbound Interface file
What are SAP best practices to parse XML Inbound Interface file?
Currently we are parsing XML Inbound file with custom ABAP code, but it is somewhat cumbersome and requires maintenance.
We do not any middleware that can parse file for us.
Is there is any best way we can handle this without lot of maintenance..You can do it thro XLST..
Check this links..
Upload XML to internal table and vice versa in SAP 4.6C
/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
YOu can do it through XLST. it is supported in ABAP from 4.7. you can create a XSLT, and read you XML, then CALL TRANSFORMATION to convert a XML into ABAP data structure.
reference link:
http://help.sap.com/saphelp_nw04/helpdata/en/fd/9d7348389211d596a200a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/bb/576670dca511d4990b00508b6b8b11/content.htm
Reward each helpful answer.
Raja T
Message was edited by:
Raja Thangamani -
Generating XML through PL/SQL
Hi everyone,
I got a new task at work, and my task is to generate XML through PL/SQL.
I am using Oracle 11g database, and SQL Developer 3.0.
The purpose of this procedure is to upload xml file to a queue, so my BPEL process can access the queue and do what it does.
This is my first time writing a procedure that generates xml so bear with me.
Below is a sample of the xml file I received. I need to generate xml file below through PL/SQL. All the information in xml file will need to be retrieved from the database.
I need your help to start working on this procedure. Your help is very much appreciated.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.ussc.gov/soa/casefile/event/types">
<caseFileUploadEvent xmlns:xsi="http://www.w3XX.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.XXXX.gov/soa/casefile/event/types ../xsd/Case_META.xsd"
xmlns="http://www.XXXX.gov/soa/casefile/event/types">
<taskEvent>SUBMIT</taskEvent>
<defendentDetails>
<sentensingDate>2008-11-10-05:00</sentensingDate>
<personDetails>
<personNameDetails>
<firstName>FIRSTNAME</firstName>
<middleName>B</middleName>
<lastName>LASTNAME</lastName>
</personNameDetails>
<dateOfBirth>1969-09-23-04:00</dateOfBirth>
</personDetails>
</defendentDetails>
<documentStatusDetails>
<otherStatus>
<intCode>61</intCode>
<description>Other documents included</description>
</otherStatus>
</documentStatusDetails>
<uploadOtherDetails>
<submissionId>427000447</submissionId> // NOTE: SUBMISSIONID WILL BE PASSED IN THROUGH THE PROCEDURE TO QUERY ALL THE INFORMATION NEEDED FOR THE XML FILE
<submissionSessionId>401622</submissionSessionId>
<submissionMethod>
<intCode>1</intCode>
<description>WebApplication</description>
</submissionMethod>
<submissionReason>
<intCode>1</intCode>
<description>InitialSubmission</description>
</submissionReason>
<district>
<intCode>99</intCode>
<description>Test District</description>
</district>
<caseFileType>
<intCode>10</intCode>
<description>Individual - Original</description>
</caseFileType>
<primaryDocketInfo>
<yearYY>5</yearYY>
<id>55555</id>
<defendentNumber>555</defendentNumber>
</primaryDocketInfo>
<PACTSId>55555555</PACTSId>
<AOJudgeId>
<intCode>2512</intCode>
<description>FABER, DAVID, A.</description>
</AOJudgeId>
<missingCasefile>false</missingCasefile>
<creator>
<firstName>will</firstName>
<lastName>smith</lastName>
<email>[email protected]</email>
<actionDate>2005-09-07T09:48:09.811-04:00</actionDate>
</creator>
<lastModifier>
<firstName>john</firstName>
<lastName>doe</lastName>
<email>[email protected]</email>
<actionDate>2006-10-03T08:51:21.5-04:00</actionDate>
</lastModifier>
</uploadOtherDetails>
</caseFileUploadEvent>
</soap:Body>
</soap:Envelope>procedure below
procedure upload_process(submission_id number) as
begin
-- retrieve information from database based on submission_id (passed in)
-- generate XML
-- send xml to queue
end upload_process;ThanksRooney,
First of all, I would use Oracle package UTL_DBWS to handle web service calls.
But if you choose to do all the work yourself to call web service, this is one of the options:
Since the size of your xml soap request is about 4k, you can just use pl/sql varchar2 variable to construct your xml.
Example:
cSoapRequest VARCHAR2(5000);
BEGIN
cSoapRequest := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.ussc.gov/soa/casefile/event/types">
<caseFileUploadEvent xmlns:xsi="http://www.w3XX.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.XXXX.gov/soa/casefile/event/types ../xsd/Case_META.xsd"
xmlns="http://www.XXXX.gov/soa/casefile/event/types">';
FOR recRow IN <your cursor> LOOP
cSoapRequest := cSoapRequest || '<dateOfBirth>'|| TO_CHAR(recRow.DOB,'YYYY-MM-DD HH:MI' )|| '</dateOfBirth>';
END LOOP;
...Then use package utl_http to send the request and recieve response.
Google pl/sql webservice,
Here is one:
Calling Web Service from PL/SQL (ORA-31011: XML parsing failed)
Hope this will give you an idea.
Thomas -
How to parse xml clientside in a PDF
I need to polulate a drop down and then a listbox with data from a hidden field. The data is different every time i load the form so i have to use Livecycle forms to put the xml in a hidden field.
Doesn anyone have an example that parses xml client side in the PDF?It can, and if you are taking the XML from a hidden field then that's the way to go.
But if you're using Forms to merge the XML in, you really don't need to have a hidden field bound to it. You could just use script against the data DOM and do it directly into drop down and list box. Basically you'd use resolveNodes() to get a NodeList of the ndoes you are interesting in. The loop through the NodeList and add the values to your fields.
Chris
Adobe Enterprise Developer Support -
When using saxParser.parse(XMLfile, handler) to parse XML file, How to stop the parsing but not exit. I catched thread interrupted in startElement(), but can not stop it because it still go through all other startElement()s and endElement()s. Is there any method or class can stop parse XML?
Appreciate your help!
EdwardPlease look at the technote:
http://access1.sun.com/technotes/01185.html
Hope this helps.
Michelle Cope
Sun Microsystems. -
Script for parsing xml data and inserting in DB
Thank you for reading.
I have the following example XML in an XML file. I need to write a script that can insert this data into an Oracle table. The table does not have primary keys. The data just needs to be inserted.
I do not have xsd file in this scenario. Please suggest how to modify Method 1 https://community.oracle.com/thread/1115266?tstart=0 mentioned so that I can call the XML mentioned below and insert into a table
Method 1
Create or replace procedure parse_xml is
l_bfile BFILE;
l_clob CLOB;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_file dbms_xmldom.DOMNodeList;
l_filen dbms_xmldom.DOMNode;
lv_value VARCHAR2(1000);
l_ch dbms_xmldom.DOMNode;
l_partname varchar2(100);
l_filename varchar2(1000);
l_temp VARCHAR2(1000);
TYPE tab_type IS TABLE OF tab_software_parts%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
l_bfile := BFileName('DIR1', 'SoftwareParts.xml');
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
dbms_lob.loadFromFile(dest_lob => l_clob, src_lob => l_bfile, amount => dbms_lob.getLength(l_bfile));
dbms_lob.close(l_bfile);
dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/PartDetails/Part');
FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_emp);
t_tab.extend;
dbms_xslprocessor.valueOf(l_n,'Name/text()',l_partname);
t_tab(t_tab.last).partname := l_partname;
l_file := dbms_xslprocessor.selectNodes(l_n,'Files/FileName');
FOR cur_ch IN 0 .. dbms_xmldom.getLength(l_file) - 1 LOOP
l_ch := dbms_xmldom.item(l_file, cur_ch);
lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_ch));
if t_tab(t_tab.last).partname is null then t_tab(t_tab.last).partname := l_partname; end if;
t_tab(t_tab.last).filename := lv_value;
t_tab.extend;
END LOOP;
END LOOP;
t_tab.delete(t_tab.last);
FOR cur_emp IN t_tab.first .. t_tab.last LOOP
if t_tab(cur_emp).partname is not null and t_tab(cur_emp).filename is not null then
INSERT INTO tab_software_parts
VALUES
(t_tab(cur_emp).partname, t_tab(cur_emp).filename);
end if;
END LOOP;
COMMIT;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;
<TWObject className="TWObject">
<array size="240">
<item>
<variable type="QuestionDetail">
<questionId type="String"><![CDATA[30]]></questionId>
<questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
<country type="String"><![CDATA[GB]]></country>
<questionText type="String"><![CDATA[Please indicate]]></questionText>
<optionType type="String"><![CDATA[RadioButton]]></optionType>
<answerOptions type="String[]">
<item><![CDATA[Yes]]></item>
<item><![CDATA[No]]></item>
</answerOptions>
<ruleId type="String"><![CDATA[CRP_GB001]]></ruleId>
<parentQuestionId type="String"></parentQuestionId>
<parentQuestionResp type="String"></parentQuestionResp>
</variable>
</item>
<item>
<variable type="QuestionDetail">
<questionId type="String"><![CDATA[40]]></questionId>
<questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
<country type="String"><![CDATA[DE]]></country>
<questionText type="String"><![CDATA[Please indicate]]></questionText>
<optionType type="String"><![CDATA[RadioButton]]></optionType>
<answerOptions type="String[]">
<item><![CDATA[Yes]]></item>
<item><![CDATA[No]]></item>
</answerOptions>
<ruleId type="String"><![CDATA[CRP_Q0001]]></ruleId>
<parentQuestionId type="String"></parentQuestionId>
<parentQuestionResp type="String"></parentQuestionResp>
</variable>
</item>
</array>
</TWObject>Reposted as
Script to parse XML data into Oracle DB -
LO Error 26005 Failed to parse XML
Good Afternoon,
I currently have an Xcelsius document that is attached to a Crystal Report that is in Infoview. I have it connected by using Live Office. The Crystal report basically contains a cross tab of data and is run nightly in our system. I bring back the data into Excel in order to build an Xcelsius document off of it. I havent' been using the Live Office piece all that much until recently therefore please excuse my ignorance. I setup my data connection as a Live Office connection. My server connection seems to be correct:
http://WHGCRYSTAL3:8080/dswsbobje/services/session
However, when I try to refresh the document, I get the following error:
soapenv:Server.generalException: Failed to parse XML. (LO 26005)
Any ideas as to what this could be? I have Crystal Xcelsius Enterprise 2008. The version is 5.0.0.99 and the build number is 12,0,0,121. I think I am all updated on service packs but I could be wrong. Any help is appreciated.I downloaded all of the service packs and fixes and now I am up to date. I am still getting the error with an additional error. This is what is says:
Failed to parse XML. (LO 26005) (LO 26000)
Any other ideas as to why this is happening?
Maybe you are looking for
-
About a week ago I turned the hold button on and couldn't get the hold button to turn off for almost then an hour. Then it just stopped and I haven't had the problem since. For the last three days, I've been having a different problem with the hold b
-
The GR value and GR cancellation value are different.
Dear All, Could you please help me with ths? We have posted a GR and then cancel it but the values are different. Price control for material is S and there were: -No change to PO price -No material movements between 2 document postings -No invoices p
-
Why is the giving me this error (method does not return a value) PLEASE !!
I have this code and it is giving me this error and I don't know how to fix it can anyone out there tell me why I have included the next line of code as I have had problems in the curly brackets in the past. The error is "Client.java": Error #: 466 :
-
Why do I have to sign in every time i want to read
Why do I have to sign into iBooks every time I want to read, especially if I'm in the middle of a book.
-
I need to user payslip function on the self service but I am doing implementation on global international hrms setup we are working on so there is no standard localization from oracle. Edited by: user5321329 on Mar 1, 2011 6:30 AM