Xml DOM Exception
Hi,
I've copied and pased the DOM example from the java's tutorials section, but when I try to run it I'm getting the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ranges/DocumentRange
Any ideas????
Thanks
yawn Classpath.
Similar Messages
-
Nullpointer exception while multiple users reading from XML DOM object
We are getting a null pointer exception when we are trying to read from a Static XML DOM object . We are getting the exception in weblogic 7.1 very rarely but started getting the exception in weblogic 9.2 more frequently. When multiple users are trying to access the Static variable we are getting null pointer exception. I think it is a memory related issue. Making the whole method synchronized is resolving the issue. But that is not the right thing to do. Can any one know what might be the issue here?
I am giving the code and the XML. I have tried to give the latest Xerces parser from the Apache site but got the same exception. Please help me in this regard.
The XML is also provided below along with the code.
package com.test;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
//import org.apache.xml.serialize.XMLSerializer;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class ObjectPersistanceXMLParser {
public static volatile Document configXML;
* @param objectName
* @param attributeName
* @return
* @throws Throwable
public static ArrayList getData(String objectName,String attributeName) throws Exception
Node ndDoc = getXMLDoc();
Node ndRoot = ndDoc.getFirstChild();
NodeList ndFirstList = ndRoot.getChildNodes();
BeanInfo bi = Introspector.getBeanInfo(ndFirstList.getClass());
System.out.println("****** "+bi.getBeanDescriptor().getBeanClass().getName());
System.out.println("This is the number of child nodes present:"+ndFirstList.getLength()+":::"+ndFirstList.item(0).getNodeValue());
ArrayList returnResult = null;
String strReturnResult = null;
for(int i=0;i<ndFirstList.getLength();i++)
if(ndFirstList.item(i).getNodeName().equals("ObjectDBMapping"))
NodeList ndObjectList = ndFirstList.item(i).getChildNodes();
for(int j=0;j<ndObjectList.getLength();j++)
if(ndObjectList.item(j).getNodeName().equals("Object"))
if(ndObjectList.item(j).getAttributes().getNamedItem("NAME").getNodeValue().equalsIgnoreCase(objectName))
NodeList ndFieldList = ndObjectList.item(j).getChildNodes();
for(int k=0;k<ndFieldList.getLength();k++)
if(ndFieldList.item(k).getNodeName().equals("field"))
if(ndFieldList.item(k).getAttributes().getNamedItem("NAME").getNodeValue().equalsIgnoreCase(attributeName))
returnResult = new ArrayList();
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("SOURCE_TABLE").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("SOURCE_COLUMN").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("TYPE").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("PERSIST").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("DEFAULT_VALUE").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("PRIMARY_KEY").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("VERSIONABLE").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("PRECISION").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("FOREIGN_KEY").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("PARENT_TABLE").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("PARENT_COLUMN").getNodeValue());
returnResult.add(ndFieldList.item(k).getAttributes().getNamedItem("LEVEL").getNodeValue());
//return returnResult;
if(strReturnResult == null){
System.out.println("This is the current state of dom: ");
//printDom((Document)ndDoc);
if(!attributeName.trim().equalsIgnoreCase("class") &&
!attributeName.trim().equalsIgnoreCase("operationFlag")&&
!attributeName.trim().equalsIgnoreCase("primaryKeyColumnName")&&
!attributeName.trim().equalsIgnoreCase("tableName"))
System.out.println("No DB Mapping found for Object "+objectName+" and attribute "+attributeName);
return returnResult;
* @param objectName
* @param tableName
* @return
* @throws Throwable
public static int getMaxFields(String objectName,String tableName) throws Throwable
Node ndDoc = getXMLDoc();
Node ndRoot = ndDoc.getFirstChild();
NodeList ndFirstList = ndRoot.getChildNodes();
int returnResult = 0;
for(int i=0;i<ndFirstList.getLength();i++)
if(ndFirstList.item(i).getNodeName().equals("ObjectDBMapping"))
NodeList ndObjectList = ndFirstList.item(i).getChildNodes();
for(int j=0;j<ndObjectList.getLength();j++)
if(ndObjectList.item(j).getNodeName().equals("Object"))
if(ndObjectList.item(j).getAttributes().getNamedItem("NAME").getNodeValue().equalsIgnoreCase(objectName))
NodeList ndFieldList = ndObjectList.item(j).getChildNodes();
for(int k=0;k<ndFieldList.getLength();k++)
if(ndFieldList.item(k).getNodeName().equals("field"))
if(ndFieldList.item(k).getAttributes().getNamedItem("SOURCE_TABLE").getNodeValue().equalsIgnoreCase(tableName) &&
ndFieldList.item(k).getAttributes().getNamedItem("PERSIST").getNodeValue().equalsIgnoreCase("Y"))
returnResult++;
return returnResult;
/*This method returns a Document Object of the ObjectConfig.xml file. This method is separated
* out from the calling method to keep an option OPEN in case it is later decided to read XML
* from memory instead of physical location.*/
public static Document getXMLDoc() throws Exception
if(configXML == null)
synchronized (ObjectPersistanceXMLParser.class)
if(configXML == null)
if(System.getProperty("OBJECT-CONFIG-XML") == null){
System.out.println("System Property OBJECT-CONFIG-XML not found");
String filePath = System.getProperty("OBJECT-CONFIG-XML");
System.out.println("Reading CONFIG Xml from file - "+filePath);
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
BeanInfo bi = Introspector.getBeanInfo(docBuilderFactory.getClass());
System.out.println("****** "+bi.getBeanDescriptor().getBeanClass().getName());
try
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
configXML = docBuilder.parse(filePath);
}catch(Throwable t)
int errorCode = 111;
String errorMsg = "Problem in parsing OBJECT-CONFIG-XML file";
System.out.println(errorMsg);
else
System.out.println("Config XML Loaded from memory.....new");
return configXML;
public static void main(String args[]) throws Throwable
/*public synchronized static void printDom(Document doc){
XMLSerializer ser = new XMLSerializer(System.out, null);
try {
ser.serialize(doc);
} catch (Throwable e) {
e.printStackTrace();
System.out.flush();
<?xml version="1.0"?><root>
<ObjectDBMapping>
<Object NAME="com.los.common.entity.LoanTask">
<field NAME="loanTaskId" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="LOAN_TASK_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="Y"
VERSIONABLE="Y" FOREIGN_KEY="N" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="taskId" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="TASK_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="Y" PARENT_TABLE="UWM_TASK_MASTER" PARENT_COLUMN="TASK_ID">
</field>
<field NAME="taskName" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="TASK_NAME" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="taskStatus" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="TASK_STATUS" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="taskCreationDate" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="TASK_CREATION_DATE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="taskClosureDate" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="TASK_CLOSURE_DATE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="taskClosedBy" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="TASK_CLOSED_BY" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="updatedDate" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="UPDATED_DATE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="updatedBy" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="UPDATED_BY" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="createdDate" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="CREATED_DATE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="createdBy" SOURCE_TABLE="UW_LOAN_TASKS"
SOURCE_COLUMN="CREATED_BY" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
</Object>
<Object NAME="com.los.common.entity.LOSUnderwritingRules">
<field NAME="undwRunRuleId" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="UNDW_RUN_RULE_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="Y"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="underwritingRunNo" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="UNDERWRITING_RUN_NO" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="underwritingRunId" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="UNDERWRITING_RUN_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="ruleGroup" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="RULE_GROUP" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="ruleName" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="RULE_NAME" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="messageCode" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="MESSAGE_CODE" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="messageText" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="MESSAGE_TEXT" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="passFail" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="PASS_FAIL" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="overrideAuthorityLevel" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="OVERRIDE_AUTHORITY_LEVEL" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="overrideYN" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="OVERRIDE_Y_N" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="overrideBy" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="OVERRIDE_BY" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="overrideOn" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="OVERRIDE_ON" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="createdBy" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="CREATED_BY" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="updatedBy" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="UPDATED_BY" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="createdDate" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="CREATED_DATE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="updatedDate" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="UPDATED_DATE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="processName" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="PROCESS_NAME" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="overrideReason" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="OVERRIDE_REASON" TYPE="VARCHAR2" LENGTH="1000"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="messageModule" SOURCE_TABLE="UW_UNDERWRITING_RULES"
SOURCE_COLUMN="MESSAGE_MODULE" TYPE="VARCHAR2" LENGTH="30"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
</Object>
<Object NAME="com.los.common.entity.Applicant">
<field NAME="applicantId" SOURCE_TABLE="UW_APPLICANT_MASTER"
SOURCE_COLUMN="APPLICANT_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="Y"
VERSIONABLE="N" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="registrationNumber" SOURCE_TABLE="UW_APPLICANT_MASTER"
SOURCE_COLUMN="REGISTRATION_NUMBER" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="N" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="cifNumber" SOURCE_TABLE="UW_APPLICANT_MASTER"
SOURCE_COLUMN="CIF_NUMBER" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="N" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="customerStatus" SOURCE_TABLE="UW_APPLICANT_MASTER"
SOURCE_COLUMN="CUSTOMER_STATUS" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="N" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="customerType" SOURCE_TABLE="UW_APPLICANT_MASTER"
SOURCE_COLUMN="CUSTOMER_TYPE" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="N" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantLastName" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="APPLICANT_LAST_NAME" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantFirstName" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="APPLICANT_FIRST_NAME" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantMiddleName" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="APPLICANT_MIDDLE_NAME" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantNameSuffix" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="APPLICANT_NAME_SUFFIX" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="nationality" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="NATIONALITY" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="age" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="AGE" TYPE="NUMBER" LENGTH="5"
PRECISION="2" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="dateOfBirth" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="DATE_OF_BIRTH" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="identificationType1" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="IDENTIFICATION_TYPE1" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="identificationType2" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="IDENTIFICATION_TYPE2" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="identificationType" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="IDENTIFICATION_TYPE" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="identificationNumber1" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="IDENTIFICATION_NUMBER1" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="identificationNumber2" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="IDENTIFICATION_NUMBER2" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="identificationNumber" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="IDENTIFICATION_NUMBER" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="guarantorIndicator" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="GUARANTOR_INDICATOR" TYPE="VARCHAR2" LENGTH="50"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="separateCobDisclosureRequir" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="SEPARATE_COB_DISCLOSURE_REQUIR" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="domesticRisk" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="DOMESTIC_RISK" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="crossBorderRisk" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="CROSS_BORDER_RISK" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="title" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="TITLE" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="previousSurname" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="PREVIOUS_SURNAME" TYPE="VARCHAR2" LENGTH="50"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="legalName" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="LEGAL_NAME" TYPE="VARCHAR2" LENGTH="200"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="preferredName" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="PREFERRED_NAME" TYPE="VARCHAR2" LENGTH="50"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="gender" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="GENDER" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="seniorCitizenStatus" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="SENIOR_CITIZEN_STATUS" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="staffIndicator" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="STAFF_INDICATOR" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="warVeteranIndicator" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="WAR_VETERAN_INDICATOR" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="noOfDependants" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="NO_OF_DEPENDANTS" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="maritalStatus" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="MARITAL_STATUS" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="educationStatus" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="EDUCATION_STATUS" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="detApplicantId" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="APPLICANT_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="Y" PARENT_TABLE="UW_APPLICANT_MASTER" PARENT_COLUMN="APPLICANT_ID">
</field>
<field NAME="detApplicantDetailId" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="APPLICANT_DETAIL_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="Y"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="usResidentIndicator" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="US_RESIDENT_INDICATOR" TYPE="VARCHAR2" LENGTH="1"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="employeeNumber" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="EMPLOYEE_NUMBER" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="isdefaulter" SOURCE_TABLE="UW_APPLICANT_DETAILS"
SOURCE_COLUMN="ISDEFAULTER" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="2" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
</Object>
<Object NAME="com.los.common.entity.ApplicantContact">
<field NAME="applicantId" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="APPLICANT_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="Y" PARENT_TABLE="UW_APPLICANT_MASTER" PARENT_COLUMN="APPLICANT_ID">
</field>
<field NAME="contactId" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="CONTACT_ID" TYPE="NUMBER" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="Y"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="addressType" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="ADDRESS_TYPE" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantAddressLine1" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="APPLICANT_ADDRESS_LINE_1" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantAddressLine2" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="APPLICANT_ADDRESS_LINE_2" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantAddressLine3" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="APPLICANT_ADDRESS_LINE_3" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantAddressLine4" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="APPLICANT_ADDRESS_LINE_4" TYPE="VARCHAR2" LENGTH="100"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="residingSince" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="RESIDING_SINCE" TYPE="DATE" LENGTH=""
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="residentialStatus" SOURCE_TABLE="UW_APPLICANT_CONTACT_INFO"
SOURCE_COLUMN="RESIDENTIAL_STATUS" TYPE="VARCHAR2" LENGTH="20"
PRECISION="" PERSIST="Y" LEVEL="1" DEFAULT_VALUE="" PRIMARY_KEY="N"
VERSIONABLE="Y" FOREIGN_KEY="" PARENT_TABLE="" PARENT_COLUMN="">
</field>
<field NAME="applicantEMaCould you please provide the stack trace?
-
How to Parse a string into an XML DOM ?
Hi,
I want to parse a String into an XML DOM. Not able to locate any parser which supports that. Any pointers to this?Download Xerces from xml.apache.org. Place the relevant JAR's on your classpath. Here is sample code to get a DOM document reference.
- Saish
public final class DomParser extends Object {
// Class Variables //
private static final DocumentBuilder builder;
private static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
/** W3C schema definitions */
private static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
// Constructors //
static {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
builder = factory.newDocumentBuilder();
builder.setErrorHandler(new ErrorHandler() {
public void warning(SAXParseException e) throws SAXException {
System.err.println("[warning] "+e.getMessage());
public void error(SAXParseException e) throws SAXException {
System.err.println("[error] "+e.getMessage());
public void fatalError(SAXParseException e) throws SAXException {
System.err.println("[fatal error] "+e.getMessage());
throw new XmlParsingError("Fatal validation error", e);
catch (ParserConfigurationException fatal) {
throw new ConfigurationError("Unable to create XML DOM document parser", fatal);
catch (FactoryConfigurationError fatal) {
throw new ConfigurationError("Unable to create XML DOM document factory", fatal);
private DomParser() {
super();
// Public Methods //
public static final Document newDocument() {
return builder.newDocument();
public static final Document parseDocument(final InputStream in) {
try {
return builder.parse(in);
catch (SAXException e) {
throw new XmlParsingError("SAX exception during parsing. Document is not well-formed or contains " +
"illegal characters", e);
catch (IOException e) {
throw new XmlParsingError("Encountered I/O exception during parsing", e);
}- Saish -
How to SAVE a updated XML DOM Data to the file?
Hi
I am able to load an XML file into a XML DOM object using JAVA (xerces). I have update the required data in the DOM.
But I am NOT able to save back the data to the physical file.
Will appreciate if you can help me ASAP.Hi Krishar,
Check out the jaxp new release on java.sun.com. This api has classes and methods to help you do the same.
sample code:
try
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
java.net.URL url = this.getClass().getResource(XML_FILE);
java.io.File thsFile = new java.io.File(url.getFile());
DocumentBuilder builder = factory.newDocumentBuilder();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
document = builder.parse(thsFile);
//You can do any modification to the document here
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(thsFile);
transformer.transform(source, result);
catch (TransformerConfigurationException tce)
System.out.println("\n** Transformer Factory error");
System.out.println(" " + tce.getMessage());
Throwable x = tce;
if (tce.getException() != null)
x = tce.getException();
x.printStackTrace();
catch (TransformerException te)
System.out.println("\n** Transformation error in add:");
System.out.println(" " + te.getMessage());
Throwable x = te;
if (te.getException() != null)
x = te.getException();
x.printStackTrace();
catch (SAXException sxe)
System.out.println("sax exp" + sxe.getMessage());
catch (Exception ex)
System.out.println("exc exp" + ex);
ex.printStackTrace();
Hope this will help you XML_FILE is constant representing the path of the file. It should be in classpath. The program essentially parsing a xml file and creating dom document and then writing it back to the same file. you can do any modifications/write to other file etc...
Think this will suffice your requirement
bye
take care
Hi
I am able to load an XML file into a XML DOM object
using JAVA (xerces). I have update the required data
in the DOM.
But I am NOT able to save back the data to the
physical file.
Will appreciate if you can help me ASAP. -
Below is a method which reads a specific file and uses xml dom to find some values
public void createDBFromXML(File file){
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(file);
document.getDocumentElement().normalize();
//System.out.println("Root element "+document.getDocumentElement().getNodeName());
NodeList node;
//node = document.getElementsByTagName("cat");
node = document.getElementsByTagName("question");
final int N = 4;
Question q;
for (int i = 0; i < node.getLength(); i++) {
Node firstNode = node.item(i);
if (firstNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) firstNode;
String question;
String[] selection;
int answer; int category;
NodeList qElemntList = element.getElementsByTagName("q");
Element qElement = (Element) qElemntList.item(0);
NodeList qE = qElement.getChildNodes();
//System.out.println("q:"+ ((Node)qE.item(0)).getNodeValue());
question = ((Node)qE.item(0)).getNodeValue();
selection = new String[N];
NodeList c1ElemntList = element.getElementsByTagName("c1");
Element c1Element = (Element) c1ElemntList.item(0);
NodeList c1E = c1Element.getChildNodes();
//System.out.println("q:"+ ((Node)c1E.item(0)).getNodeValue());
//Node node = c1E.item(0);
selection[0] = ((Node)c1E.item(0)).getNodeValue();
System.out.println(node == null);
NodeList c2ElemntList = element.getElementsByTagName("c2");
Element c2Element = (Element) c2ElemntList.item(0);
NodeList c2E = c2Element.getChildNodes();
//System.out.println("q:"+ ((Node)c2E.item(0)).getNodeValue());
selection[1] = ((Node)c2E.item(0)).getNodeValue();
} catch (Exception e) {
e.printStackTrace();
}the file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<cat>
<question>
<q>1 question1</q>
<c1>choice1</c1>
<c2>choice2</c2>
<c3>choice3</c3>
<c4>choice4</c4>
<ans>4</ans>
</question>
<question>
<q>1 question2</q><c1>choice1</c1>
<c2>choice2</c2>
<c3>choice3</c3>
<c4>choice4</c4>
<ans>2</ans>
</question>I get these errors:
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:674)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:362)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1416)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
at XmlDB.Database.createDBFromXML(Database.java:34)
at MainGame.Main.main(Main.java:23)
BUILD SUCCESSFUL (total time: 2 seconds)elias85 wrote:
how can i read those characters? They are greekThey are in a wrong encoding, so at this point there's nothing that you can do. Make sure that the XML is generated correctly in the first place.
A valid XML file always has a defined encoding. If nothing is defined in the XML header then it's UTF-8. If your XML file doesn't define anything else and still contains non-UTF-8 encoded data, then it's invalid. -
How to write into file from xml dom Object
Hello,
I try to transform my xml DOM document object into
file. I try the following:
try {
// Prepare the DOM document for writing
DOMSource source = new DOMSource(newDoc);
// Prepare the output file
File file = new File(myHomeRep + "btLom.xml");
StreamResult result = new StreamResult(file);
// Write the DOM document to the file
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
} catch (TransformerConfigurationException e) {
} catch (TransformerException e) {
But my file is empty.
I do it with some wel formed xml tree document, thus I am certain
that the xml tree exists.
Could you explane me please what I am doeing wrong,
or is there are some possibility to make from my xml dom object
a file.
In advance much thanks,
JuliaHere's one thing you are doing wrong:} catch (TransformerConfigurationException e) {
} catch (TransformerException e) {
}With this code, if an exception occurs then you are guaranteed to know nothing about it. At the minimum do this:} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
} -
I am attempting to install AIA Foundation Pack on a SOA domain and continually encounter an XML parsing exception error as the installer is attempting to install WSM security policies. Here are the key details:
AIA version = 11.1.1.5
SOA Suite = 11.1.1.5
WebLogic = 10.3.5
Operating System = Fedora14 (a home lab machine but I don't think this is an OS issue)
The error is encountered about 17 minutes into the lengthy process. Just before the error appears in the installation log, the following message appears indicating roughly what step is being performed:
[zip] Building zip: /opt/oraclemw/aia11115/aia_instances/dev1/tmp/aia_security_policies.zip
The core error messages are:
[exec] SEVERE: WSM-01605 XML parser exception
[exec] oracle.xml.parser.v2.XMLParseException: Expected 'EOF'.
[exec] at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:323)
The python modules being executed by the WLST scripting tool at the time of the failure are:
[exec] Problem invoking WLST - Traceback (innermost last):
[exec] File "/opt/oraclemw/aia11115/Infrastructure/Install/AID/lib/py/importpolicy.py", line 29, in ?
[exec] File "/opt/oraclemw/oracle_common/common/wlst/wsmManage.py", line 719, in importRepository
[exec] File "/opt/oraclemw/oracle_common/common/wlst/lib/ora_util.py", line 51, in raiseScriptingException
[exec] OracleScriptingException: None
Finally, the outer XML files being used as input for the deployer that seems to be running at the time are:
/opt/oraclemw/aia11115/Infrastructure/Install/AID/AIAExecuteDriver.xml
with references to lines 221 and 64.
The problem occurs whether I try to use Java JDK 16.0.20 or JRockit R28.2.0 as the JRE when running the AIA installer. (The WebLogic domain is configured to use JRockit).
Any suggestions? Is there a library conflict being picked up between different releases of XercesImpl? I would hope there isn't actually a bad XML file in the AIA artifacts or WSM (Web Service Management) policies being deployed.HI
How this issue was resolved? Please explain in detail. I am facing the same issue.
Regards
Arun -
there is a bug in XML DOM API in Safari for Windows. The same bug was in FireFox 2 https://bugzilla.mozilla.org/show_bug.cgi?id=206053
Hmm... how to report it to Apple?You should use the following function instead:
public NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName) -
Payload XML DOM Object Update using Java Embedding
Hi,
I have a Java Embedding activity which updates the payload after making
a call to a local EJB. The EJB sends back updated information. In my Java
Embedding activity i try to update the payload nodes with the new information.
It get's really cumbersome to do this sort of thing in BPEL. Basically i am trying
to remove an existing node in the payload and replace it with a new node.
I did so may things that i really don't remember what are they. Finally i managed to
update the payload with the following code.
org.w3c.dom.Element payload = (org.w3c.dom.Element)getVariableData("inputVariable","payload","/MSG");
org.w3c.dom.Element oldNode = (org.w3c.dom.Element)getVariableData("inputVariable","payload","/MSG/TSLData");
org.collaxa.thirdparty.dom4j.Element tslElem = com.collaxa.cube.xml.dom.DOMFactory.convertToCollaxaElement(oldNode);
oldNode = (org.w3c.dom.Element)getVariableData("inputVariable","payload","/MSG/REC");
payload.removeChild(oldNode);
msgElem = com.collaxa.cube.xml.dom.DOMFactory.convertToCollaxaElement(payload);
msgElem.add(recElem);
I feel that there no proper interface to update the data in the payload values with
nodes, string etc. It would be nice if we don't have to work with
com.collaxa.cube.xml.dom.DOMFactory
org.collaxa.thirdparty.dom4j.Element
the collaxa classes.
We need to have more than setVariableData, bascally good payload manipulation API's.
Let me know if there are any alternatives to do this.
Thanks,
Senthil LI have been having the same difficulties. Were you able to find any documentation or javadocs for the Collaxa libraries? If so, I would greatly appreciate locating them.
-
Jbuilder compiler problem with xml DOM - please help.
my problem is that I am using jbuilder 4 professional to compile/run my code.
However I want to use the XML DOM but jbuilder does not appear to support the necessary packages for use with XML.
How can I get round this.
Can I compile instead from the command line - I am using JDK1.4 which supports the java xml packages necessary. Or is there a way of adding the necessary files to my project?
thanks, BAdd the required jar files to your project properties->classpath in JBuilder
The only problem is that. I have been using JBuilder without any problems. -
Getting error with selectSingleNode in XML DOM
I have some pages that utilitize the following in XML DOM:
loadXML
selectSingleNode
getElementsByTagName
I am using JavaScript. I am getting "undefined" errors. Anyone know the proper syntax/capitalization for these methods when using Safari. I had a similiar error with IE 7.0 and posting via an xmlHTTPPost. The problem there was capitalization of one of the methods.
Thanks.
PeterHi,
See below examples..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
http://www.troobloo.com/tech/xslt.toc.shtml
http://www.w3schools.com/xsl/
http://www.w3.org/TR/xslt
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/generic%20xslt%20mapping%20in%20sap%20xi%2c%20part%20i.pdf
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
Required XSLT Mapping tips!
Regards
Chilla.. -
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.
-
When I create an xml document and print it to a string I find that I can only get 900 characters at a time from the output string (using substring) even though its length is reported as > 900
Running on Oracle 8.1.7Sun's resources on XML (including JAXP):
http://java.sun.com/xml/
Parser with DOM and SAX support:
http://xml.apache.org/xerces-j/
http://www.alphaworks.ibm.com/tech/xml4j
Of other interest:
http://xml.apache.org/xalan/
http://java.apache.org/ecs/index.html
http://xml.apache.org/cocoon/index.html
Cameron Purdy
http://www.tangosol.com
"Kevin Woo" <[email protected]> wrote in message
news:[email protected]..
Hi,
Would anyone know where I could get a XML DOM to Java String parser,
which does forward and backward parsing?
Thanks a bunch,
Kevin Woo -
How to typecast string to xml DOM element in java
hai
i need a string to be converted to xml DOM element in java, can any help me
i have done in this way
NodeList children = lParentRule.getElementsByTagName("parentruledetails").item(0).getChildNodes();
for
(int i = 0; i < children.getLength(); i++) {Node nod = children.item(i);
if
(nod.getNodeName().contains("parentcustomdetails")){Element parentcustom = (Element)nod.getNodeName(); // i get typecast error at this line}
i need to convert the string to element
can any one help me
Thanks in AdvanceHello. You can't cast a string to an element, you need to create that element.
Maybe this can help up: http://www.genedavis.com/library/xml/java_dom_xml_creation.jsp -
hi,
i get this following error when i start the WL 7.0. The web application fails
to start but the ejbs are started properly. This is an example from the Monson
Haefel book, on the CMP: Entity bean relationships.
Can anybody tell me what is happening ??
-thanks
-vasanth
Error log:
=============
<Error> <HTTP> <101179> <[HTTP] Error parsing des criptor in Web appplication
"C:\bea\user_projects\mydomain\.\myserver\.wlnotdele
te\titan\titan.war" [Path="C:\eclipse\workspace\titan4\dist\titan.ear", URI="tit
an.war"
weblogic.xml.dom.ChildCountException: missing child home in ejb-ref
at weblogic.xml.dom.DOMUtils.getElementByTagName(DOMUtils.java:147)
at weblogic.xml.dom.DOMUtils.getValueByTagName(DOMUtils.java:128)
at weblogic.servlet.internal.dd.EJBReference.<init>(EJBReference.java:61
at weblogic.servlet.internal.dd.WebAppDescriptor.<init>(WebAppDescriptor
.java:247)
at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(Descri
ptorLoader.java:540)
at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader
.java:253)
at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader
.java:215)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.ja
va:282)
at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:714)
at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:555)
at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:458)
at weblogic.management.deploy.slave.SlaveDeployer.prepareAllStagedApplic
ations(SlaveDeployer.java:490)
at weblogic.management.deploy.slave.SlaveDeployer.initialize(SlaveDeploy
er.java:253)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.initi
alize(DeploymentManagerServerLifeCycleImpl.java:150)
at weblogic.t3.srvr.ServerLifeCycleList.initialize(ServerLifeCycleList.j
ava:54)
at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:782)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282)
at weblogic.Server.main(Server.java:32)
>
<Jun 23, 2003 10:10:51 AM CDT> <Error> <Deployer> <149205> <The Slave Deployer
f
ailed to initialize the application titan due to error weblogic.management.Appli
cationException: Prepare failed. Task Id = null
Module Name: titan.war, Error: Could not load web application from 'C:\bea\user_
projects\mydomain\.\myserver\.wlnotdelete\titan\titan.war'
weblogic.management.ApplicationException: Prepare failed. Task Id = null
Module Name: titan.war, Error: Could not load web application from 'C:\bea\user_
projects\mydomain\.\myserver\.wlnotdelete\titan\titan.war'
at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:720)
at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:555)
at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:458)
at weblogic.management.deploy.slave.SlaveDeployer.prepareAllStagedApplic
ations(SlaveDeployer.java:490)
at weblogic.management.deploy.slave.SlaveDeployer.initialize(SlaveDeploy
er.java:253)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.initi
alize(DeploymentManagerServerLifeCycleImpl.java:150)
at weblogic.t3.srvr.ServerLifeCycleList.initialize(ServerLifeCycleList.j
ava:54)
at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:782)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282)
at weblogic.Server.main(Server.java:32)
>It is working now.
For a local entity bean, i was using <ejb-ref> instead of <local-ejb-ref>
Once i changed that, it worlked.
thanks
-vasanth
"Sanjeev Chopra" <[email protected]> wrote:
correct url for doc...
http://e-docs.bea.com/wls/docs81/webapp/web_xml.html#1020090
"Sanjeev Chopra" <[email protected]> wrote in message
news:[email protected]...
Seems like titan.war's WEB-INF/web.xml has an ejb-ref element witha
missing
<home> element .
see http://e-docs/wls/docs81/webapp/web_xml.html#1020090
"Vasanth" <[email protected]> wrote in message
news:[email protected]...
hi,
i get this following error when i start the WL 7.0. The web applicationfails
to start but the ejbs are started properly. This is an example from
the
Monson
Haefel book, on the CMP: Entity bean relationships.
Can anybody tell me what is happening ??
-thanks
-vasanth
Error log:
=============
<Error> <HTTP> <101179> <[HTTP] Error parsing des criptor in Webappplication
"C:\bea\user_projects\mydomain\.\myserver\.wlnotdele
te\titan\titan.war" [Path="C:\eclipse\workspace\titan4\dist\titan.ear",URI="tit
an.war"
weblogic.xml.dom.ChildCountException: missing child home in ejb-ref
atweblogic.xml.dom.DOMUtils.getElementByTagName(DOMUtils.java:147)
at
weblogic.xml.dom.DOMUtils.getValueByTagName(DOMUtils.java:128)
atweblogic.servlet.internal.dd.EJBReference.<init>(EJBReference.java:61
atweblogic.servlet.internal.dd.WebAppDescriptor.<init>(WebAppDescriptor
java:247)
atweblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(Descri
ptorLoader.java:540)
atweblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader
java:253)
atweblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader
java:215)
atweblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.ja
va:282)
atweblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:714)
atweblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:555)
atweblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:458)
atweblogic.management.deploy.slave.SlaveDeployer.prepareAllStagedApplic
ations(SlaveDeployer.java:490)
atweblogic.management.deploy.slave.SlaveDeployer.initialize(SlaveDeploy
er.java:253)
atweblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.initi
alize(DeploymentManagerServerLifeCycleImpl.java:150)
atweblogic.t3.srvr.ServerLifeCycleList.initialize(ServerLifeCycleList.j
ava:54)
at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:782)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282)
at weblogic.Server.main(Server.java:32)
>
<Jun 23, 2003 10:10:51 AM CDT> <Error> <Deployer> <149205> <The SlaveDeployer
f
ailed to initialize the application titan due to errorweblogic.management.Appli
cationException: Prepare failed. Task Id = null
Module Name: titan.war, Error: Could not load web application from'C:\bea\user_
projects\mydomain\.\myserver\.wlnotdelete\titan\titan.war'
weblogic.management.ApplicationException: Prepare failed. Task Id
= null
Module Name: titan.war, Error: Could not load web application from'C:\bea\user_
projects\mydomain\.\myserver\.wlnotdelete\titan\titan.war'
atweblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:720)
atweblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:555)
atweblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
er.java:458)
atweblogic.management.deploy.slave.SlaveDeployer.prepareAllStagedApplic
ations(SlaveDeployer.java:490)
atweblogic.management.deploy.slave.SlaveDeployer.initialize(SlaveDeploy
er.java:253)
atweblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.initi
alize(DeploymentManagerServerLifeCycleImpl.java:150)
atweblogic.t3.srvr.ServerLifeCycleList.initialize(ServerLifeCycleList.j
ava:54)
at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:782)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282)
at weblogic.Server.main(Server.java:32)
>
Maybe you are looking for
-
How can I add XML metadata to simulate my application?
I have a client application I support and I'm trying to use Dreamweaver as a tool to customize pages within the application. Each page, or report, consists of a HTM file with supporting CSS and Jscript used to render a view of data from the server th
-
I am in desperate need of finding my serial number so please help asap!
-
Our process involves filling out a submission form, sending the data to the approval form, and then viewing that approval form. Essentially a simple submission and approval workflow. When we export the XML of the approval form to see what data was pa
-
Connected to WiFi but can't connect to internet
Hi all, My iPod touch is connected to my secure home wifi network, the wifi icon is displayed with 4 bars, and I can use some wireless apps like Remote for itunes. I can connect to the internet on my laptop, but not my iPod. When I try to use safari/
-
Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure
Please Help , Urgent Help Needed. Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package. Case's are : 1. Excel File is On Users/ Client PC. 2. Application is on Remote Server(Oracle Forms D2k). 3. User Is Using Applicati