Loading XML file with missing elements dynamically through ODI
Hi Guys ,
I have the below xml file with two nodes Employee and Address. On a daily basis , sometimes the address element might not come in from the source xml file , but my interface has columns mapped to address elements, and hence it can fail due to the source element not being found in the file or data might not get loaded due to the 'and' condition in the sql query generated between the employee and address elements. Is there a way where i can load the data dynamically where i can search in the file only for the elements (Employee) present and load data only for those elements dynamically?
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<EMP>
<Empsch>
<Employee>
<EmployeeID>12345</EmployeeID>
<Initials>t</Initials>
<LastName>john</LastName>
<FirstName>doe</FirstName>
</Employee>
<Address>
<WorkPhone>12345</WorkPhone>
<WorkAddress>Test 234</WorkAddress>
</Address>
</Empsch>
</EMP>
Thanks ,
Revanth Tambisetty
I was able to resolve it by using left outer joins and referring the table structure from the XSD
Similar Messages
-
Failed to load XML file with Content ID 'XYZ'
Hello,
We are using UCM Version:11.1.1.8.1DEV-2014-01-06 04:18:30Z-r114490 (Build:7.3.5.185) with site studio for creating templates and web sites.
While switching to contribution mode, we find 'Failed to load XML file with Content ID 'XYZ' error.[Here XYZ is the local checkin content]
In region we are using dynamic converter to convert the style of native document here below are region and its element details.
<region id="region3" name="Add_Content_Here" flags="1111111100100" metadata="xIdcProfile%3AisHidden%3Dtrue%26xTemplateType%3AisHidden%3Dtrue%26xShowInStaff%3AisHidden%3Dtrue%26xShowInVisitors%3AisHidden%3Dtrue%26xShowInFaculty%3AisHidden%3Dtrue%26xDiscussionCount%3AisHidden%3Dtrue%26xDiscussionType%3AisHidden%3Dtrue" dccommand="ssIncDynamicConversionByRule(SS_DATAFILE, 'Colleges_Template_Rule')">
<!--$region3_ACTIONS="EIMPRS",region3_DCCOMMAND="ssIncDynamicConversionByRule(SS_DATAFILE, 'Colleges_Template_Rule')" -->
<element id="region3_element1" name="Editor" label="Editor" type="1" flags="111111111111111111111100000111100000000000001111001110111010001111101000000000000000000000000000">
<!--$region3_element1="Add_Content_Here/Editor" -->
<linktoregioncontent createnewxml="true" createnewnative="false" choosemanaged="true" chooselocal="false" choosenone="false">
<choosemanagedquerytext corecontentonly="FALSE">
<![CDATA[xWebsiteObjectType <Matches> `Data File` <OR> xWebsiteObjectType <Matches> `Native Document`]]>
</choosemanagedquerytext>
</linktoregioncontent>
</element>
<switchregioncontent createnewxml="true" createnewnative="true" choosemanaged="true" chooselocal="false" choosenone="false">
<createnewnativedoctypes >
<![CDATA[.doc,.docx,.txt,.rtf]]>
</createnewnativedoctypes>
<choosemanagedquerytext corecontentonly="FALSE">
<![CDATA[xWebsiteObjectType <Matches> `Data File` <OR> xWebsiteObjectType <Matches> `Native Document`]]>
</choosemanagedquerytext>
<defaultmetadata >
<![CDATA[xIdcProfile%3AisHidden%3Dtrue%26xTemplateType%3AisHidden%3Dtrue%26xCollegesList%3AisHidden%3Dtrue%26xShowInStudents%3AisHidden%3Dtrue%26xShowInStaff%3AisHidden%3Dtrue%26xShowInVisitors%3AisHidden%3Dtrue%26xShowInFaculty%3AisHidden%3Dtrue%26xArticleSection%3AisHidden%3Dtrue%26xDiscussionCount%3AisHidden%3Dtrue%26xDiscussionType%3AisHidden%3Dtrue%26dpTriggerValue%3DCSE]]>
</defaultmetadata>
</switchregioncontent>
</region>
<!--SS_BEGIN_OPENREGIONMARKER(region3)--><!--$SS_REGIONID="region3"--><!--$include ss_open_region_definition --><!--SS_END_OPENREGIONMARKER(region3)-->
<!--SS_BEGIN_ELEMENT(region3_element1)--><!--$ssIncludeXml(SS_DATAFILE,region3_element1 & "/node()")--><!--SS_END_ELEMENT(region3_element1)-->
<!--SS_BEGIN_CLOSEREGIONMARKER(region3)--><!--$include ss_close_region_definition --><!--SS_END_CLOSEREGIONMARKER(region3)-->
Regardrs,
SyedHi Syed ,
Add the following trace sections :
requestaudit,sitestudio*,system + Full verbose tracing
Clear the server output .
Replicate the same steps and once error shows up , refresh server output and copy the logs to a text file and upload here .
Thanks,
Srinath -
Create XML file with worksheet's dynamically assigned through XSLT
Hi all
I have a requirement to create a xml file with worksheets dynamically created based on a field value in the internal table .
I have all my values in internal table, and am calling the transformation from bsp application.
Say the internal table has field dataxyz, for every change in value in this field dataxyz i need to create separate worksheet and populate that sheet with some corresponding values .
please guide me how to create worksheet dynamically.
thanks in advance.
Bharathy
Edited by: elam.bharathy on May 16, 2011 6:51 AMCan you use a schema when we compose XML doc from Database tables?
Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me. -
Loading xml file with multiple rows
I am loading data from xml files using xsl for transformation. I have created xsl's and loaded some of the data. In an xml file with multiple row, it's only loading one (the first) row. Any idea how I can get it to read and load all the records in the file???
Could some please help me with the above. I desparately need to move forward.
-
Transforming xml file with different elements into HTML
hi all !
i have an xml object that has been generated from database using java. the xml file has numerous elements that have been merged into single file. all elements have been got from different table :-
<?xml version = '1.0' ?>
<ROWSET>
<ROW id= "1">
<EMPID>1</EMPID>
<EMPADDRESS>H 3 STREET 4</EMPADDRESS>
<EMPPHONE>98764653</EMPPHONE>
</ROW>
<ROW id="2">
<EMPID>5</EMPID>
<EMPQUAL>GRADE 12</EMPQUAL>
<EMPGRADE>A</EMPGRADE>
</ROW>
</ROWSET>
(its just a sample data, might not be wel formed)
as it shows that each element "ROW" has data corresponding to different employee and with different details. actually these elemnt are the updates in an employee profile that have to be communicated to a distant located database. what i need is a tranformation into HTML so that the recieving user can view this file as html with relative headings of corresponding tables.
(the schema at both ends is exact replica)
any help in this regards would be obliging.thank you bro!
the xml file has been created by importing multiple files resulted from XSU into a master file in java. we are running a web based project in a distributed environment. so i would need to make this page appear in a web browser with ACCEPT and REJECT command buttons as the receiver is the approving agent. what all i have thought of so far is to create a style sheet with templates of all heading of each table from where the data is coming from and then run a check on what table the data is from and place that specific heading on the entry. the style sheet would be placed at both ends so only the xml file will be transported and transformation would be done auto.
i hope it works. but am not sure wether its the right approach or not. -
How can (parse) i use XML file with missing EndTag
hi,
i have an application which writes an "XML file".
another application should read that XML file, build an DOM and
access the nodes with xpath.
my problem. if the first application is not finished there are tags
missing. e.g. </xml>. but the seconds application cannot wait until the first application finishes it task.
if i now read the XML file the parser cannot load it because the end tags are missing.
my question:
how can i deactivate the check or how can i read the XML file and access it via XPath (my application is using at the moment XPath to access the nodes and i dont want to change that)
as parser i am using XERCES
alexAs far as I know, you can't do this - xml must be well formed (this is sort of a bedrock of xml). There may be some work around's, but I'm not aware of any - and they would most likely be hacks.
-
Target XML Files with optional elements
Hi All,
I am using ODI 10.1.3.4. My task is to create an XML file of the following format:
<parent count="2">
<child>
<name>Fred</name>
<age>15</age>
<email>[email protected]</email>
</child>
<child>
<name>Bob</name>
<age>5</age>
*<email />*
</child>
</parent>
I have been able to successfully create a target file. But the file does NOT contain the empty elements. ie the email element for Bob is missing from my target file.
Is there any way to configure the XML connection or the "create xmlfile" command to output the empty element?
Many Thanks
NatAfter speaking to BEA support it appears as though there is a partial solution to this issue. If you add the attributes minOccurs="0" nillable="true" to the elements then the SOAP message is correct. i.e.
<xs:complexType name="SIDSearchCriteriaStructure">
<xs:sequence>
<xs:choice>
<xs:element ref="SIDUniqueReference" minOccurs="0" nillable="true"/>
<xs:element ref="SIDOtherCriteria" minOccurs="0" nillable="true"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
I say that this is only a partial fix because elements cannot have minOccurs and nillable attribtes when they are references (as opposed to named elements - e.g. <xs:element name="SIDDNA" type="RestrictedStringType"/>). This is according to XMLSpy anyway. Don't know whether it's W3C legal though.
Nick -
Error loading xml file with sqlldr
Hi there,
I am having trouble loading an xml file via sqlldr into oracle.
The version i am running is Oracle Database 10g Release 10.2.0.1.0 - 64bit Production and the file size is 464 MB.
It ran for about 10 hours trying to load the file and then threw up the error:
ORA-22813: operand value exceeds system limits.
I have loaded a file of 170MB using the same process succesfully.
Any Ideas?
Cheers,
Dan.Looked a bit into the issue (ORA-22813) and although it can be caused by a lot of issues varrying database versions, you could have a go at sizing up your PGA database parameter. See Oracle support Doc ID 837220.1 for more info.
The following might help
CREATE OR REPLACE PROCEDURE show_pga_memory (context_in IN VARCHAR2 DEFAULT NULL)
SELECT privileges required on:
SYS.v_$session
SYS.v_$sesstat
SYS.v_$statname
Here are the statements you should run:
GRANT SELECT ON SYS.v_$session TO <schema>;
GRANT SELECT ON SYS.v_$sesstat TO <schema>;
GRANT SELECT ON SYS.v_$statname TO <schema>;
IS
l_memory NUMBER;
BEGIN
SELECT st.VALUE
INTO l_memory
FROM SYS.v_$session se, SYS.v_$sesstat st, SYS.v_$statname nm
WHERE se.audsid = USERENV ('SESSIONID')
AND st.statistic# = nm.statistic#
AND se.SID = st.SID
AND nm.NAME = 'session pga memory';
DBMS_OUTPUT.put_line (CASE WHEN context_in IS NULL
THEN NULL
ELSE context_in || ' - '
END
|| 'PGA memory used in session = ' || TO_CHAR (l_memory));
END show_pga_memory;
/ -
Problem loading xml file with method
I am using this method to insert into table of xmltype
INSERT INTO xml_table
VALUES (XMLType(bfilename('XMLDIR','Test_xml.xml'),
nls_charset_id('AL32UTF8')));
xml gives error
<?xml version="1.0"?>
<!--<!DOCTYPE metadata SYSTEM "http://www.esri.com/metadata/esriprof80.dtd">-->
<metadata xml:lang="en"><Esri><MetaID>{299847D5-3DDC-4375-9469-607DC669DD6E}</MetaID><CreaDate>20091029</CreaDate><CreaTime>12035600</CreaTime><SyncOnce>FALSE</SyncOnce><SyncDate>20091029</SyncDate><SyncTime>12054400</SyncTime><ModDate>20091029</ModDate><ModTime>12054400</ModTime></Esri><idinfo><native Sync="TRUE">Microsoft Windows XP Version 5.1 (Build 2600) Service Pack 3; ESRI ArcCatalog 9.3.0.1770</native><descript><langdata Sync="TRUE">en</langdata><abstract>REQUIRED: A brief narrative summary of the data set.</abstract><purpose>REQUIRED: A summary of the intentions with which the data set was developed.</purpose>
but when i remove
<!--<!DOCTYPE metadata SYSTEM "http://www.esri.com/metadata/esriprof80.dtd">-->
it successfully executes and value is inserted of xmltype
Please suggest how i can insert the original xml without error.SQL> call UTL_HTTP.set_proxy('proxy.mydomain.com:8080', NULL);
Call completed.
SQL> declare
2 t_result
3 varchar2(4000);
4 begin
5 t_result := utl_http.request('http://www.fgdc.gov/metadata/fgdc-std-001-1998.dtd');
6 INSERT INTO xml_table
7 VALUES (XMLType(bfilename('XMLDIR','bas_street_segment.xml'),
8 nls_charset_id('AL32UTF8')));
9 end;
10 /
declare
ERROR at line 1:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1577
ORA-12545: Connect failed because target host or object does not exist
ORA-06512: at line 5
It is giving error, we made a call to UTL_HTTP.set_proxy, it is ok.
Is there a way that i have dtd file, fgdc-std-001-1998.dtd on local machine and dtd gets validated when i
insert the xml without need for oracle to go to internet. I need both dtd validation with internet and from local path options.
Please help, thankx for timely help
sivaram -
Loading XML File into Oracle 10G XE
I am trying to load an XML file into 10G XE from the Utilities interface, I have created a Table to load into but when I try to load I get the following cryptic error "XML Load Error". There is no other information, can someone give me some insight where to start to resolve this problem?
The error messages when importing fails provided by APEX 2.1 are not very useful as they do not provide any clue...
If possible, you can try to load XML file with SQL*Loader - probably you will get then more useful error messages. -
I have been having problems since updating to the latest version of Numbers.
When I try to open files I am getting an error.
"The document “'13 Tax Prep .numbers” is invalid.
The index.xml file is missing."
Anyone else getting this message? Anyone know how to fix the issue?Jeff Shenk wrote:
Numbers 3.1 can recognize both the new files without the index.xml file and the old ones with it, which it imports to the new format.
Agreed on that part. But take it a step further. If Numbers 3.1 is asked to open an old document that is still in the old Numbers 2 format that relies on an index.xml file but Numbers 3.1 can't find the index.xml file (perhaps the document is corrupted) then how can Numbers 3.1 open the document and interpret it in order to convert it to the new format? My guess is that this a possible trigger for the 'index.xml missing' error message.
Interesting link here on the new document format.
SG -
Error while loading XML files into scott user
Hi All,
I'm new to xml files. I need to load xml files into database through OWB.
I have xml file in my local machine & am trying to load into table PO of Scott. Scott is registered as repository user.
Followed same steps as specified in userguide.
But, when executing the procedure ( in two ways one as just table name, and other as user.table name) it is showing the below error:
Procedure is:(1)--with username.tablename
begin
wb_xml_load(
'<OWBXMLRuntime>'||
'<XMLSource>'||
'<file>&&SAMPLES_DIR.sample1.xml</file>'||
'</XMLSource>'||
'<targets>'||
'<target dateFormat="yyyy.MM.dd">scott.PO</target>'||
'</targets>'||
'</OWBXMLRuntime>'
end;
ERROR at line 1:
ORA-20006: Error occurred while truncating target database object SCOTT.PO.
Base exception: ORA-01031: insufficient privileges
ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
ORA-06512: at "SCOTT.SAMPLE1", line 3
ORA-06512: at line 1
Procedure is:(2) with out username
begin
wb_xml_load(
'<OWBXMLRuntime>'||
'<XMLSource>'||
'<file>&&SAMPLES_DIR.sample1.xml</file>'||
'</XMLSource>'||
'<targets>'||
'<target dateFormat="yyyy.MM.dd">PO</target>'||
'</targets>'||
'</OWBXMLRuntime>'
end;
ERROR at line 1:
ORA-20006: Error occurred while truncating target database object PO.
Base exception: ORA-00942: table or view does not exist
ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
ORA-06512: at line 2
xml file:
<ROWSET>
<ROW>
<ID>100</ID>
<ORDER_DATE>2000.12.20</ORDER_DATE>
<SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
<SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
<SHIPTO_CITY>Redwood City</SHIPTO_CITY>
<SHIPTO_STATE>CA</SHIPTO_STATE>
<SHIPTO_ZIP>94065</SHIPTO_ZIP>
</ROW>
</ROWSET>
Note: Everything works fine if I create PO table in OWBSYS user and execute the procedurein OWBSYS user. OWBSYS.PO table will be loaded.
What privileges are missing, what shouldI do if I want to execute the procedure from scott user and load the table of scott.
Thanks in advance for the help.
Regards,
JoshnaHi Joshna,
Please follow below steps to load xml file to oracle database.
1.First connect to owb (Design Center) through your repository owner user (ex : REP_OWNER).
2. Import WB_XML_LOAD procedure . and exit to repository owner.
3. connect to owb design center through your repository user (ex : REP_USER)
Create New mapping and drag one Constant Operator and create one attribute, paste / edit following code
'<OWBXMLRuntime>'||
'<XMLSource>'||
'<file>E:\SOURCE\emp.xml</file>'||
'</XMLSource>'||
'<targets>'||
'<target truncateFirst = "FALSE" dateFormat="yyyy.MM.dd">rep_user.emp</target>'||
'</targets>'||
'</OWBXMLRuntime>'
4. Drag pre mapping operator and select WB_XML_LOAD procedure
5. Connect Constant Operator attribute to pre mapping operator.
6. Drag two dummy tables and connect source to target. (ex : drag t1 (table) tab two times and connect.
7. Validate and deploy the mapping.
8. grant necessary grant command to rep_owner user to rep_user user.
(Note : target truncateFirst = "FALSE" by default truncate the table. So you have to give grant privileges
To rep_user , select ,insert, delete privileges.
9. Execute the mapping , and check EMP table. (Note : before loading EMP table delete all records ).
10 . If you want more description please go through the below link
http://download.oracle.com/docs/html/A95931_01/apf.htm
Regards
Venkat -
Load XML file from addon domain without cross-domain Policy file
Hello.
Assuming that there are two addon domains on the same server: /public_html/domain1.com and /public_html/domain2.com
I try to load XML file from domain2.com into domain1.com without using cross-domain policy file (since it doesn’t work on xml files in my case).
So the idea is to use php file in order to load XML and read it back to flash.
I’ve found an interesting scripts that seems to do the job but unfortunately I can't get it to work. In my opinion there is somewhere problem with AS3 part. Please take a look.
Here are the AS3/PHP scripts:
AS3 (.swf in www.domain1.com):
// location of the xml that you would like to load, full http address
var xmlLoc:String = "http://www.domain2.com/MyFile.xml";
// location of the php xml grabber file, in relation to the .swf
var phpLoc:String = "loadXML.php";
var xml:XML;
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest(phpLoc+"?location="+escape(xmlLoc) );
loader.addEventListener(Event.COMPLETE, onXMLLoaded);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorHandler);
loader.load(request);
function onIOErrorHandler(e:IOErrorEvent):void {
trace("There was an error with the xml file "+e);
function onXMLLoaded(e:Event):void {
trace("the rss feed has been loaded");
xml = new XML(loader.data);
// set to string, since it is passed back from php as an object
xml = XML(xml.toString());
xml_txt.text = xml;
PHP (loadXML.php in www.domain1.com):
<?php
header("Content-type: text/xml");
$location = "";
if(isset($_GET["location"])) {
$location = $_GET["location"];
$location = urldecode($location);
$xml_string = getData($location);
// pass the url encoded vars back to Flash
echo $xml_string;
//cURLs a URL and returns it
function getData($query) {
// create curl resource
$ch = curl_init();
// cURL url
curl_setopt($ch, CURLOPT_URL, $query);
//Set some necessary params for using CURL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Execute the curl function, and decode the returned JSON data
$result = curl_exec($ch);
return $result;
// close curl resource to free up system resources
curl_close($ch);
?>I think you might be right about permissions/settings on the server for php. Unfortunately I'm not allowed to adjust them.
So I wrote my own script - this time I used file path instead of http address of the XML file. It works fine in my case.
Here it is:
XML file on domain2.com:
<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<image imagePath="galleries/gallery_1/images/1.jpg" thumbPath="galleries/gallery_1/thumbs/1.jpg" file_name= "1"> </image>
<image imagePath="galleries/gallery_1/images/2.jpg" thumbPath="galleries/gallery_1/thumbs/2.jpg" file_name= "2"> </image>
<image imagePath="galleries/gallery_1/images/3.jpg" thumbPath="galleries/gallery_1/thumbs/3.jpg" file_name= "3"> </image>
</gallery>
swf on domain1.com:
var imagesXML:XML;
var variables:URLVariables = new URLVariables();
var varURL:URLRequest = new URLRequest("MyPHPfile.php");
varURL.method = URLRequestMethod.POST;
varURL.data = variables;
var MyLoader:URLLoader = new URLLoader;
MyLoader.dataFormat =URLLoaderDataFormat.VARIABLES;
MyLoader.addEventListener(Event.COMPLETE, XMLDone);
MyLoader.load(varURL);
function XMLDone(event:Event):void {
var imported_XML:Object = event.target.data.imported_XML;
imagesXML = new XML(imported_XML);
MyTextfield_1.text = imagesXML;
MyTextfield_2.text = imagesXML.image[0].attribute("thumbPath"); // sample reference to attribute "thumbPath" of the first element
php file on domain1.com:
<?php
$xml_file = simplexml_load_file('../../domain2.com/galleries/gallery_1/MyXMLfile.xml'); // directory to XML file on the same server
$imported_XML = $xml_file->asXML();
print "imported_XML=" . $imported_XML;
?>
Regards
PS: for those who read the above discussion: the first and the second script work but you must test which one is better in your situation. The first script will also work between two domains on different servers. No cross domain policy file needed. -
Create xml file with values from context
Hi experts!
I am trying to implement a WD application that will have some input fields, the value of those input fields will be used to create an xml file with a certain format and then sent to a certain application.
Apart from this i want to read an xml file back from the application and then fill some other context nodes with values from the xml file.
Is there any standard used code to do this??
If not how can i do this???
Thanx in advance!!!
P.S. Points will be rewarded to all usefull answers.
Edited by: Armin Reichert on Jun 30, 2008 6:12 PM
Please stop this P.S. nonsense!Hi,
you need to create three util class for that:-
XMLHandler
XMLParser
XMLBuilder
for example in my XML two tag item will be there e.g. Title and Organizer,and from ur WebDynpro view you need to pass value for the XML tag.
And u need to call buildXML()function of builder class to generate XML, in that i have passed bean object to get the values of tags. you need to set the value in bean from the view ui context.
Code for XMLBuilder:-
Created on Apr 4, 2006
Author-Anish
This class is to created for having function for to build XML
and to get EncodedXML
and to get formated date
package com.idb.events.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.idb.events.Event;
public class XMLBuilder {
This attribute represents the XML version
private static final double VERSION_NUMBER = 1.0;
This attribute represents the encoding
private static final String ENCODING_TYPE = "UTF-16";
/*Begin of Function to buildXML
return: String
input: Event
public String buildXML(Event event) {
StringBuffer xmlBuilder = new StringBuffer("<?xml version=\"");
xmlBuilder.append(VERSION_NUMBER);
xmlBuilder.append("\" encoding=\"");
xmlBuilder.append(ENCODING_TYPE);
xmlBuilder.append("\" ?>");
xmlBuilder.append("<event>");
xmlBuilder.append(getEncodedXML(event.getTitle(), "title"));
xmlBuilder.append(getEncodedXML(event.getOrganizer(), "organizer"));
xmlBuilder.append("</event>");
return xmlBuilder.toString();
/End of Function to buildXML/
/*Begin of Function to get EncodedXML
return: String
input: String,String
public String getEncodedXML(String xmlString, String tag) {
StringBuffer begin = new StringBuffer("");
if ((tag != null) || (!tag.equalsIgnoreCase("null"))) {
begin.append("<").append(tag).append(">");
begin.append("<![CDATA[");
begin.append(xmlString).append("]]>").append("</").append(
tag).append(
">");
return begin.toString();
/End of Function to get EncodedXML/
/*Begin of Function to get formated date
return: String
input: Date
private final String formatDate(Date inputDateStr) {
String date;
try {
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("yyyy-MM-dd");
date = simpleDateFormat.format(inputDateStr);
} catch (Exception e) {
return "";
return date;
/End of Function to get formated date/
Code for XMLParser:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLParser {
Enables namespace functionality in parser
private final boolean isNameSpaceAware = true;
Enables validation in parser
private final boolean isValidating = true;
The SAX parser used to parse the xml
private SAXParser parser;
The XML reader used by the SAX parser
private XMLReader reader;
This method creates the parser to parse the user details xml.
private void createParser()
throws SAXException, ParserConfigurationException {
// Create a JAXP SAXParserFactory and configure it
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware(isNameSpaceAware);
saxFactory.setValidating(isValidating);
// Create a JAXP SAXParser
parser = saxFactory.newSAXParser();
// Get the encapsulated SAX XMLReader
reader = parser.getXMLReader();
// Set the ErrorHandler
This method is used to collect the user details.
public Event getEvent(
String newsXML,
XMLHandler xmlHandler,
IWDMessageManager mgr)
throws SAXException, ParserConfigurationException, IOException {
//create the parser, if not already done
if (parser == null) {
this.createParser();
//set the parser handler to extract the
reader.setErrorHandler(xmlHandler);
reader.setContentHandler(xmlHandler);
InputSource source =
new InputSource(new ByteArrayInputStream(newsXML.getBytes()));
reader.parse(source);
//return the results of the parse
return xmlHandler.getEvent(mgr);
Code for XMLHandler:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
Created on Apr 12, 2006
Author-Anish
*This handler class is created to have constant value for variables and function for get events,
character values for bean variable,
parsing thr date ......etc
package com.idb.events.util;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import java.util.*;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLHandler extends DefaultHandler {
private static final String TITLE = "title";
private static final String ORGANIZER = "organizer";
IWDMessageManager manager;
private Event events;
private String tagName;
public void setManager(IWDMessageManager mgr) {
manager = mgr;
This function is created to get events
public Event getEvent(IWDMessageManager mgr) {
manager = mgr;
return this.events;
This function is created to get character for setting values through event's bean setter method
public void characters(char[] charArray, int startVal, int length)
throws SAXException {
String tagValue = new String(charArray, startVal, length);
if (TITLE.equals(this.tagName)) {
this.events.setTitle(tagValue);
if (ORGANIZER.equals(this.tagName)) {
String orgName = tagValue;
try {
orgName = getOrgName(orgName);
} catch (Exception ex) {
this.events.setOrganizer(orgName);
This function is created to parse boolean.
private final boolean parseBoolean(String inputBooleanStr) {
boolean b;
if (inputBooleanStr.equals("true")) {
b = true;
} else {
b = false;
return b;
This function is used to call the super constructor.
public void endElement(String uri, String localName, String qName)
throws SAXException {
super.endElement(uri, localName, qName);
/* (non-Javadoc)
@see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
This function is used to call the super constructor.
public void fatalError(SAXParseException e) throws SAXException {
super.fatalError(e);
This function is created to set the elements base on the tag name.
public void startElement(
String uri,
String localName,
String qName,
Attributes attributes)
throws SAXException {
this.tagName = localName;
if (ROOT.equals(tagName)) {
this.events = new Event();
public static void main(String a[]) {
String cntry = "Nigeria";
XMLHandler xml = new XMLHandler();
ArrayList engList = new ArrayList();
engList = xml.getCountries();
ArrayList arList = xml.getArabicCountries();
int engIndex = engList.indexOf(cntry);
System.out.println("engIndex :: " + engIndex);
String arCntryName = (String) arList.get(engIndex);
System.out.println(
">>>>>>>>>>>>>>>>>>>>" + xml.getArabicCountryName(cntry));
Hope that may help you.
If need any help , you are most welcome.
Regards,
Deepak -
I can't open any documents from my son's iPad. Error message: the required index.xml file is missing. How do I fix this error so that I can open his Pages documents? Before I ran the latest update as prompted when I opened Pages, I WAS able to open and view the document.
I did try restoring Pages using my Time Machine, but it still won't open the Pages document.
I have a brand new iMac that I just set up last week.
Son uses iPad at school, so we update when the school asks him to update. Will doublecheck his version of Pages but it should be pretty recent.
In general I don't like using Pages because it lacks a lot of the backwards / forwards compatibilty of Microsoft Word.
However, it is what my son uses with the iPad.
Most of the time I have to export his files as WORD files because we never seem to have compatible versions of Pages between the iPad and the desktop iMacs.
Where can I recommend that Apple improve its compatibility issues with Pages?
This week I am going to receive a new iPad at my school (I am a teacher) but I am 100% certain that it will not be compatible with the older version of Pages on my classroom iMac. I also avoid using Keynote for the same reason. I have 15 year old Power Points that I can still open, but I am hesitant to switch over to Keynote because I want to be able to open my files any time, any where.
Please advise.Not sure what v5 is. Someone helped me and opened it through Pages 5.2, through the program, rather than the Finder. Thanks for making a suggestion!
Maybe you are looking for
-
Error in Background job for Status refresh after SP15
Hi, I am having a issue after applying SP 15 in our Solman Production. Bckg Job REFRESH MESSAGE STATUS for refereshing message status which was working fine uptil SP10 now its giving us following error At least one entry could not be found in object
-
Hi, I am new to you and I am having problems with my Windows Media. I ran a fix it test on it and it came back saying that the player is corrupt and can not read the dll. Plus I have gotten pop-ups saying the script on the page had quit running 2 or
-
PreparedStatement.setDate(new java.sql.Date(long))
Anyone knows how to set insert a Date with Time, Day, Year into a database? I have tried using the preparedStatement.setDate(new java.sql.Date(long)) but it only inserts yyyy mm dd but I want to include time too. Anyone knows how here? Please advice.
-
Extract filter will not come up in Photoshop CS4 64 bit
I have put the extactPlus into the Plug-ins folder. I close and open Photoshop. the extract filter is not there. What can I do?
-
How to restore mail account from time machine
Hi there, I would like to restore all my accounts and mails from the time machine. Unfortunately it doesn't seem that either Mail or time machine give this option. Is this possible? Thanks in advance