DOM parser question
Hi,
How can parse the following simple document using DOM and display the testnumber and region number values.
<?xml version="1.0" encoding="UTF-8"?>
<testCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="someURL">
<testNumber>emp00001</testNumber>
<regionNumber>2</regionNumber>
</testCase>
Thanks for your help.
JavaKnr
I did all those things.. But not able to get the values by tag name.
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
String xml = null;
InputSource inStream = new InputSource();
inStream.setCharacterStream(new StringReader(xmlString.trim()));
Document doc = db.parse(inStream);
Element el = doc.getElementById("testNumber");
Similar Messages
-
JmsAdapter DOM Parsing Exception handling
Hi,
I'm currently facing a problem with the behaviour of the Jms Adapter.
Whenever a JMS message is put in the queue and that message is not XML valid, the Jms Adapter (consumer) throw the exception "DOM Parsing Exception in translator Exception".
That's fine, I understand that the message was not well formed. But what is not fine is that the underlying BPEL is not instanciated : meaning I can't handle the exception properly.
Is there a way to force the Jms Adapter not to crash on the DOM Parsing for the BPEL to be instanciated (and then being able to handle the exception there) ?
Or is there a way to handle the error thrown by the Jms Adapter itself ? How ?
I think I do have a workaround to this if there is no better option (if both above questions cannot be answered) but I would rather not implement it since it will involve some extra steps / complexity.
> It would be to check the "native format opaque schema" option and then use a java embedded to decode the base64 into a string for eventually parsing it.
regards,
mathieuHi Mathieu,
The messages that error out before being posted to the service infrastructure are referred to as rejected messages. For example, the Oracle File Adapter selects a file having data in CSV format and tries to translate it to XML format (using NXSD). If there is any error in the translation, this message is rejected and are not be posted to the target composite.
You can create rejection handlers to handle message errors. Message errors include those that occur during translation, correlation ID mismatch and XML parsing after message reception.
Docs on how to do that are here...
http://docs.oracle.com/cd/E28280_01/integration.1111/e10231/life_cycle.htm#CIAIICJJ
Cheers,
Vlad -
Dom Parsing and BR tag problem...
hi all,
I have a Dom parser which examines an xml file and creates a Jtree from its content... it works fine except that when it meets a </br> tag it creates a new node for it in the tree... is there anyway to get it to consider the two "node" as one...
example:
- <p>
some text 1
some text 2
</p>
should be added in one node as some text 1 some text 2 instead it puts some text 1 in one node and some text 2 in another....
thanks
Lilaoooh sorry i didnt check how the message looked this is the question:
hi all, I have a Dom parser which examines an xml file and creates a Jtree from its content... it works fine except that when it meets a / BR tag it creates a new node for it in the tree... is there anyway to get it to consider the two "node" as one... example: -
< p >
some text 1
< / BR > <--- THIS NODE IS PROBLEM
some text 2
< / p >
should be added in one node as some text 1 some text 2 instead it puts some text 1 in one node and some text 2 in another....
thanks
Lila -
✓ not output correctly from DOM parser
Need a small help again.
in my original XMl file, I have an entity ʟ
It represents(ALT 671) a check symbol(a box).
But the output XMl file from my DOMparser represents it as a question mark, which is NOT what I want.
I'm using DOM parser with JAXP API to parse the XML file.
Could you help me why does my parser doesn't output correct character for this particular entity only?
Any suggestion is grately appreciated.
-Srivalli.Thanks DrClap for your reply.
Here is the statement in my DTD...
<!ENTITY check "✓">
(I had 671 in the place of 10003, but neither worked!!!!)
This is a statement in input XML...
The foll ✓ owing is
This is my Output XML....
The foll ? owing is
Here is the code in my java file where I didnot explicitly specify any output encoding type....
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder=factory.newDocumentBuilder();
currDocument=builder.parse(f);
TransformerFactory tf=TransformerFactory.newInstance();
Transformer t = tf.newTransformer(new StreamSource("transformoutput.xsl"));
t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "nmstat.dtd");
FileWriter fileOut = new FileWriter("outputAnno.xml");
t.transform(new DOMSource(document), new StreamResult(fileOut));
This is the code in transformoutput.xsl...
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select="node()"/>
</xsl:template>
</xsl:stylesheet>
Could you help me figuring out the problem.
Thank you very much.
-Srivalli. -
XML DOM Parser Performance Enhancement
Hello,
I parsed an XML file with DOM Parser.
When I read it (Which is successfully done) I see, in the debugging phase, that there are empty elements
which might represent a space, tab or newline and that are considered childrenNodes.
This actually cost us double time to run through everything.
My main question is how to get rid of the unwanted childrenNodes in order to iterate less on each element?
Thank you.According to the documentation, you should be able to call normalize() on either the document or the root element. In practice, I still have to iterate through the empty elements. Such is life.
- Saish -
Oracle XML DOM parser - attribute values are not printing on the screen ??
Hi Everyone,
I am just trying to use oracle DOM parser to paerse one of my xml file, java file can be compiled and run agianst a xml file, But I cannot see any attribute values printing on the screen..
Appreciate if anyone can help, where I have gone wrong please?
Below is the java file:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample { //public class eka ***
static public void main(String[] argv){ // main method eka ###
try {
if (argv.length != 1){
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
catch (Exception e){
System.out.println(e.toString());
} // main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i=0; i<nl.getLength(); i++){
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc){
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j=0; j < len; j++){
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null){
for (i=0; i<nnm.getLength(); i++){
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) { // podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) { /// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
} // BBBBBB
return url;
} // podi 3 End
} //public class eka ***
// End of program
output comes as below:
Isbn:
Title:
Price:
Author:
Message was edited by:
chandanalHi Chandanal,
I edited your code slightly and I was able to get the correct output.
I changed the following line:
for (int j=0; j >< len; j++)to:
for (int j=0; j < len; j++)I have included the complete source below:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample {
//public class eka ***
public static void main(String[] argv) {
// main method eka ###
try {
if (argv.length != 1) {
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
} catch (Exception e) {
System.out.println(e.toString());
// main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i = 0; i < nl.getLength(); i++) {
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j = 0; j < len; j++) {
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null) {
for (i = 0; i < nnm.getLength(); i++) {
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) {
// podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) {
/// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
// BBBBBB
return url;
// podi 3 End
} //public class eka ***-Blaise -
Parsing an xml file using xerces DOM parser
Hi
I want to parse a simple xml file using DOM parser.
The file is
<Item>
<SubItem>
<title>SubItem0</title>
<attr1>0</attr1>
<attr2>0</attr2>
<attr3>0</attr3>
</SubItem>
<SubItem>
<title>SubItem1</title>
<attr1>1</attr1>
<attr2>0</attr2>
<attr3>0</attr3>
</SubItem>
<SubItem>
<title>SubItem2</title>
<attr1>1</attr1>
<attr2>1</attr2>
<attr3>0</attr3>
<SubItem>
<title>SubItem20</title>
<attr1>2</attr1>
<attr2>1</attr2>
<attr3>0</attr3>
</SubItem>
<SubItem>
<title>SubItem21</title>
<attr1>1</attr1>
<attr2>1</attr2>
<attr3>0</attr3>
</SubItem>
</SubItem>
</Item>
I just want to parse this file and want to store the values in desired datastructures,
I am trying using DOM parser, since it gives a tree structure, which is ok in this case.
public void init()
InputReader ir =new InputReader("Habsys");
Document doc =ir.read("Habitat");
System.out.println(doc);
traverse(doc);
private void traverse(Document idoc)
NodeList lchildren=idoc.getElementsByTagName("SubItem");
for(int i=0;i<lchildren.getLength();i++)
String lgstr=lchildren.item(i).getNodeName();
if(lgstr.equals("SubItem"))
traverse(lchildren.item(i));
private void traverse (Node node) {
int type = node.getNodeType();
if (type == Node.ELEMENT_NODE)
System.out.println ("Name :"+node.getNodeName());
if(!node.hasChildNodes())
System.out.println ("Value :"+node.getNodeValue());
NodeList children = node.getChildNodes();
if (children != null) {
for (int i=0; i< children.getLength(); i++)
traverse (children.item(i));
But I am not getting required results, a lot of values I am getting as null
Could anybody tell me how to retrieve the data from the xml file, I simply want to read data and store it in data structures. For eg, for tag Subitem with title as ' SubItem1' has attr1 as '1', attr2 as'0' and attr3 as '0'.
Thanks
GauravCheck This Sample Code....
public void amethod(){
DocumentBuilderFactory dbf = null;
DocumentBuilder docBuilder = null;
Document doc = null;
try{
dbf = DocumentBuilderFactory.newInstance();
db = dbf.newDocumentBuilder();
doc = db.parse(New File("path/to/your/file"));
Node root = doc.getDocumentElement();
System.out.println("Root Node = " + root.getNodeName());
readNode(root);
}catch(FactoryConfigurationError fce){ fce.printStackTrace();
}catch(ParserConfigurationException pce){ pce.printStackTrace();
}catch(IOException ioe){ ioe.printStackTrace();
}catch(SAXException saxe){ saxe.printStackTrace();
private void readNode(Node node) {
System.out.println("Current Node = " + node.getNodeName());
readAttributes(node);
readChildren(node);
private void readAttributes(Node node) {
if (!node.hasAttributes())
return;
System.out.println("Attributes:");
NamedNodeMap attrNodes = node.getAttributes();
for (int i=0; i<attrNodes.getLength(); i++) {
Attr attr = (Attr)attrNodes.item(i);
System.out.println(attr.getNodeName() + " => " + attr.getNodeValue());
private void readChildren(Node node) {
if (!node.hasChildNodes())
return;
System.out.println("Value/s:");
NodeList childNodes = node.getChildNodes();
for (int i=0; i<childNodes.getLength(); i++) {
Node child = (Node)childNodes.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
readNode(child);
continue;
if (child.getNodeType() == Node.TEXT_NODE) {
if (child.getNodeValue()!=null)
System.out.println(child.getNodeValue()); -
How to get nodes and its attributes of an XML file usiong DOM parsing?
how to get nodes and its attributes of an XML file usiong DOM parsing?
i am new to XML parsing.......
Thanking you........import org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException; ...
//Setup the document
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File("MY_XML_FILE.xml"));
//get elemets by name
String elementValue = doc.getElementsByTagName("MY_ELEMENT").item(0).getTextContent();
//This method can return multiple nodes, in this instance I get item(0) , first nodeRead the api for other methods of getting data. -
DOM parsing In Applet (URgent)
Is it possible to implement DOM parsing in Applet?
I am getting classnotfoundException .
I am giving the code below. pl read the code.
Applet.(parserapplet.java)
=========================
import java.io.*;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.applet.*;
import com.security.*;
// for DOM parsing ....
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;
public class parserapplet extends Applet
public void init()
public void start()
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
{ // required for IE
PolicyEngine.assertPermission( PermissionID.SYSTEM );
catch (Throwable cnfe)
System.out.println("Policy Engine Exception: " + cnfe);
try
String str = "<?xml
version=\"1.0\"?><html><body></body></html>";
ByteArrayInputStream bis = new
ByteArrayInputStream(str.getBytes());
System.out.println("After creating input stream");
BufferedInputStream bufIn = new BufferedInputStream(new
DataInputStream(bis));
parseXMLMessage (bufIn);
catch(Exception e){}
// Actual DOM parsing goes here.....
public void parseXMLMessage(InputStream xmlMessage)
Document document = null;
DocumentBuilder documentBuilder = null;
DocumentBuilderFactory documentBuilderFactory = null;
try
documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.parse(xmlMessage);
System.out.println("Document node: " + document);
catch(FactoryConfigurationError fce)
System.out.println("Exception Factory configuration error " + fce);
catch(ParserConfigurationException pce)
System.out.println("Exception Parser configuration Exception " pce);
catch(SAXException saxe)
System.out.println("Exception SAX error " + saxe);
catch(Exception e)
System.out.println("Exception " + e);
Html code:
=========
<html>
<body>
<APPLET code="parserapplet.class" archive = "xalan.jar" width=0
height=0
MAYSCRIPT>
<param name=cabbase value=MyApplet.cab>
</APPLET>
</body>
</html>
I have signed the Applet using signcode utility and i have put the
parserapplet.class in the MyApplet cab file and signed it. On invoking
the html file, it request for permission, and after clicking yes, the
applet loads.Fine.
No problem upto this stage.
But after loading of the applet the following exception is thrown in
Javaconsole.
Exception:
=========
com.ms.security.SecurityExceptionEx[Host]: cannot access file
C:\WINNT\Java\lib\jaxp.properties
at com/ms/security/permissions/FileIOPermission.check
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkRead
at java/io/File.exists
at javax/xml/parsers/DocumentBuilderFactory.findFactory
at javax/xml/parsers/DocumentBuilderFactory.newInstance
at parserapplet.parseXMLMessage
at parserapplet.init
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
javax.xml.parsers.FactoryConfigurationError:
java.lang.ClassNotFoundException:
org/apache/crimson/jaxp/DocumentBuilderFactoryImpl
at javax/xml/parsers/DocumentBuilderFactory.newInstance
at parserapplet.parseXMLMessage
at parserapplet.init
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
I dont know which .jar file to archive (i tried xalan,crimson, jaxp
but which of no use). I was surprised why the security Exception is
thrown , when parsing.
I have not accessed the System files!( but it searches for
jaxp.properties file!). I think the jar file is not downloaded. How to
verify that it is downloaded in applet?
The above code is only for sample.
If anybody who knows how to correct it please mail me at:
"[email protected]" with corrected code. I want this very
urgently.
Help meeeeeeeeeeeeeeeeeeee!!!!!
Prasanna.Have you found the answer to this problem? I am having a similar problem when running the parser in an ActiveX Bean.
THanks -
Java DOM Parser (XML)
Could someone please give me a link where I can find a example of a DOM parser, w3c. That shows how to parse an xml string or file and build the tree then access parts of it? I cant find a basic example anywhere!
Check this
http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/dom/1_read.html -
Problem in parsing XML using DOM Parser.
Hi,
I am parsing an XML using DOM Parser.
When i try to get attributes of a node, i dont get in the order it is written. For Eg. This the node:
<Level0 label="News" link="/website/ing_news.nsf/ViewNewsForm?OpenForm&All" level="202" uid="COGN-4MNMT3" parentid="aaaa">
When i try to print the attribute values i should get in the order:
News, /website/ing_news.nsf/ViewNewsForm?OpenForm&All, 202, COGN-4MNMT3, aaaa
BUT I AM GETTING IN THE ORDER:
News, 202, /website/ing_news.nsf/ViewNewsForm?OpenForm&All, aaaa, COGN-4MNMT3
Is there any way to sort this problem out?
Thanks and Regards,
AshokHi Guys,
Thanks a lot for your replies.
But i want to keep all the values as attributes only.
the XML file is as shown below:
<Menu>
<Level0 label="News" link="/website/ing_news.nsf/ViewNewsForm?OpenForm&All" level="202" uid="COGN-4MNMT3" parentid="aaaa" children="3">
<Level1 label="ING News" link="" level="1" uid="COGN-4MNN89" parentid="COGN-4MNMT3" children="3" >
<Level2 label="All ING News" link="/website/ing_news.nsf/ViewNewsForm?OpenForm&All" level="2" uid="INGD-4MVTK2" parentid="COGN-4MNN89" children="0">
</Level2>
</Level1>
</Level0>
The code i was using to get attributes is:
String strElementName = new String(node.getNodeName());
// System.out.println("strElementName:"+node.getNodeName());
NamedNodeMap attrs = node.getAttributes();
if (attrs != null) {
int iLength = attrs.getLength();
for (int i = 0; i < iLength; i++) {
String strAttributes = (String) attrs.item(i).getNodeName();
String strValues = (String) attrs.item(i).getNodeValue();
Also is it not possible to Enforce the order using some Schema/DTD in this case?
TIA
Ashok -
Problem in parsing a xml string using dom parser
i want to parse a Xml String using a Dom parser......the parse function in dom parser takes only input stream as argument.......so i made the code as
InputStream inputstream = new StringBufferInputStream(XmlData) ;
InputSource inputSource = new InputSource(inputstream );
but saxexception is coming and also warning called
"java.io.StringBufferInputStream in java.io has been deprecated"
please help me.........i want to parse a Xml String using a Dom
parser......the parse function in dom parser takes
only input stream as argument.......This is not true of the DOM parser in Java 1.4. So you might want to get rid of your old parser and replace it by something more current. Or perhaps you are using 1.4 and you just didn't read all of the API docs. -
Context change by DOM parsing Java Mapping in XI
Hi Team,
I would like to know that how can I handle Context Change by DOM Parser Java Mapping in XI.?
Suppose the source XML structure I have like below:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Header xmlns:ns0="urn:bp:xi:hr:edm:test:100">
<FileName>
<filesub>
<subname>a</subname>
<subname>b</subname>
<subname>c</subname>
</filesub>
</FileName>
<FileName>
<filesub>
<subname>d</subname>
<subname>e</subname>
<subname>f</subname>
</filesub>
</FileName>
</ns0:Header>
Where the field FileName can occur maximum thrice(0...3) but the subname field is (0....unbounded) but in the target source I would like to have as given below:
<?xml version="1.0" encoding="UTF-8" ?>
- <MT_Test4 xmlns="urn:bp:xi:hr:edm:test:100">
- <Header>
<FileName>a</FileName>
<FileName1>d</FileName1>
</Header>
- <Header>
<FileName>b</FileName>
<FileName1>e</FileName1>
</Header>
Header>
<FileName>c</FileName>
<FileName1>f</FileName1>
</Header>
</MT_Test4>
That means the first value from every context of the source field is forming my first and second value in my target first context.Thensecond value from every context is forming my 1st and 2nd value of my target 2nd context and finally 3rd value of every context is forming my 1st and 2nd value of my target 3rd context.Is this possible to done through DOM parsing or we have to do it by UDF only?Hi Atanu,
In my last post I gave an alogorithm to solve the mapping problem. Here is the complete program for the mapping.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
public class DOMParser1 implements StreamTransformation{
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
try
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builderel=factory.newDocumentBuilder();
/input document in form of XML/
Document docIn=builderel.parse(in);
/document after parsing/
Document docOut=builderel.newDocument();
TransformerFactory tf=TransformerFactory.newInstance();
Transformer transform=tf.newTransformer();
Element root,child,child1=null;
Node textChild;
NodeList l;
int i,n1,j,div,k;
String s[];
root=docOut.createElement("MT_Test4");
root.setAttribute("xmlns","urn:bp:xi:hr:edm:test:100");
l=docIn.getElementsByTagName("subname");
n1=l.getLength();
s=new String[n1];
for(i=0;i<n1;++i)
s<i>=l.item(i).getFirstChild().getNodeValue();
l=docIn.getElementsByTagName("filesub");
div=l.getLength();
j=n1/div;
for(i=0,k=0;i<j;++i)
child1=docOut.createElement("Header");
root.appendChild(child1);
child=docOut.createElement("FileName");
textChild=docOut.createTextNode(s[k]);
child.appendChild(textChild);
child1.appendChild(child);
child=docOut.createElement("FileName1");
textChild=docOut.createTextNode(s [ k + j ]);
child.appendChild(textChild);
child1.appendChild(child);
++k;
docOut.appendChild(root);
transform.transform(new DOMSource(docOut), new StreamResult(out));
catch(Exception e)
e.printStackTrace();
public void setParameter(Map arg0) {
public static void main(String[] args) {
try{
DOMParser1 genFormat=new DOMParser1();
FileInputStream in=new FileInputStream("C:/Apps/my dw/sdnq/apps.xml");
FileOutputStream out=new FileOutputStream("C:/Apps/my dw/sdnq/tgt1.xml");
genFormat.execute(in,out);
catch(Exception e)
e.printStackTrace();
source -> apps.xml
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:Header xmlns:ns0="urn:bp:xi:hr:edm:test:100">
- <FileName>
- <filesub>
<subname>a</subname>
<subname>b</subname>
<subname>c</subname>
</filesub>
</FileName>
- <FileName>
- <filesub>
<subname>d</subname>
<subname>e</subname>
<subname>f</subname>
</filesub>
</FileName>
</ns0:Header>
target structure -> tgt1.xml
<?xml version="1.0" encoding="UTF-8" ?>
- <MT_Test4 xmlns="urn:bp:xi:hr:edm:test:100">
- <Header>
<FileName>a</FileName>
<FileName1>d</FileName1>
</Header>
- <Header>
<FileName>b</FileName>
<FileName1>e</FileName1>
</Header>
- <Header>
<FileName>c</FileName>
<FileName1>f</FileName1>
</Header>
</MT_Test4>
Hope this helps
one more thing in this line "textChild=docOut.createTextNode(s k + j );" somehow the the third braces one opening before k and one closing after j is missing for unknown reasons. Please correct it when you actually run this code.
regards
Anupam
Edited by: anupamsap on Mar 7, 2011 12:47 PM -
Integration between B2B and ESB error (DOM Parsing Exception in translator)
Hello,
We have configured a circuit that has the objective of sending a message to B2B and then the ESB dequeues that message from the IP_IN_QUEUE.
The problem is that for some reason, the ESB cannot read message using the AQ Adapter object.
The error is the following:
DOM Parsing Exception in translator. DOM parsing exception in inbound XSD translator while parsing InputStream. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
The trace is the following:
ORABPEL-11211 DOM Parsing Exception in translator. DOM parsing exception in inbound XSD translator while parsing InputStream. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable. at oracle.tip.pc.services.translation.xlators.xsd.XSDTranslator.translateFromNative(XSDTranslator.java:139) at oracle.tip.adapter.aq.database.MessageReader.translateFromNative(MessageReader.java:1179) at oracle.tip.adapter.aq.database.MessageReader.readMessage(MessageReader.java:533) at oracle.tip.adapter.aq.inbound.AQActivationSpecDequeuer.run(AQActivationSpecDequeuer.java:189) at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242) at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215) at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:819) at java.lang.Thread.run(Thread.java:595) Caused by: oracle.xml.parser.v2.XMLParseException: '=' missing in attribute. at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320) at oracle.xml.parser.v2.NonValidatingParser.parseAttrValue(NonValidatingParser.java:1609) at oracle.xml.parser.v2.NonValidatingParser.parseAttr(NonValidatingParser.java:1514) at oracle.xml.parser.v2.NonValidatingParser.parseAttributes(NonValidatingParser.java:1447) at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1286) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:291) at oracle.tip.pc.services.translation.xlators.xsd.XSDTranslator.translateFromNative(XSDTranslator.java:134) ... 8 more
The Payload is the following:
<?xml version="1.0" ?><OMG_O19 xmlns="urn:oracle:integration:b2b:C023D5B231EF45519AA3D9929B4990E1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" XDataVersion="2.0" Standard="HL7" Version="2.4" CreatedDate="2007-07-17T17:10:43" CreatedBy="ECXEngine_837" GUID="{D16D28B9-3821-4BCC-B4D9-0D92F8611BB5}"><Internal-Properties><Data-Structure Name="Message"><Lookup Name="MessageSendingApp">ALERT</Lookup><Lookup Name="MessageSendingAppUniversalID"></Lookup><Lookup Name="MessageSendingAppUniversalIDType"></Lookup><Lookup Name="MessageSendingFacility">CHVNG</Lookup><Lookup Name="MessageSendingFacilityUniversalID"></Lookup><Lookup Name="MessageSendingFacilityUniversalIDType"></Lookup><Lookup Name="MessageReceivingApp">RADIO</Lookup><Lookup Name="MessageReceivingAppUniversalID"></Lookup><Lookup Name="MessageReceivingAppUniversalIDType"></Lookup><Lookup Name="MessageReceivingFacility">CHVNG</Lookup><Lookup Name="MessageReceivingFacilityUniversalID"></Lookup><Lookup Name="MessageReceivingFacilityUniversalIDType"></Lookup><Lookup Name="MessageCode">OMG</Lookup><Lookup Name="TriggerEvent">O19</Lookup><Lookup Name="MessageStructure">OMG_O19</Lookup><Lookup Name="MessageVersion">2.4</Lookup><Lookup Name="InternatCodeID"></Lookup><Lookup Name="InternatCodeText"></Lookup><Lookup Name="InternatCodeSystem"></Lookup><Lookup Name="InternatCodeAlternateID"></Lookup><Lookup Name="InternatCodeAlternateText"></Lookup><Lookup Name="InternatCodeAlternateSystem"></Lookup><Lookup Name="InternationalVersionID"></Lookup><Lookup Name="InternationalVersionIDText"></Lookup><Lookup Name="InternationalVersionIDSystem"></Lookup><Lookup Name="InternationalVersionIDAlternateID"></Lookup><Lookup Name="InternationalVersionIDAlternateText"></Lookup><Lookup Name="InternationalVersionIDAlternateSystem"></Lookup><Lookup Name="Standard">HL7</Lookup><Property Name="MessageEncodingCharacters">^~\&</Property><Property Name="MessageSendingApp">ALERT</Property><Property Name="MessageSendingAppUniversalID"></Property><Property Name="MessageSendingAppUniversalIDType"></Property><Property Name="MessageSendingFacility">CHVNG</Property><Property Name="MessageSendingFacilityUniversalID"></Property><Property Name="MessageSendingFacilityUniversalIDType"></Property><Property Name="MessageReceivingApp">RADIO</Property><Property Name="MessageReceivingAppUniversalID"></Property><Property Name="MessageReceivingAppUniversalIDType"></Property><Property Name="MessageReceivingFacility">CHVNG</Property><Property Name="MessageReceivingFacilityUniversalID"></Property><Property Name="MessageReceivingFacilityUniversalIDType"></Property><Property Name="MessageDate">20070705161247+0000</Property><Property Name="MessageDateTimePrecision"></Property><Property Name="MessageSecurity"></Property><Property Name="MessageCode">OMG</Property><Property Name="TriggerEvent">O19</Property><Property Name="MessageStructure">OMG_O19</Property><Property Name="MessageControlID">1709</Property><Property Name="ProcessingID">P</Property><Property Name="ProcessingMode"></Property><Property Name="MessageVersion">2.4</Property><Property Name="InternatCodeID"></Property><Property Name="InternatCodeText"></Property><Property Name="InternatCodeSystem"></Property><Property Name="InternatCodeAlternateID"></Property><Property Name="InternatCodeAlternateText"></Property><Property Name="InternatCodeAlternateSystem"></Property><Property Name="InternationalVersionID"></Property><Property Name="InternationalVersionIDText"></Property><Property Name="InternationalVersionIDSystem"></Property><Property Name="InternationalVersionIDAlternateID"></Property><Property Name="InternationalVersionIDAlternateText"></Property><Property Name="InternationalVersionIDAlternateSystem"></Property><Property Name="SequenceNumber"></Property><Property Name="ContinuationPointer"></Property><Property Name="AcceptAckType"></Property><Property Name="AppAckType"></Property><Property Name="CountryCode"></Property><Property Name="CharacterSet"></Property><Property Name="LanguageID"></Property><Property Name="LanguageText"></Property><Property Name="LanguageSystem"></Property><Property Name="LanguageAlternateID"></Property><Property Name="LanguageAlternateText"></Property><Property Name="LanguageAlternateSystem"></Property><Property Name="AlternateCharacterSetSchema"></Property><Property Name="ConformanceStatementID"></Property><Property Name="MessageProfileNamespaceID"></Property><Property Name="MessageProfileUniversalID"></Property><Property Name="MessageProfileUniversalIDType"></Property><Property Name="DecimalSeparator"></Property><Property Name="ElementDelimiter">0x7c</Property><Property Name="ReleaseCharacter">0x5c</Property><Property Name="RepeatingSeparator">0x7e</Property><Property Name="SegmentDelimiter">0xd</Property><Property Name="SubcomponentDelimiter">0x26</Property><Property Name="SubelementDelimiter">0x5e</Property></Data-Structure></Internal-Properties><MSH><MSH.1>|</MSH.1><MSH.2>^~\&</MSH.2><MSH.3><HD.1>ALERT</HD.1></MSH.3><MSH.4><HD.1>CHVNG</HD.1></MSH.4><MSH.5><HD.1>RADIO</HD.1></MSH.5><MSH.6><HD.1>CHVNG</HD.1></MSH.6><MSH.7><TS.1>20070705161247+0000</TS.1></MSH.7><MSH.8 xsi:nil="true"></MSH.8><MSH.9><MSG.1>OMG</MSG.1><MSG.2>O19</MSG.2><MSG.3>OMG_O19</MSG.3></MSH.9><MSH.10>1709</MSH.10><MSH.11><PT.1>P</PT.1></MSH.11><MSH.12><VID.1>2.4</VID.1></MSH.12><MSH.13 xsi:nil="true"></MSH.13></MSH><Extra-
PID><Extra-
PID.1 xsi:nil="true"></Extra-
PID.1><Extra-
PID.2 xsi:nil="true"></Extra-
PID.2><Extra-
PID.3><Extra-
PID.3.1>390971</Extra-
PID.3.1><Extra-
PID.3.2 xsi:nil="true"></Extra-
PID.3.2><Extra-
PID.3.3 xsi:nil="true"></Extra-
PID.3.3><Extra-
PID.3.4>CHVNG</Extra-
PID.3.4><Extra-
PID.3.5>NS</Extra-
PID.3.5></Extra-
PID.3><Extra-
PID.4 xsi:nil="true"></Extra-
PID.4><Extra-
PID.5><Extra-
PID.5.1>Santos</Extra-
PID.5.1><Extra-
PID.5.2>Paula</Extra-
PID.5.2><Extra-
PID.5.3>Cristina Silva Lopes</Extra-
PID.5.3></Extra-
PID.5><Extra-
PID.6 xsi:nil="true"></Extra-
PID.6><Extra-
PID.7>19720117000000+0000</Extra-
PID.7><Extra-
PID.8 xsi:nil="true"></Extra-
PID.8><Extra-
PID.9 xsi:nil="true"></Extra-
PID.9><Extra-
PID.10 xsi:nil="true"></Extra-
PID.10><Extra-
PID.11><Extra-
PID.11.1>R Bernardino Costa 358 Bl D Hab 04</Extra-
PID.11.1><Extra-
PID.11.2 xsi:nil="true"></Extra-
PID.11.2><Extra-
PID.11.3>Valadares</Extra-
PID.11.3><Extra-
PID.11.4 xsi:nil="true"></Extra-
PID.11.4><Extra-
PID.11.5>4405</Extra-
PID.11.5></Extra-
PID.11><Extra-
PID.12 xsi:nil="true"></Extra-
PID.12><Extra-
PID.13 xsi:nil="true"></Extra-
PID.13><Extra-
PID.14 xsi:nil="true"></Extra-
PID.14><Extra-
PID.15 xsi:nil="true"></Extra-
PID.15><Extra-
PID.16 xsi:nil="true"></Extra-
PID.16><Extra-
PID.17 xsi:nil="true"></Extra-
PID.17><Extra-
PID.18>7011588</Extra-
PID.18><Extra-
PID.19 xsi:nil="true"></Extra-
PID.19></Extra-
PID><Extra-
PV1><Extra-
PV1.1 xsi:nil="true"></Extra-
PV1.1><Extra-
PV1.2>URG</Extra-
PV1.2><Extra-
PV1.3><Extra-
PV1.3.1>1</Extra-
PV1.3.1><Extra-
PV1.3.2 xsi:nil="true"></Extra-
PV1.3.2><Extra-
PV1.3.3 xsi:nil="true"></Extra-
PV1.3.3><Extra-
PV1.3.4>CHVNG</Extra-
PV1.3.4></Extra-
PV1.3><Extra-
PV1.4 xsi:nil="true"></Extra-
PV1.4><Extra-
PV1.5 xsi:nil="true"></Extra-
PV1.5><Extra-
PV1.6 xsi:nil="true"></Extra-
PV1.6><Extra-
PV1.7 xsi:nil="true"></Extra-
PV1.7><Extra-
PV1.8 xsi:nil="true"></Extra-
PV1.8><Extra-
PV1.9 xsi:nil="true"></Extra-
PV1.9><Extra-
PV1.10 xsi:nil="true"></Extra-
PV1.10><Extra-
PV1.11 xsi:nil="true"></Extra-
PV1.11><Extra-
PV1.12 xsi:nil="true"></Extra-
PV1.12><Extra-
PV1.13 xsi:nil="true"></Extra-
PV1.13><Extra-
PV1.14 xsi:nil="true"></Extra-
PV1.14><Extra-
PV1.15 xsi:nil="true"></Extra-
PV1.15><Extra-
PV1.16 xsi:nil="true"></Extra-
PV1.16><Extra-
PV1.17 xsi:nil="true"></Extra-
PV1.17><Extra-
PV1.18>URG</Extra-
PV1.18><Extra-
PV1.19><Extra-
PV1.19.1>7088430</Extra-
PV1.19.1><Extra-
PV1.19.2 xsi:nil="true"></Extra-
PV1.19.2><Extra-
PV1.19.3 xsi:nil="true"></Extra-
PV1.19.3><Extra-
PV1.19.4>SONHO</Extra-
PV1.19.4></Extra-
PV1.19><Extra-
PV1.20 xsi:nil="true"></Extra-
PV1.20><Extra-
PV1.21 xsi:nil="true"></Extra-
PV1.21><Extra-
PV1.22 xsi:nil="true"></Extra-
PV1.22><Extra-
PV1.23 xsi:nil="true"></Extra-
PV1.23><Extra-
PV1.24 xsi:nil="true"></Extra-
PV1.24><Extra-
PV1.25 xsi:nil="true"></Extra-
PV1.25><Extra-
PV1.26 xsi:nil="true"></Extra-
PV1.26><Extra-
PV1.27 xsi:nil="true"></Extra-
PV1.27><Extra-
PV1.28 xsi:nil="true"></Extra-
PV1.28><Extra-
PV1.29 xsi:nil="true"></Extra-
PV1.29><Extra-
PV1.30 xsi:nil="true"></Extra-
PV1.30><Extra-
PV1.31 xsi:nil="true"></Extra-
PV1.31><Extra-
PV1.32 xsi:nil="true"></Extra-
PV1.32><Extra-
PV1.33 xsi:nil="true"></Extra-
PV1.33><Extra-
PV1.34 xsi:nil="true"></Extra-
PV1.34><Extra-
PV1.35 xsi:nil="true"></Extra-
PV1.35><Extra-
PV1.36 xsi:nil="true"></Extra-
PV1.36><Extra-
PV1.37 xsi:nil="true"></Extra-
PV1.37><Extra-
PV1.38 xsi:nil="true"></Extra-
PV1.38><Extra-
PV1.39 xsi:nil="true"></Extra-
PV1.39><Extra-
PV1.40 xsi:nil="true"></Extra-
PV1.40><Extra-
PV1.41 xsi:nil="true"></Extra-
PV1.41><Extra-
PV1.42 xsi:nil="true"></Extra-
PV1.42><Extra-
PV1.43 xsi:nil="true"></Extra-
PV1.43><Extra-
PV1.44>20070705154838+0000</Extra-
PV1.44><Extra-
PV1.45 xsi:nil="true"></Extra-
PV1.45><Extra-
PV1.46 xsi:nil="true"></Extra-
PV1.46><Extra-
PV1.47 xsi:nil="true"></Extra-
PV1.47><Extra-
PV1.48 xsi:nil="true"></Extra-
PV1.48><Extra-
PV1.49 xsi:nil="true"></Extra-
PV1.49><Extra-
PV1.50 xsi:nil="true"></Extra-
PV1.50><Extra-
PV1.51>V</Extra-
PV1.51><Extra-
PV1.52 xsi:nil="true"></Extra-
PV1.52></Extra-
PV1><Extra-
ORC><Extra-
ORC.1>NW</Extra-
ORC.1><Extra-
ORC.2><Extra-
ORC.2.1>19013</Extra-
ORC.2.1><Extra-
ORC.2.2>ALERT</Extra-
ORC.2.2></Extra-
ORC.2><Extra-
ORC.3 xsi:nil="true"></Extra-
ORC.3><Extra-
ORC.4 xsi:nil="true"></Extra-
ORC.4><Extra-
ORC.5>NW</Extra-
ORC.5><Extra-
ORC.6 xsi:nil="true"></Extra-
ORC.6><Extra-
ORC.7 xsi:nil="true"></Extra-
ORC.7><Extra-
ORC.8 xsi:nil="true"></Extra-
ORC.8><Extra-
ORC.9 xsi:nil="true"></Extra-
ORC.9><Extra-
ORC.10 xsi:nil="true"></Extra-
ORC.10><Extra-
ORC.11 xsi:nil="true"></Extra-
ORC.11><Extra-
ORC.12><Extra-
ORC.12.1>4292</Extra-
ORC.12.1><Extra-
ORC.12.2>Martinez</Extra-
ORC.12.2><Extra-
ORC.12.3>Cristina</Extra-
ORC.12.3></Extra-
ORC.12><Extra-
ORC.13 xsi:nil="true"></Extra-
ORC.13></Extra-
ORC><Extra-
OBR><Extra-
OBR.1>1</Extra-
OBR.1><Extra-
OBR.2><Extra-
OBR.2.1>19013</Extra-
OBR.2.1><Extra-
OBR.2.2>ALERT</Extra-
OBR.2.2></Extra-
OBR.2><Extra-
OBR.3 xsi:nil="true"></Extra-
OBR.3><Extra-
OBR.4><Extra-
OBR.4.1>10781</Extra-
OBR.4.1><Extra-
OBR.4.2>M<escape V="XE3"/>o direita, duas incid<escape V="XEA"/>ncias</Extra-
OBR.4.2><Extra-
OBR.4.3>CHVNG</Extra-
OBR.4.3></Extra-
OBR.4><Extra-
OBR.5 xsi:nil="true"></Extra-
OBR.5><Extra-
OBR.6 xsi:nil="true"></Extra-
OBR.6><Extra-
OBR.7 xsi:nil="true"></Extra-
OBR.7><Extra-
OBR.8 xsi:nil="true"></Extra-
OBR.8><Extra-
OBR.9 xsi:nil="true"></Extra-
OBR.9><Extra-
OBR.10 xsi:nil="true"></Extra-
OBR.10><Extra-
OBR.11 xsi:nil="true"></Extra-
OBR.11><Extra-
OBR.12 xsi:nil="true"></Extra-
OBR.12><Extra-
OBR.13 xsi:nil="true"></Extra-
OBR.13><Extra-
OBR.14 xsi:nil="true"></Extra-
OBR.14><Extra-
OBR.15 xsi:nil="true"></Extra-
OBR.15><Extra-
OBR.16><Extra-
OBR.16.1>4292</Extra-
OBR.16.1><Extra-
OBR.16.2>Martinez</Extra-
OBR.16.2><Extra-
OBR.16.3>Cristina</Extra-
OBR.16.3></Extra-
OBR.16><Extra-
OBR.17 xsi:nil="true"></Extra-
OBR.17><Extra-
OBR.18 xsi:nil="true"></Extra-
OBR.18><Extra-
OBR.19 xsi:nil="true"></Extra-
OBR.19><Extra-
OBR.20 xsi:nil="true"></Extra-
OBR.20><Extra-
OBR.21 xsi:nil="true"></Extra-
OBR.21><Extra-
OBR.22 xsi:nil="true"></Extra-
OBR.22><Extra-
OBR.23 xsi:nil="true"></Extra-
OBR.23><Extra-
OBR.24 xsi:nil="true"></Extra-
OBR.24><Extra-
OBR.25 xsi:nil="true"></Extra-
OBR.25><Extra-
OBR.26 xsi:nil="true"></Extra-
OBR.26><Extra-
OBR.27><Extra-
OBR.27.1 xsi:nil="true"></Extra-
OBR.27.1><Extra-
OBR.27.2 xsi:nil="true"></Extra-
OBR.27.2><Extra-
OBR.27.3 xsi:nil="true"></Extra-
OBR.27.3><Extra-
OBR.27.4>20070705161237+0000</Extra-
OBR.27.4></Extra-
OBR.27><Extra-
OBR.28 xsi:nil="true"></Extra-
OBR.28></Extra-
OBR><Extra-
NTE><Extra-
NTE.1>1</Extra-
NTE.1><Extra-
NTE.2 xsi:nil="true"></Extra-
NTE.2></Extra-
NTE><Extra-
DG1><Extra-
DG1.1>1</Extra-
DG1.1><Extra-
DG1.2 xsi:nil="true"></Extra-
DG1.2><Extra-
DG1.3><Extra-
DG1.3.1>9233</Extra-
DG1.3.1><Extra-
DG1.3.2>Contusao De Dedo Da Mao</Extra-
DG1.3.2><Extra-
DG1.3.3>ICD9</Extra-
DG1.3.3></Extra-
DG1.3><Extra-
DG1.4 xsi:nil="true"></Extra-
DG1.4><Extra-
DG1.5 xsi:nil="true"></Extra-
DG1.5><Extra-
DG1.6>D</Extra-
DG1.6></Extra-
DG1></OMG_O19>
I think that the problem should be because of the "Extra" (eg. <Extra-
PID.1 xsi:nil="true">) word that B2B puts in every tag.
The strange thing is that, this already worked until two days ago....
What could it be?
Thanks for your help.
Best Regards,
Nuno FernandesHello,
We have configured a circuit that has the objective of sending a message to B2B and then the ESB dequeues that message from the IP_IN_QUEUE.
The problem is that for some reason, the ESB cannot read message using the AQ Adapter object.
The error is the following:
DOM Parsing Exception in translator. DOM parsing exception in inbound XSD translator while parsing InputStream. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
The trace is the following:
ORABPEL-11211 DOM Parsing Exception in translator. DOM parsing exception in inbound XSD translator while parsing InputStream. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable. at oracle.tip.pc.services.translation.xlators.xsd.XSDTranslator.translateFromNative(XSDTranslator.java:139) at oracle.tip.adapter.aq.database.MessageReader.translateFromNative(MessageReader.java:1179) at oracle.tip.adapter.aq.database.MessageReader.readMessage(MessageReader.java:533) at oracle.tip.adapter.aq.inbound.AQActivationSpecDequeuer.run(AQActivationSpecDequeuer.java:189) at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242) at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215) at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:819) at java.lang.Thread.run(Thread.java:595) Caused by: oracle.xml.parser.v2.XMLParseException: '=' missing in attribute. at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320) at oracle.xml.parser.v2.NonValidatingParser.parseAttrValue(NonValidatingParser.java:1609) at oracle.xml.parser.v2.NonValidatingParser.parseAttr(NonValidatingParser.java:1514) at oracle.xml.parser.v2.NonValidatingParser.parseAttributes(NonValidatingParser.java:1447) at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1286) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:291) at oracle.tip.pc.services.translation.xlators.xsd.XSDTranslator.translateFromNative(XSDTranslator.java:134) ... 8 more
The Payload is the following:
<?xml version="1.0" ?><OMG_O19 xmlns="urn:oracle:integration:b2b:C023D5B231EF45519AA3D9929B4990E1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" XDataVersion="2.0" Standard="HL7" Version="2.4" CreatedDate="2007-07-17T17:10:43" CreatedBy="ECXEngine_837" GUID="{D16D28B9-3821-4BCC-B4D9-0D92F8611BB5}"><Internal-Properties><Data-Structure Name="Message"><Lookup Name="MessageSendingApp">ALERT</Lookup><Lookup Name="MessageSendingAppUniversalID"></Lookup><Lookup Name="MessageSendingAppUniversalIDType"></Lookup><Lookup Name="MessageSendingFacility">CHVNG</Lookup><Lookup Name="MessageSendingFacilityUniversalID"></Lookup><Lookup Name="MessageSendingFacilityUniversalIDType"></Lookup><Lookup Name="MessageReceivingApp">RADIO</Lookup><Lookup Name="MessageReceivingAppUniversalID"></Lookup><Lookup Name="MessageReceivingAppUniversalIDType"></Lookup><Lookup Name="MessageReceivingFacility">CHVNG</Lookup><Lookup Name="MessageReceivingFacilityUniversalID"></Lookup><Lookup Name="MessageReceivingFacilityUniversalIDType"></Lookup><Lookup Name="MessageCode">OMG</Lookup><Lookup Name="TriggerEvent">O19</Lookup><Lookup Name="MessageStructure">OMG_O19</Lookup><Lookup Name="MessageVersion">2.4</Lookup><Lookup Name="InternatCodeID"></Lookup><Lookup Name="InternatCodeText"></Lookup><Lookup Name="InternatCodeSystem"></Lookup><Lookup Name="InternatCodeAlternateID"></Lookup><Lookup Name="InternatCodeAlternateText"></Lookup><Lookup Name="InternatCodeAlternateSystem"></Lookup><Lookup Name="InternationalVersionID"></Lookup><Lookup Name="InternationalVersionIDText"></Lookup><Lookup Name="InternationalVersionIDSystem"></Lookup><Lookup Name="InternationalVersionIDAlternateID"></Lookup><Lookup Name="InternationalVersionIDAlternateText"></Lookup><Lookup Name="InternationalVersionIDAlternateSystem"></Lookup><Lookup Name="Standard">HL7</Lookup><Property Name="MessageEncodingCharacters">^~\&</Property><Property Name="MessageSendingApp">ALERT</Property><Property Name="MessageSendingAppUniversalID"></Property><Property Name="MessageSendingAppUniversalIDType"></Property><Property Name="MessageSendingFacility">CHVNG</Property><Property Name="MessageSendingFacilityUniversalID"></Property><Property Name="MessageSendingFacilityUniversalIDType"></Property><Property Name="MessageReceivingApp">RADIO</Property><Property Name="MessageReceivingAppUniversalID"></Property><Property Name="MessageReceivingAppUniversalIDType"></Property><Property Name="MessageReceivingFacility">CHVNG</Property><Property Name="MessageReceivingFacilityUniversalID"></Property><Property Name="MessageReceivingFacilityUniversalIDType"></Property><Property Name="MessageDate">20070705161247+0000</Property><Property Name="MessageDateTimePrecision"></Property><Property Name="MessageSecurity"></Property><Property Name="MessageCode">OMG</Property><Property Name="TriggerEvent">O19</Property><Property Name="MessageStructure">OMG_O19</Property><Property Name="MessageControlID">1709</Property><Property Name="ProcessingID">P</Property><Property Name="ProcessingMode"></Property><Property Name="MessageVersion">2.4</Property><Property Name="InternatCodeID"></Property><Property Name="InternatCodeText"></Property><Property Name="InternatCodeSystem"></Property><Property Name="InternatCodeAlternateID"></Property><Property Name="InternatCodeAlternateText"></Property><Property Name="InternatCodeAlternateSystem"></Property><Property Name="InternationalVersionID"></Property><Property Name="InternationalVersionIDText"></Property><Property Name="InternationalVersionIDSystem"></Property><Property Name="InternationalVersionIDAlternateID"></Property><Property Name="InternationalVersionIDAlternateText"></Property><Property Name="InternationalVersionIDAlternateSystem"></Property><Property Name="SequenceNumber"></Property><Property Name="ContinuationPointer"></Property><Property Name="AcceptAckType"></Property><Property Name="AppAckType"></Property><Property Name="CountryCode"></Property><Property Name="CharacterSet"></Property><Property Name="LanguageID"></Property><Property Name="LanguageText"></Property><Property Name="LanguageSystem"></Property><Property Name="LanguageAlternateID"></Property><Property Name="LanguageAlternateText"></Property><Property Name="LanguageAlternateSystem"></Property><Property Name="AlternateCharacterSetSchema"></Property><Property Name="ConformanceStatementID"></Property><Property Name="MessageProfileNamespaceID"></Property><Property Name="MessageProfileUniversalID"></Property><Property Name="MessageProfileUniversalIDType"></Property><Property Name="DecimalSeparator"></Property><Property Name="ElementDelimiter">0x7c</Property><Property Name="ReleaseCharacter">0x5c</Property><Property Name="RepeatingSeparator">0x7e</Property><Property Name="SegmentDelimiter">0xd</Property><Property Name="SubcomponentDelimiter">0x26</Property><Property Name="SubelementDelimiter">0x5e</Property></Data-Structure></Internal-Properties><MSH><MSH.1>|</MSH.1><MSH.2>^~\&</MSH.2><MSH.3><HD.1>ALERT</HD.1></MSH.3><MSH.4><HD.1>CHVNG</HD.1></MSH.4><MSH.5><HD.1>RADIO</HD.1></MSH.5><MSH.6><HD.1>CHVNG</HD.1></MSH.6><MSH.7><TS.1>20070705161247+0000</TS.1></MSH.7><MSH.8 xsi:nil="true"></MSH.8><MSH.9><MSG.1>OMG</MSG.1><MSG.2>O19</MSG.2><MSG.3>OMG_O19</MSG.3></MSH.9><MSH.10>1709</MSH.10><MSH.11><PT.1>P</PT.1></MSH.11><MSH.12><VID.1>2.4</VID.1></MSH.12><MSH.13 xsi:nil="true"></MSH.13></MSH><Extra-
PID><Extra-
PID.1 xsi:nil="true"></Extra-
PID.1><Extra-
PID.2 xsi:nil="true"></Extra-
PID.2><Extra-
PID.3><Extra-
PID.3.1>390971</Extra-
PID.3.1><Extra-
PID.3.2 xsi:nil="true"></Extra-
PID.3.2><Extra-
PID.3.3 xsi:nil="true"></Extra-
PID.3.3><Extra-
PID.3.4>CHVNG</Extra-
PID.3.4><Extra-
PID.3.5>NS</Extra-
PID.3.5></Extra-
PID.3><Extra-
PID.4 xsi:nil="true"></Extra-
PID.4><Extra-
PID.5><Extra-
PID.5.1>Santos</Extra-
PID.5.1><Extra-
PID.5.2>Paula</Extra-
PID.5.2><Extra-
PID.5.3>Cristina Silva Lopes</Extra-
PID.5.3></Extra-
PID.5><Extra-
PID.6 xsi:nil="true"></Extra-
PID.6><Extra-
PID.7>19720117000000+0000</Extra-
PID.7><Extra-
PID.8 xsi:nil="true"></Extra-
PID.8><Extra-
PID.9 xsi:nil="true"></Extra-
PID.9><Extra-
PID.10 xsi:nil="true"></Extra-
PID.10><Extra-
PID.11><Extra-
PID.11.1>R Bernardino Costa 358 Bl D Hab 04</Extra-
PID.11.1><Extra-
PID.11.2 xsi:nil="true"></Extra-
PID.11.2><Extra-
PID.11.3>Valadares</Extra-
PID.11.3><Extra-
PID.11.4 xsi:nil="true"></Extra-
PID.11.4><Extra-
PID.11.5>4405</Extra-
PID.11.5></Extra-
PID.11><Extra-
PID.12 xsi:nil="true"></Extra-
PID.12><Extra-
PID.13 xsi:nil="true"></Extra-
PID.13><Extra-
PID.14 xsi:nil="true"></Extra-
PID.14><Extra-
PID.15 xsi:nil="true"></Extra-
PID.15><Extra-
PID.16 xsi:nil="true"></Extra-
PID.16><Extra-
PID.17 xsi:nil="true"></Extra-
PID.17><Extra-
PID.18>7011588</Extra-
PID.18><Extra-
PID.19 xsi:nil="true"></Extra-
PID.19></Extra-
PID><Extra-
PV1><Extra-
PV1.1 xsi:nil="true"></Extra-
PV1.1><Extra-
PV1.2>URG</Extra-
PV1.2><Extra-
PV1.3><Extra-
PV1.3.1>1</Extra-
PV1.3.1><Extra-
PV1.3.2 xsi:nil="true"></Extra-
PV1.3.2><Extra-
PV1.3.3 xsi:nil="true"></Extra-
PV1.3.3><Extra-
PV1.3.4>CHVNG</Extra-
PV1.3.4></Extra-
PV1.3><Extra-
PV1.4 xsi:nil="true"></Extra-
PV1.4><Extra-
PV1.5 xsi:nil="true"></Extra-
PV1.5><Extra-
PV1.6 xsi:nil="true"></Extra-
PV1.6><Extra-
PV1.7 xsi:nil="true"></Extra-
PV1.7><Extra-
PV1.8 xsi:nil="true"></Extra-
PV1.8><Extra-
PV1.9 xsi:nil="true"></Extra-
PV1.9><Extra-
PV1.10 xsi:nil="true"></Extra-
PV1.10><Extra-
PV1.11 xsi:nil="true"></Extra-
PV1.11><Extra-
PV1.12 xsi:nil="true"></Extra-
PV1.12><Extra-
PV1.13 xsi:nil="true"></Extra-
PV1.13><Extra-
PV1.14 xsi:nil="true"></Extra-
PV1.14><Extra-
PV1.15 xsi:nil="true"></Extra-
PV1.15><Extra-
PV1.16 xsi:nil="true"></Extra-
PV1.16><Extra-
PV1.17 xsi:nil="true"></Extra-
PV1.17><Extra-
PV1.18>URG</Extra-
PV1.18><Extra-
PV1.19><Extra-
PV1.19.1>7088430</Extra-
PV1.19.1><Extra-
PV1.19.2 xsi:nil="true"></Extra-
PV1.19.2><Extra-
PV1.19.3 xsi:nil="true"></Extra-
PV1.19.3><Extra-
PV1.19.4>SONHO</Extra-
PV1.19.4></Extra-
PV1.19><Extra-
PV1.20 xsi:nil="true"></Extra-
PV1.20><Extra-
PV1.21 xsi:nil="true"></Extra-
PV1.21><Extra-
PV1.22 xsi:nil="true"></Extra-
PV1.22><Extra-
PV1.23 xsi:nil="true"></Extra-
PV1.23><Extra-
PV1.24 xsi:nil="true"></Extra-
PV1.24><Extra-
PV1.25 xsi:nil="true"></Extra-
PV1.25><Extra-
PV1.26 xsi:nil="true"></Extra-
PV1.26><Extra-
PV1.27 xsi:nil="true"></Extra-
PV1.27><Extra-
PV1.28 xsi:nil="true"></Extra-
PV1.28><Extra-
PV1.29 xsi:nil="true"></Extra-
PV1.29><Extra-
PV1.30 xsi:nil="true"></Extra-
PV1.30><Extra-
PV1.31 xsi:nil="true"></Extra-
PV1.31><Extra-
PV1.32 xsi:nil="true"></Extra-
PV1.32><Extra-
PV1.33 xsi:nil="true"></Extra-
PV1.33><Extra-
PV1.34 xsi:nil="true"></Extra-
PV1.34><Extra-
PV1.35 xsi:nil="true"></Extra-
PV1.35><Extra-
PV1.36 xsi:nil="true"></Extra-
PV1.36><Extra-
PV1.37 xsi:nil="true"></Extra-
PV1.37><Extra-
PV1.38 xsi:nil="true"></Extra-
PV1.38><Extra-
PV1.39 xsi:nil="true"></Extra-
PV1.39><Extra-
PV1.40 xsi:nil="true"></Extra-
PV1.40><Extra-
PV1.41 xsi:nil="true"></Extra-
PV1.41><Extra-
PV1.42 xsi:nil="true"></Extra-
PV1.42><Extra-
PV1.43 xsi:nil="true"></Extra-
PV1.43><Extra-
PV1.44>20070705154838+0000</Extra-
PV1.44><Extra-
PV1.45 xsi:nil="true"></Extra-
PV1.45><Extra-
PV1.46 xsi:nil="true"></Extra-
PV1.46><Extra-
PV1.47 xsi:nil="true"></Extra-
PV1.47><Extra-
PV1.48 xsi:nil="true"></Extra-
PV1.48><Extra-
PV1.49 xsi:nil="true"></Extra-
PV1.49><Extra-
PV1.50 xsi:nil="true"></Extra-
PV1.50><Extra-
PV1.51>V</Extra-
PV1.51><Extra-
PV1.52 xsi:nil="true"></Extra-
PV1.52></Extra-
PV1><Extra-
ORC><Extra-
ORC.1>NW</Extra-
ORC.1><Extra-
ORC.2><Extra-
ORC.2.1>19013</Extra-
ORC.2.1><Extra-
ORC.2.2>ALERT</Extra-
ORC.2.2></Extra-
ORC.2><Extra-
ORC.3 xsi:nil="true"></Extra-
ORC.3><Extra-
ORC.4 xsi:nil="true"></Extra-
ORC.4><Extra-
ORC.5>NW</Extra-
ORC.5><Extra-
ORC.6 xsi:nil="true"></Extra-
ORC.6><Extra-
ORC.7 xsi:nil="true"></Extra-
ORC.7><Extra-
ORC.8 xsi:nil="true"></Extra-
ORC.8><Extra-
ORC.9 xsi:nil="true"></Extra-
ORC.9><Extra-
ORC.10 xsi:nil="true"></Extra-
ORC.10><Extra-
ORC.11 xsi:nil="true"></Extra-
ORC.11><Extra-
ORC.12><Extra-
ORC.12.1>4292</Extra-
ORC.12.1><Extra-
ORC.12.2>Martinez</Extra-
ORC.12.2><Extra-
ORC.12.3>Cristina</Extra-
ORC.12.3></Extra-
ORC.12><Extra-
ORC.13 xsi:nil="true"></Extra-
ORC.13></Extra-
ORC><Extra-
OBR><Extra-
OBR.1>1</Extra-
OBR.1><Extra-
OBR.2><Extra-
OBR.2.1>19013</Extra-
OBR.2.1><Extra-
OBR.2.2>ALERT</Extra-
OBR.2.2></Extra-
OBR.2><Extra-
OBR.3 xsi:nil="true"></Extra-
OBR.3><Extra-
OBR.4><Extra-
OBR.4.1>10781</Extra-
OBR.4.1><Extra-
OBR.4.2>M<escape V="XE3"/>o direita, duas incid<escape V="XEA"/>ncias</Extra-
OBR.4.2><Extra-
OBR.4.3>CHVNG</Extra-
OBR.4.3></Extra-
OBR.4><Extra-
OBR.5 xsi:nil="true"></Extra-
OBR.5><Extra-
OBR.6 xsi:nil="true"></Extra-
OBR.6><Extra-
OBR.7 xsi:nil="true"></Extra-
OBR.7><Extra-
OBR.8 xsi:nil="true"></Extra-
OBR.8><Extra-
OBR.9 xsi:nil="true"></Extra-
OBR.9><Extra-
OBR.10 xsi:nil="true"></Extra-
OBR.10><Extra-
OBR.11 xsi:nil="true"></Extra-
OBR.11><Extra-
OBR.12 xsi:nil="true"></Extra-
OBR.12><Extra-
OBR.13 xsi:nil="true"></Extra-
OBR.13><Extra-
OBR.14 xsi:nil="true"></Extra-
OBR.14><Extra-
OBR.15 xsi:nil="true"></Extra-
OBR.15><Extra-
OBR.16><Extra-
OBR.16.1>4292</Extra-
OBR.16.1><Extra-
OBR.16.2>Martinez</Extra-
OBR.16.2><Extra-
OBR.16.3>Cristina</Extra-
OBR.16.3></Extra-
OBR.16><Extra-
OBR.17 xsi:nil="true"></Extra-
OBR.17><Extra-
OBR.18 xsi:nil="true"></Extra-
OBR.18><Extra-
OBR.19 xsi:nil="true"></Extra-
OBR.19><Extra-
OBR.20 xsi:nil="true"></Extra-
OBR.20><Extra-
OBR.21 xsi:nil="true"></Extra-
OBR.21><Extra-
OBR.22 xsi:nil="true"></Extra-
OBR.22><Extra-
OBR.23 xsi:nil="true"></Extra-
OBR.23><Extra-
OBR.24 xsi:nil="true"></Extra-
OBR.24><Extra-
OBR.25 xsi:nil="true"></Extra-
OBR.25><Extra-
OBR.26 xsi:nil="true"></Extra-
OBR.26><Extra-
OBR.27><Extra-
OBR.27.1 xsi:nil="true"></Extra-
OBR.27.1><Extra-
OBR.27.2 xsi:nil="true"></Extra-
OBR.27.2><Extra-
OBR.27.3 xsi:nil="true"></Extra-
OBR.27.3><Extra-
OBR.27.4>20070705161237+0000</Extra-
OBR.27.4></Extra-
OBR.27><Extra-
OBR.28 xsi:nil="true"></Extra-
OBR.28></Extra-
OBR><Extra-
NTE><Extra-
NTE.1>1</Extra-
NTE.1><Extra-
NTE.2 xsi:nil="true"></Extra-
NTE.2></Extra-
NTE><Extra-
DG1><Extra-
DG1.1>1</Extra-
DG1.1><Extra-
DG1.2 xsi:nil="true"></Extra-
DG1.2><Extra-
DG1.3><Extra-
DG1.3.1>9233</Extra-
DG1.3.1><Extra-
DG1.3.2>Contusao De Dedo Da Mao</Extra-
DG1.3.2><Extra-
DG1.3.3>ICD9</Extra-
DG1.3.3></Extra-
DG1.3><Extra-
DG1.4 xsi:nil="true"></Extra-
DG1.4><Extra-
DG1.5 xsi:nil="true"></Extra-
DG1.5><Extra-
DG1.6>D</Extra-
DG1.6></Extra-
DG1></OMG_O19>
I think that the problem should be because of the "Extra" (eg. <Extra-
PID.1 xsi:nil="true">) word that B2B puts in every tag.
The strange thing is that, this already worked until two days ago....
What could it be?
Thanks for your help.
Best Regards,
Nuno Fernandes -
XML DOM Parsing getAttributes() in J2SE 5.0 vs. J2SE 1.4
I am experiencing the following problem, with the Node.getAttributes() function although the following code runs fine under Java 1.4, and getAttributes() returns the actual string attribute values:
File xmlFile = new File(fileName);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(xmlFile);
// Begin analyzing XML
Element root = doc.getDocumentElement();
// Enumerate all children
NodeList children = root.getChildNodes();
Node rootNode = null;
NodeList nodeList = children;
for (int R = 0; R < nodeList.getLength() ; R++)
if (nodeList.item(R).getNodeType() == Node.ELEMENT_NODE)
rootNode = nodeList.item(R);
System.out.println("> " + rootNode.getNodeName() + " - " + rootNode.getAttributes().toString());
In J2SE 5.0 the Node.getAttributes() returns the following:
[email protected]d of returning then the actual attribute string (like in Java 1.4)!
If it helps at all I am using DOM parser (as noticed above, org.w3c.dom)
My assumption is that J2SE 5.0 returns an attribute map that is encoded differently then Java 1.4
Thank you for your time & appreciate any help...The getAttributes method returns a NamedNodeMap.
Iterate over the NamedNodeMap to get attribute values.
Instead of rootNode.getAttributes().toString();
NamedNodeMap map=rootNode.getAttributes().toString();
for(int i=0; i<map.getLength(); i++){
Node node=map.item(i);
if(node.getNodeType()==Node.ATTRIBUTE_NODE)
System.out.println("Attribute Node "+node.getNodeName()+ "has value "+ node.getNodeValue());
}
Maybe you are looking for
-
It is not able to run in IE7 with bookmarks
We generated webhelp with ROBOHELP 2000 (Blue Sky). It appears that the installation of Explorer 7 Beta is preventing some links from being followed from the TOC of a compiled WebHelp (.mpj) project. A 'normal' TOC entry referring to an HTML file wor
-
How to set values of formula fields during runtime in crystal reports
Hello All, Could any one help in letting me know how to set the values of a formula in the runtime. I tried using the below systax in the formula field Assume that I have 2 formula fields 1. format_count 2. format_display my formula is like below: in
-
Hello - when I was moving my msi with bindings to different environment, receiving following error . I created new App pool '_BtsIsoHost_PROD' but still receiving same error. What could be the issue ? How can I resolve this ? Target DeployNTFSPermiss
-
Cannot access beyond 1st layer webpage. But it works when I use Explorer
I cannot navigate to select another option in a particular field. When I do that in Explorer, it works. Specific field - I should be able to choose "SGX", "NYC", "Sedsaq", etc., but the field is "frozen" although I try clicking it many times... it do
-
Hello, We have a problem with an ALV as it doesnt group the cells with the same value in sorted columns. The reason is that the ALV has an editable column. The ALV is called with the function REUSE_ALV_GRID_DISPLAY. If we make this column NOT editab