Input XML to CSV in Mapping
Hi,
I have a requirement to convert the below:
Source Message:
<Message>
<Segment> ..............................0..unbounded
<Field1>Value1</Field1>
<Field2>Value2</Field2>
<Field20>Value20</Field20>
</Segment>
<Segment> ..............................0..unbounded
<Field1>value1</Field1>
<Field2>value2</Field2>
<Field20>Value20</Field20>
</Segment>
</Message>
Target Message should be:
<TargetMsg>
<Node>Value1,Value2,Value3,.........,Value20
value1,value2,value3,........,value20</Node>
</TargetMsg
How to do this using only Message mapping?
Thank you,
Pankaj.
Hi,
I am not using FILE adapter.
Also after converting the format to CSV I have to perform some other functions on the message.
It is actually a CSV embedded inside a XML.
Source Structure:
<Message>
<Data>
<ID>IND123</ID>
<Segment> ..............................0..unbounded
<Field1>Value1</Field1>
<Field2>Value2</Field2>
<Field20>Value20</Field20>
</Segment>
</Data>
<Data>
<ID>IND321</ID>
<Segment> ..............................0..unbounded
<Field1>value1</Field1>
<Field2>value2</Field2>
<Field20>Value20</Field20>
</Segment>
</Data>
</Message>
Target Message should be:
<TargetMsg>
<Node>ID: IND123
Value1,Value2,Value3,.........,Value20
ID:IND321
value1,value2,value3,........,value20</Node>
</TargetMsg>
Thank you,
Pankaj.
Similar Messages
-
Mapping complete input XML structure into one field on target
Hi,
I have a scenario where I need to map the complete input XML structure as it is, into one field on target side. so can we achieve this in Graphical Mapping? If yes, please share your valuable info.
Regards,
Shiva.Hello,
this is the java map code.just compile it and made a .zip file import it and use it Interface Mapping.
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import java.util.Map;
import java.io.*;
public class PayloadToXMLField1 implements StreamTransformation {
String strXML = new String();
//Declare the XML tag for your XML message
String StartXMLTag = "<DocumentBody>";
String EndXMLTag = "</DocumentBody>";
//String StartXMLTag1 = "<Code>";
//String EndXMLTag1 = "</Code>";
AbstractTrace trace;
private Map param = null;
public void setParameter(Map param) {
this.param = param;
public void execute(InputStream in, OutputStream out) {
trace =
(AbstractTrace) param.get(
StreamTransformationConstants.MAPPING_TRACE);
trace.addInfo("Process Started");
try {
StringBuffer strbuffer = new StringBuffer();
byte[] b = new byte[4096];
for (int n;(n = in.read(b)) != -1;) {
strbuffer.append(new String(b, 0, n));
strXML = strbuffer.toString();
} catch (Exception e) {
System.out.println("Exception Occurred");
String outputPayload =
StartXMLTag
+ "<![CDATA["
+ strXML
+ "]]>"
+ EndXMLTag;
try {
out.write(outputPayload.getBytes());
trace.addInfo("Process Completed");;
} catch (Exception e) {
trace.addInfo("Process Terminated: Error in writing out payload");; -
Input XML Format needs to be Translated Into CSV String Format
Hi,
I need to translate input xml format to CSV string format in BPEL.
How to use xpath function to do this?
Thanks1. In the partner link of the file adapter you can run the wizard and create a XSD according to your CSV format.
(you just need to create an example of CSV)
The wizard will create a XSD automatically.
2. Assign an invoke activity to that partner link.
3. Use transformation to pass data from your XML input into the invoke variable.
Arik -
How to convert org hierarchy XML to CSV/Excel format using PI/XI
Hi All,
I am working with SAP PI/XI for the first time and need some help file conversion of complex hierarchy XML to CSV file using PI. I have done plenty of research on SDN and could find much related to what I want to do.
Here is the example of how my input XML would look like:
<?xml version="1.0" encoding="UTF-8"?>
<PartyMaster type="OrgHierarchy" name="Compass Group Owned">
<PartyMasterHierarchy>
<Hierarchy level="3" nodeName="Bon Appetit Sector" type="Sector" ID="A00000" refID="A00000">
<Hierarchy level="4" nodeName="BA Division" type="Division" ID="AB0000" refID="AB0000" >
<Hierarchy level="5" nodeName="BA East Coast Region" type="Region" ID="ABE000" refID="ABE000">
<Hierarchy level="6" nodeName="Engstrom, John RVP" type="District" ID="ABE01" refID="ABE01" >
</Hierarchy>
</Hierarchy>
</Hierarchy>
</Hierarchy>
<Hierarchy level="3" nodeName="Levy Sector" type="Sector" ID="K00000" refID="K00000".
<Hierarchy level="4" nodeName="Levy Sector Division" type="Division" ID="K90000" refID="K90000">
<Hierarchy level="5" nodeName="Levy Sector Region" type="Region" ID="K99000" refID="K99000">
<Hierarchy level="6" nodeName="TBA Total" type="District" ID="K9901" refID="K9901"> </Hierarchy>
</Hierarchy>
</Hierarchy>
</Hierarchy>
</PartyMasterHierarchy>
</PartyMaster>
I would like to get CSV output in the format below
DISPLAY_NAME, DOCUMENT_DESCRIPTION, PARENT, EXTERNAL_ID, ORG_UNIT_TYPE
Bon Appetit Sector, Bon Appetit Sector,constant value, A00000, constant value
Levy Sector, Levy Sector, constant value, K00000, constant value
BA Division, BA Division, A00000, AB0000, constant value
Levy Sector Division, Levy Sector Division, K00000, K90000, constant value
BA East Coast Region, BA East Coast Region, AB0000, ABE000, constant value
Levy Sector Region, Levy Sector Region, K90000, K99000, constant value
Engstrom John RVP, Engstrom John RVP, ABE000, ABE01, constant value
TBA Total ,TBA Total ,K99000, K9901, constant value
1) How do I go about this? I think I have to configure an adapter but which adapter would give me the desired result?
2) How do I tell PI when to pick the file from and where to place it after conversion? Could this be done in adapter configuration?
Any help will be greatly appreciated.
Thanks.
--Mithun>>> 1) How do I go about this? I think I have to configure an adapter but which adapter would give me the desired result?
Use File adapter at the sender side to pick up the xml and use file adapter at the receiver side (message protocol file content conversion) to convert xml format to csv.
Basically you have to configure in the file adapter (FCC) on the receiver side to get desired csv structure from XML.
>>> 2) How do I tell PI when to pick the file from and where to place it after conversion? Could this be done in adapter configuration?
Configure sender file adapter to pick up the file from the specified directory. Configure receiver file (fcc adapter) to drop the csv file after conversion.
For sender adapter
http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
For receiver adapter in our case FCC (FILE content Conversion) follow the link
http://help.sap.com/saphelp_NW04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Hope answered your question.
Mapping area: simple suggestion. Keep input and output message same structure and do one to one mapping. In the receiver fcc adapter configure for csv structure following instruction given in the above second link
Note: FCC adapter does not support nested structure more than 2. So in your case you can achieve using conversion agent tool. Otherwise you might have to achieve through some graphical mapping. -
How to convert hierarchy XML to CSV/Excel format using PI/XI
posted in PI forum but not many replies, please bear with me as I am in crunch time*
Hi All,
I am working with SAP PI/XI for the first time and need some help file conversion of complex hierarchy XML to CSV file using PI. I have done plenty of research on SDN and could find much related to what I want to do.
Here is the example of how my input XML would look like:
<?xml version="1.0" encoding="UTF-8"?>
<PartyMaster type="OrgHierarchy" name="Compass Group Owned">
<PartyMasterHierarchy>
<Hierarchy level="3" nodeName="Bon Appetit Sector" type="Sector" ID="A00000" refID="A00000">
<Hierarchy level="4" nodeName="BA Division" type="Division" ID="AB0000" refID="AB0000" >
<Hierarchy level="5" nodeName="BA East Coast Region" type="Region" ID="ABE000" refID="ABE000">
<Hierarchy level="6" nodeName="Engstrom, John RVP" type="District" ID="ABE01" refID="ABE01" >
</Hierarchy>
</Hierarchy>
</Hierarchy>
</Hierarchy>
<Hierarchy level="3" nodeName="Levy Sector" type="Sector" ID="K00000" refID="K00000".
<Hierarchy level="4" nodeName="Levy Sector Division" type="Division" ID="K90000" refID="K90000">
<Hierarchy level="5" nodeName="Levy Sector Region" type="Region" ID="K99000" refID="K99000">
<Hierarchy level="6" nodeName="TBA Total" type="District" ID="K9901" refID="K9901"> </Hierarchy>
</Hierarchy>
</Hierarchy>
</Hierarchy>
</PartyMasterHierarchy>
</PartyMaster>
I would like to get CSV output in the format below
DISPLAY_NAME, DOCUMENT_DESCRIPTION, PARENT, EXTERNAL_ID, ORG_UNIT_TYPE
Bon Appetit Sector, Bon Appetit Sector,constant value, A00000, constant value
Levy Sector, Levy Sector, constant value, K00000, constant value
BA Division, BA Division, A00000, AB0000, constant value
Levy Sector Division, Levy Sector Division, K00000, K90000, constant value
BA East Coast Region, BA East Coast Region, AB0000, ABE000, constant value
Levy Sector Region, Levy Sector Region, K90000, K99000, constant value
Engstrom John RVP, Engstrom John RVP, ABE000, ABE01, constant value
TBA Total ,TBA Total ,K99000, K9901, constant value
1) How do I go about this? I think I have to configure an adapter but which adapter would give me the desired result?
2) How do I tell PI when to pick the file from and where to place it after conversion? Could this be done in adapter configuration?
Any help will be greatly appreciated.
Thanks.
--MithunHi Mithun,
You might try this step below :
1. As for xsd schema fo the xml or create xsd schema base on the sample xml file using tools like xmlspy or others free tools.
2. import you xsd schema as outbound Data type
3. apply mapping from source to target (csv).
Configuration
Sender file adapter (without content conversion)
Receiver file adapter (with content conversion).
so the sender adapter will be monitoring inbound directory and write the result to another directory.
Thank You and Best Regards
Fernand. -
Formatting XML file to avoid mapping parser error
Hi,
We have requirement in our project to process input xml file which is of the below format:
<message>
<data>
<xml version=1.0 code=utf/>
<test>
<data>book</data>
</test>
</data></message>
Since <xml> tag is at the middle it is throwing a exception error in mapping.
Actual requirment is that we need
<test>
<data>book</data>
</test>
The xml of the above format is generated by some external system which PI need to pick it.
I think is not possible in XSLT mapping as it is not starting with xml tag .
So please let me know pointer ot resolve the issue.
Thanks in advance.Hi Yeshwanth,
If this input XML. Then it is valid XML.
<message>
<data>
<xml version="1.0" code="utf" />
<test>
<data>book</data>
</test>
</data>
</message>
Please paste the error message, input and expected output XML.
Regards,
Raghu_Vamsee
Edited by: Raghu Vamsee on Aug 25, 2011 12:10 PM -
File to IDoc : XML parsing in ABAP mapping
Hi,
In ABAP mapping I want to parse all of the incoming XML strings to internal table.Later I add few more fields to this table and transfer them to IDOC adapter in IDOC-XML format.In thsi case how do i get all of the input file data(converted from XML) into internal table using XML parsing in ABAP Mapping?
Thansk in advance,
RPHi Amil,
I insert into table but not immediately,I want all the parsed xml data into internal table and do something before I insert into DB /send it to IDOC.
I knwo how to get single Xml parsing,but how to get multple records(looping xml parse) to internal table?
Thanks,
RP
Edited by: RP@261 on Jun 3, 2009 2:14 PM -
Non-XML payload in graphical mapping
Experts,
I have a scenario where I need to trigger a graphical map which eventually populates an IDoc (custom) structure but the Idoc is not being populated with any of the source field.
My source data is a flat file.
1. I dont want the src file content to be transformed to XML.
2. But need to trigger the map (graphical map) to populate the constant values in IDoc.
However, even with a src message type with a single String type element (no sub-element), the mapping is failing giving XML parsing error.
Question is:
1. If it is possible to call a Graphical map without the XML conversion of the source? if yes.. how?
2. Otherwise can I use Java / ABAP mapping? because since the input parameter for IF_MAPPING~EXECUTE - source is XSTRING type. So can I pass a flat file instead?
- ShibajiHI Shibaji
1. I dont want the src file content to be transformed to XML.
2. But need to trigger the map (graphical map) to populate the constant values in IDoc.
XI expects some XML if it is empty also it will work but you need to send dummy XML for triggering the mapping. You can pass just a blank field as source to trigger this.
. If it is possible to call a Graphical map without the XML conversion of the source? if yes.. how?
IE expects XML to process so you need to send some data to execute mapping. I don't think you can avoid XML conversion.
Otherwise can I use Java / ABAP mapping? because since the input parameter for IF_MAPPING~EXECUTE - source is XSTRING type. So can I pass a flat file instead?
Java or ABAP mapping also require some source and target to be formed and when you can meet the requirement for triggering the mapping from Graphical. It will complicate using Java/ABAP mapping
I think if you have a source dummy message with single field with 0..1 occurrence then it should trigger your mapping without any error
Thanks
Gaurav -
How to transfer multi-input xml file to One xml file using BPM?
Hi!
Using BPM, We wana transfer multiful xml file to One xml at Remote FTP Server.
I don't know how to design BPM.
============== samle1: input xml====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Shipments SYSTEM "DTD/Shipment.dtd">
<Shipments>
<sendingPartnerID>XXX</sendingPartnerID>
<receivingPartnerID>XXX_UPSTMS</receivingPartnerID>
<receivingMessageType>TPSDLS</receivingMessageType>
<Shipment ID="0081646547" Type="CREATE">
<CustomerID>XXX</CustomerID>
</Shipment>
</Shipments>
============== samle2: output xml====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Shipments SYSTEM "DTD/Shipment.dtd">
<Shipments>
<sendingPartnerID>XXX</sendingPartnerID>
<receivingPartnerID>XXX_UPSTMS</receivingPartnerID>
<receivingMessageType>TPSDLS</receivingMessageType>
<Shipment ID="0081646547" Type="CREATE">
</Shipment>
<Shipment ID="0081886548" Type="CREATE">
</Shipment>
<Shipment ID="0081646999" Type="CREATE">
</Shipment>
</Shipments>
Message was edited by: ChangSeop SongHi,
To convert multiple xml files into a single file, you will have to perform a N:1 mapping.
The following tutorials are available on SAP to help you understand BPM and also to collect multiple XML messages so that they can be mapped into a single message. Check them out,
http://help.sap.com/saphelp_nw04/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
Regards,
Bhavesh -
I have an ODSI Physical Service that is based on a Java Function. The Java Function builds a SQL statement and uses JDBC to query for a ResultSet. One of the columns that is queried is a Clob. Sometimes, the data in this column causes an XMLBeans validation exception in ODSI: {err}XQ0027: Validation failed: error: decimal: Invalid decimal value: unexpected char '114'
The issue is not consistently replicable with particular database record, the database records that present this issue at one point in time will be resolved after a restart of ODSI and replaced by another list of records that present the same error.
As can be seen from the stack trace, it looks like the issue is happening after the database query has returned and while the process is assembling the SOAP response.
Error at line:2 col:481 Line:2 '=' expected, got char[99]
at weblogic.xml.babel.scanner.ScannerState.expect(ScannerState.java:241)
at weblogic.xml.babel.scanner.OpenTag.read(OpenTag.java:60)
at weblogic.xml.babel.scanner.Scanner.startState(Scanner.java:251)
at weblogic.xml.babel.scanner.Scanner.scan(Scanner.java:178)
at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:533)
at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:510)
at weblogic.xml.babel.baseparser.EndElement.parse(EndElement.java:34)
at weblogic.xml.babel.baseparser.BaseParser.parseElement(BaseParser.java:457)
at weblogic.xml.babel.baseparser.BaseParser.parseSome(BaseParser.java:326)
at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLStreamReaderBase.java:195)
at weblogic.xml.stax.XMLStreamReaderBase.next(XMLStreamReaderBase.java:237)
at weblogic.xml.stax.XMLEventReaderBase.parseSome(XMLEventReaderBase.java:189)
at weblogic.xml.stax.XMLEventReaderBase.nextEvent(XMLEventReaderBase.java:122)
at weblogic.xml.query.parsers.StAXEventAdaptor.queueNextTokens(StAXEventAdaptor.java:136)
at weblogic.xml.query.parsers.StAXEventAdaptor.queueNextTokens(StAXEventAdaptor.java:124)
at weblogic.xml.query.parsers.BufferedParser.fetchNext(BufferedParser.java:79)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at weblogic.xml.query.runtime.navigation.ChildPath.fetchNext(ChildPath.java:308)
at weblogic.xml.query.iterators.GenericIterator.hasNext(GenericIterator.java:133)
at weblogic.xml.query.schema.BestEffortValidatingIterator$OpenedIterator.hasNext(BestEffortValidatingIterator.java:224)
at weblogic.xml.query.schema.ValidatingIterator.fetchNext(ValidatingIterator.java:82)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at weblogic.xml.query.xdbc.iterators.ItemIterator.fetchNext(ItemIterator.java:86)
at weblogic.xml.query.iterators.LegacyGenericIterator.next(LegacyGenericIterator.java:109)
at weblogic.xml.query.schema.BestEffortValidatingIterator.fetchNext(BestEffortValidatingIterator.java:85)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at weblogic.xml.query.xdbc.iterators.ItemIterator.fetchNext(ItemIterator.java:86)
at weblogic.xml.query.iterators.LegacyGenericIterator.next(LegacyGenericIterator.java:109)
at weblogic.xml.query.runtime.typing.SeqTypeMatching.fetchNext(SeqTypeMatching.java:137)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at com.bea.dsp.wrappers.jf.JavaFunctionIterator.fetchNext(JavaFunctionIterator.java:273)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at weblogic.xml.query.runtime.querycide.QueryAssassin.fetchNext(QueryAssassin.java:54)
at weblogic.xml.query.iterators.GenericIterator.peekNext(GenericIterator.java:163)
at weblogic.xml.query.runtime.qname.InsertNamespaces.fetchNext(InsertNamespaces.java:247)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at weblogic.xml.query.runtime.core.ExecutionWrapper.fetchNext(ExecutionWrapper.java:88)
at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:104)
at weblogic.xml.query.xdbc.iterators.ItemIterator.fetchNext(ItemIterator.java:86)
at weblogic.xml.query.iterators.LegacyGenericIterator.hasNext(LegacyGenericIterator.java:130)
at weblogic.xml.query.xdbc.util.Serializer.serializeItems(Serializer.java:251)
at com.bea.ld.server.ResultPusher$DSP25CompatibilityPusher.next(ResultPusher.java:236)
at com.bea.ld.server.ResultPusher.pushResults(ResultPusher.java:112)
at com.bea.ld.server.XQueryInvocation.execute(XQueryInvocation.java:770)
at com.bea.ld.EJBRequestHandler.invokeQueryInternal(EJBRequestHandler.java:624)
at com.bea.ld.EJBRequestHandler.invokeOperationInternal(EJBRequestHandler.java:478)
at com.bea.ld.EJBRequestHandler.invokeOperation(EJBRequestHandler.java:323)
at com.bea.ld.ServerWrapperBean.invoke(ServerWrapperBean.java:153)
at com.bea.ld.ServerWrapperBean.invokeOperation(ServerWrapperBean.java:80)
at com.bea.ld.ServerWrapper_s9smk0_ELOImpl.invokeOperation(ServerWrapper_s9smk0_ELOImpl.java:63)
at com.bea.dsp.ws.RoutingHandler$PriviledgedRunner.run(RoutingHandler.java:96)
at com.bea.dsp.ws.RoutingHandler.handleResponse(RoutingHandler.java:217)
at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:287)
at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:271)
at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:176)
at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:80)
at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:285)
at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
<Apr 29, 2011 12:47:01 PM EDT> <Notice> <ODSI> <BEA-000000> <LabOrderDataServices> <Error occurred performing ODSI operation: {ld:LabOrder/logical/LabOrderReport}getLabOrderDetails:1
weblogic.xml.query.exceptions.XQueryDynamicException: ld:LabOrder/logical/LabOrderReport.ds, line 34, column 6: {err}FODC0002 [{bea-err}FODC0002a]: Error parsing input XML: Error at line:2 col:481 Line:2 '=' expected, got char[99]
at weblogic.xml.query.iterators.AbstractIterator.reportUserError(AbstractIterator.java:95)
at weblogic.xml.query.iterators.AbstractIterator.reportUserError(AbstractIterator.java:147)
at weblogic.xml.query.parsers.Parser.reportParseError(Parser.java:157)
at weblogic.xml.query.parsers.StAXEventAdaptor.queueNextTokens(StAXEventAdaptor.java:225)
at weblogic.xml.query.parsers.StAXEventAdaptor.queueNextTokens(StAXEventAdaptor.java:124)
Truncated. see log file for complete stacktrace
javax.xml.stream.XMLStreamException: Error at line:2 col:481 Line:2 '=' expected, got char[99]
at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLStreamReaderBase.java:206)
at weblogic.xml.stax.XMLStreamReaderBase.next(XMLStreamReaderBase.java:237)
at weblogic.xml.stax.XMLEventReaderBase.parseSome(XMLEventReaderBase.java:189)
at weblogic.xml.stax.XMLEventReaderBase.nextEvent(XMLEventReaderBase.java:122)
at weblogic.xml.query.parsers.StAXEventAdaptor.queueNextTokens(StAXEventAdaptor.java:136)
Truncated. see log file for complete stacktrace
Error at line:2 col:481 Line:2 '=' expected, got char[99]
at weblogic.xml.babel.scanner.ScannerState.expect(ScannerState.java:241)
at weblogic.xml.babel.scanner.OpenTag.read(OpenTag.java:60)
at weblogic.xml.babel.scanner.Scanner.startState(Scanner.java:251)
at weblogic.xml.babel.scanner.Scanner.scan(Scanner.java:178)
at weblogic.xml.babel.baseparser.BaseParser.accept(BaseParser.java:533)
Truncated. see log file for complete stacktrace
>
Can somebody shed some light on this issue?
Thanks
Edited by: user738507 on May 6, 2011 7:21 AMHere is the java function:
* Iterate through the search results and build out the XmlBean response
* @param helper A helper class used to simplify common JDBC commands
* @param doc The XmlBean document to populate
* @param isCollectionsIncluded True if Collection info should be included in results, False otherwise
* @param isFullDetailsIncluded True if Result data should be included in results, False otherwise
* @throws Exception
private static void addOrders(XmlBeansJDBCHelper helper, LabOrderReportDocument doc,
boolean isCollectionsIncluded, boolean isFullDetailsIncluded) throws Exception {
int rows = 0;
ResultSet rs = helper.getResultSet();
LabOrders labOrders = doc.getLabOrderReport().addNewLabOrders();
LabOrder record = null;
HashMap<Long, Collection> parentCollectionMap = null;
// initialize variable used to track when child elements of the XML should be created
long previousRowOrderId = 0;
long previousRowParentOrderCollectionId = 0;
long previousRowOrderCollectionId = 0;
long previousRowResultId = 0;
boolean isRootCollectionNode = false;
LabOrder.Collections lastParentOuterCollectionsAdded = null;
com.idexx.services.lde.laborder.Collection.Collections lastParentInnerCollectionsAdded = null;
com.idexx.services.lde.laborder.Collection lastCollectionAdded = null;
Result lastResultAdded = null;
// Loop through the results and build XmlBean nodes for each row
// Since the SQL is joining Orders to Collections (one-to-many) to Results (one-to-many),
// and returning a flat structure, there will be duplicate Order data on each row when
// multiple collections exist on the Order, and duplicate Collection data when multiple
// Results exist. We can use this fact to determine when to create a new Collection, or
// Result node.
while (helper.getResultSet().next())
rows++;
long currentRowParentOrderCollectionId = 0;
long currentRowOrderCollectionId = 0;
long currentRowResultId = 0;
long currentRowResultRemarkId = 0;
//int rowno = helper.getResultSet().getRow();
// Get the Order ID
logDebug("Getting the OrderId.....");
BigInteger dbOrderId = JDBCHelper.getBigInteger(rs, DataConstants.ORDER_ID);
logDebug("DONE getting the OrderId.");
long currentRowOrderId = dbOrderId.longValue();
// Determine the Order ID, Order Collection ID, and Result ID currently being processed.
// These will be used to determine whether to start a new LabOrder Bean, Collections Bean, or Results Bean
if (isCollectionsIncluded || isFullDetailsIncluded) {
// Get the ParentOrderCollectionID
logDebug("Getting the Parent Collection Order ID.....");
BigInteger dbParentOrderCollectionId = JDBCHelper.getBigInteger(rs, DataConstants.PARENT_ORDER_COLLECTION_ID);
if ( dbParentOrderCollectionId != null )
currentRowParentOrderCollectionId = dbParentOrderCollectionId.longValue();
else
currentRowParentOrderCollectionId = 0;
// Get the OrderCollectionID
logDebug("Getting the Order Collection ID.....");
BigInteger dbOrderCollectionId = JDBCHelper.getBigInteger(rs, DataConstants.ORDER_COLLECTION_ID);
if ( dbOrderCollectionId != null )
currentRowOrderCollectionId = dbOrderCollectionId.longValue();
else
currentRowOrderCollectionId = 0;
if ( isFullDetailsIncluded ) {
// Get the ResultID
logDebug("Getting the Result Id.....");
BigInteger dbResultId = JDBCHelper.getBigInteger(rs, DataConstants.RESULT_ID);
if ( dbResultId != null )
currentRowResultId = dbResultId.longValue();
else
currentRowResultId = 0;
// Get the ResultRemarkID
BigInteger dbResultRemarkId = JDBCHelper.getBigInteger(rs, DataConstants.RESULT_REMARK_ID);
if ( dbResultRemarkId != null )
currentRowResultRemarkId = dbResultRemarkId.longValue();
else
currentRowResultRemarkId = 0;
isRootCollectionNode = (currentRowParentOrderCollectionId == 0);
logDebug("currentRowOrderId: " + currentRowOrderId);
logDebug("previousRowOrderId: " + previousRowOrderId);
logDebug("currentRowResultId: " + currentRowResultId);
logDebug("previousRowResultId: " + previousRowResultId);
logDebug("currentRowResultRemarkId: " + currentRowResultRemarkId);
logDebug("previousRowResultRemarkId: N/A");
logDebug("currentRowParentOrderCollectionId: " + currentRowParentOrderCollectionId);
logDebug("previousRowParentOrderCollectionId: " + previousRowParentOrderCollectionId);
logDebug("currentRowOrderCollectionId: " + currentRowOrderCollectionId);
logDebug("previousRowOrderCollectionId: " + previousRowOrderCollectionId);
if ( currentRowOrderId != previousRowOrderId ) {
parentCollectionMap = new HashMap<Long, Collection>();
lastParentOuterCollectionsAdded = null;
lastParentInnerCollectionsAdded = null;
lastCollectionAdded = null;
lastResultAdded = null;
// This is a new Order, generate a new Lab Order bean
record = addOrder(labOrders, helper, dbOrderId, isFullDetailsIncluded);
logDebug("Order Added!");
// If there is Parent Collection data and it should be included, build a Collections element,
// and populate the first one
if ( !isRootCollectionNode && (isCollectionsIncluded || isFullDetailsIncluded) ) {
lastParentOuterCollectionsAdded = record.addNewCollections();
lastCollectionAdded = addCollection(record, helper, lastParentOuterCollectionsAdded, true);
logDebug("Collection Added! Is it null? " + (lastCollectionAdded == null));
// If there is Collection data and it should be included, build a Collections element,
// and populate the first one
if ( currentRowOrderCollectionId > 0 && (isCollectionsIncluded || isFullDetailsIncluded) ) {
if ( isRootCollectionNode ) {
lastParentOuterCollectionsAdded = record.addNewCollections();
lastCollectionAdded = addCollection(record, helper, lastParentOuterCollectionsAdded, false);
parentCollectionMap.put(new Long(currentRowOrderCollectionId), lastCollectionAdded);
logDebug("parent collection added to map: " + currentRowOrderCollectionId);
else {
lastParentInnerCollectionsAdded = lastCollectionAdded.addNewCollections();
lastCollectionAdded = addCollection(record, helper, lastParentInnerCollectionsAdded, false);
logDebug("Collection Added! Is it null? " + (lastCollectionAdded == null));
// If there is Result data and it should be included, build a Results element,
// and populate the first one
if ( currentRowResultId > 0 && isFullDetailsIncluded ) {
logDebug("Adding result....");
lastResultAdded = addResult(record, helper, lastCollectionAdded);
logDebug("Result Added!");
// If there is Result Remark data and it should be included, build a ResultRemarks element,
// and populate the first one
if ( currentRowResultRemarkId > 0 && isFullDetailsIncluded ) {
addResultRemark(record, helper, lastResultAdded);
logDebug("DONE getting first Collection and Result.");
else if ( currentRowParentOrderCollectionId != previousRowParentOrderCollectionId
&& (isCollectionsIncluded || isFullDetailsIncluded) ) {
// This is a new, top level, Order Collection to be included
lastParentOuterCollectionsAdded = null;
lastParentInnerCollectionsAdded = null;
lastCollectionAdded = null;
lastResultAdded = null;
logDebug("Getting next Order Collection...");
// If there is Parent Collection data and it should be included, build a Collections element,
// and populate the first one
if ( !isRootCollectionNode ) {
lastCollectionAdded = (com.idexx.services.lde.laborder.Collection)parentCollectionMap.get(new Long(currentRowParentOrderCollectionId));
logDebug("A Collection Added! Is it null? " + (lastCollectionAdded == null));
// If there is Collection data and it should be included, build a Collections element,
// and populate the first one
if ( currentRowOrderCollectionId > 0 ) {
if ( isRootCollectionNode ) {
//LabOrder.Collections collections = record.addNewCollections();
lastParentOuterCollectionsAdded = record.getCollections();
lastCollectionAdded = addCollection(record, helper, lastParentOuterCollectionsAdded, false);
parentCollectionMap.put(new Long(currentRowOrderCollectionId), lastCollectionAdded);
else {
lastParentInnerCollectionsAdded = lastCollectionAdded.addNewCollections();
lastCollectionAdded = addCollection(record, helper, lastParentInnerCollectionsAdded, false);
logDebug("B Collection Added! Is it null? " + (lastCollectionAdded == null));
// If there is Result data and it should be included, build a Results element,
// and populate the first one
if ( currentRowResultId > 0 && isFullDetailsIncluded ) {
lastResultAdded = addResult(record, helper, lastCollectionAdded);
// If there is Result Remark data and it should be included, build a ResultRemarks element,
// and populate the first one
if ( currentRowResultRemarkId > 0 && isFullDetailsIncluded ) {
addResultRemark(record, helper, lastResultAdded);
else if ( currentRowOrderCollectionId != previousRowOrderCollectionId
&& (isCollectionsIncluded || isFullDetailsIncluded) ) {
// This is a new Order Collection to be included inside of a parent collection
logDebug("Getting next CHILD Order Collection...");
logDebug("isRootCollectionNode: " + isRootCollectionNode);
logDebug("Order ID: " + helper.getBigInteger(DataConstants.ORDER_ID));
logDebug("Order Collection ID: " + helper.getBigInteger(DataConstants.ORDER_COLLECTION_ID));
logDebug("Collection ID: " + helper.getBigInteger(DataConstants.COLLECTION_ID));
if ( isRootCollectionNode ) {
lastCollectionAdded = addCollection(record, helper, lastParentOuterCollectionsAdded, false);
parentCollectionMap.put(new Long(currentRowOrderCollectionId), lastCollectionAdded);
else {
com.idexx.services.lde.laborder.Collection parentCollection = (com.idexx.services.lde.laborder.Collection)parentCollectionMap.get(new Long(currentRowParentOrderCollectionId));
if(parentCollection == null) {
log(LOG_LEVEL.WARN, "Parent Collection with id: " + currentRowParentOrderCollectionId + " is null for collection id: " + currentRowOrderCollectionId + " but isRootCollectionNode is " + isRootCollectionNode);
} else {
lastParentInnerCollectionsAdded = parentCollection.getCollections();
logDebug("Is lastParentInnerCollectionsAdded null? " + (lastParentInnerCollectionsAdded == null));
lastCollectionAdded = addCollection(record, helper, lastParentInnerCollectionsAdded, false);
// If there is Result data and it should be included, build a Results element,
// and populate the first one
if ( currentRowResultId > 0 && isFullDetailsIncluded ) {
lastResultAdded = addResult(record, helper, lastCollectionAdded);
// If there is Result Remark data and it should be included, build a ResultRemarks element,
// and populate the first one
if ( currentRowResultRemarkId > 0 && isFullDetailsIncluded ) {
addResultRemark(record, helper, lastResultAdded);
else if ( currentRowResultId != previousRowResultId
&& isFullDetailsIncluded ) {
// There is a new Result to be included
logDebug("Getting next Result...");
// This is a new result to be included
lastResultAdded = addResult(record, helper, lastCollectionAdded);
// If there is Result Remark data and it should be included, build a ResultRemarks element,
// and populate the first one
if ( currentRowResultRemarkId > 0 && isFullDetailsIncluded ) {
addResultRemark(record, helper, lastResultAdded);
else if ( isFullDetailsIncluded ) {
// There is a new Result Remark to include
logDebug("Getting next Result Remark...");
// This is a new result remark to be included
addResultRemark(record, helper, lastResultAdded);
logDebug("Done building response.");
previousRowResultId = currentRowResultId;
previousRowParentOrderCollectionId = currentRowParentOrderCollectionId;
previousRowOrderCollectionId = currentRowOrderCollectionId;
previousRowOrderId = currentRowOrderId;
logDebug("Found " + rows + " rows of data.");
} -
Hi All,
I have 2 identical table structures with different data in Oracle.
I am using following xsql and XSLT sheet to produce xml files with these tables. ( have to run twice xsql file by changing the Table names )
When I run the xsql file with Table1, it works fine, produced the xml file on the browser.
But when I run the xsql file with Table2, it gives following error message:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'http://192.10.1.14:8988/Workspace_ONIX-ONIX2-context-root/untitled1.xsql'. Line 1, Position 1
oracle.xml.sql.OracleXMLSQLException: Cannot map Unicode to Oracle character.
^
These two are my xsql and xslt files:
- - - - xsql file - - - -
<?xml version = '1.0' encoding = 'windows-1252'?>
<?xml-stylesheet type="text/xsl" href="TT14.xsl"?>
<xsql:query connection="Connection1" id-attribute="" tag-case="lower"
rowset-element="LIST" row-element="DEPA"
xmlns:xsql="urn:oracle-xsql">
SELECT * from TT26
</xsql:query>
TT14.xsl file
<xsl:stylesheet version="1.0" encoding="UTF-8" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method ="xml" indent= "yes" encoding="UTF-8"/>
<!--DOCTYPE ONIXmessage SYSTEM "http://www.editeur.org/onix/2.1/reference/onix-international.dtd"-->
<xsl:template match ="list">
<BBMessage>
<<xsl:for-each select="depa">
<Product>
<RecordReference>
<xsl:value-of select="wai"/>
</RecordReference>
<NotificationType>
<xsl:value-of select="wantype"/>
</NotificationType>
</Product>
</xsl:for-each>
</BBMessage>
</xsl:template>
</xsl:stylesheet>
All comments are highly welcomed...
ThanksHi Deepak
Thanks for the post, but I am afraid that's not the issue with the error.
I changed both encoding to "UTF-8" still i get the problem.
I tried even without the XSLT sheet, still I have the problem..
- - - - xsql file ---
<?xml version = '1.0' ?>
<!--
| Uncomment the following processing instruction and replace
| the stylesheet name to transform output of your XSQL Page using XSLT
<?xml-stylesheet type="text/xsl" href="YourStylesheet.xsl" ?>
-->
<page xmlns:xsql="urn:oracle-xsql" connection="Connection1">
<xsql:query max-rows="-1" null-indicator="no" tag-case="lower">
select * from Table2
</xsql:query>
</page>
- - - - Result ----
<?xml version="1.0" ?>
- <!--
| Uncomment the following processing instruction and replace
| the stylesheet name to transform output of your XSQL Page using XSLT
<?xml-stylesheet type="text/xsl" href="YourStylesheet.xsl" ?>
-->
- <page>
<error>oracle.xml.sql.OracleXMLSQLException: Cannot map Unicode to Oracle character.</error>
</page>
Any Comment ???
Thanks -
I have been able to get Liquid Data up and running.
I have set my Output XSD as the target schema
I have included my DB and mapped it to the Output XSD
I am having problems getting the Input XML into my project. When I include in my XML source (input xsd) it does not show all the elements....
My bigger question is, can I through Liquid Data, map an input XML file to a DB (run sql to match up XML element value and DB table values) and export the SQL recordset to my defind XML file?
I started down this road based on a 'yes' answer from a
peer.
Spending a little more time than I had hoped on this one...
I need to do this below..
<Membership_ID>000001</Membership_ID> //Input XML
...db....
Select * from Member_Table where XML.Membership_ID = Member_Table.Memb_ID
...db....
Insert Into Pre-Defined XML.....
<Memb_F_Name>Elvis</Memb_F_Name>
<Memb_L_Name>Costello</Memb_L_Name>
<Memb_City>Miami</Memb_City>
<Memb_Age>50</Memb_Age>
<Memb_ID>000001</Memb_ID> //Makes Hit On This
Making progress but, any examples would be great...
TIA
Jayto use an xml file as a datasource, create an XML File Datasource in the LD Console (you need to specify a schema there). Go to the DataView Builder, reconnect to the server, it will show the XML File source with all the elements defined in the schema.
To compare values with a db against values in a file, you need to defined an LD rdbms source for the db and an LD XML file source for the file.
Then write your xquery - it will look something like...
for $file_rec in document("MyFileSource")
for $db_rec in document("MyDBSource")
where $db_rec/Member_id eq $file_rec/Member_id
return
$db_rec -
Input XML having multiple values in the same tag
Hi,
In my scenario, my input XML is in the following format...
<Product>
<Site_ID>A1, A2, A3</Site_ID>
<SIte_Name>ABC, XYZ, PQR</Site_Name>
</Product>
A1 corresponds to ABC
A2 corresponds to XYZ and so on...
Is there some way to retrieve values from such a source file and then map it to the target
i.e A1 ABC has to go as one record
A2 XYZ has to go as a second record and so on..
Thanks in advance,
Regards,
Karenusing xslt you can retrive Site_ID values and Site_name and then you have to use your own abap logic to split the values.
for example
site_name = 'A1, A2, A3, A4' .
then you can use split site_name at ',' into table <itab> -
Input xml to where clause ..
An input XML passed as a parameter to the oracle stored procedure . based on input xml the dynamic predicate( where ) clause need to be build . for example
<map opt="and" >
<map opt="and" >
<condition opt="equal" >
<key>job_id</key>
<value>IT_PROG</value>
</condition>
<conditon opt="equal" >
<key>salary</key>
<value>9000</value>
</conditon>
</map>
<map opt="or" >
<condition opt="equal" >
<key>manger_id</key>
<value>100</value>
</condition>
<conditon opt="like" >
<key>lastname</key>
<value>m</value>
</conditon>
</map>
</map>
select * from employees where (job_id='IT_PROG' and salary='9000') or (manager_id = '100' or last_name like '%m%').
please help with pl/sql part of this . i have written a pl/sql which can print the element tag , what changes should i make this code .
The input xml will be dynamic based on the input xml the predicate should be prepared, i want to use oracle dom .
declare
vxml xmltype;
l_xmldoc xmldom.DOMDocument;
l_ndlist xmldom.DOMNodeList;
l_node xmldom.DOMNode;
l_element xmldom.DOMElement;
len number;
BEGIN
vxml:= xmltype('<map opt="and" >
<map opt="and" >
<condition opt="equal" >
<key>job_id</key>
<value>IT_PROG</value>
</condition>
<conditon opt="equal" >
<key>salary</key>
<value>9000</value>
</conditon>
</map>
<map opt="or" >
<condition opt="equal" >
<key>manger_id</key>
<value>100</value>
</condition>
<conditon opt="like" >
<key>lastname</key>
<value>m</value>
</conditon>
</map>
</map>
l_xmldoc := xmldom.newDOMDocument(vxml);
l_ndlist := xmldom.getElementsByTagName(l_xmldoc, '*');
len := xmldom.getLength(l_ndlist);
-- loop through elements
for i in 1..len-1 loop
l_node := xmldom.item(l_ndlist, i);
dbms_output.put( xmldom.getNodeName(l_node));
l_node := xmldom.getFirstChild(l_node);
if xmldom.getNodeType(l_node) = xmldom.TEXT_NODE then
dbms_output.put('='|| xmldom.getNodeValue(l_node) || ' ');
end if;
dbms_output.put(' ');
end loop;
dbms_output.put_line('');
END;>
our application has java front end , the users have option to select multiple filter values . the frond end developers will send an xml construct as the one i have showed . based on the input xml i have to apply those filters on a table . so i thought using xml dom and parse the xml and make a dynamic sql from that .
>
why java app needs to send XML? Let it create SQL and execute it.
Of course you can do it in PL/SQL but it less convenient comparing to Java.
If you can extract values from XML, then just create SQL for them, assign bind vars and execute it dynamically.
Yes, you will have to implement lots of IF logic.
Advise: Use bind variables as placeholders for values to avoid injection attacks. Do not concatenate values into your dynamic SQL. -
Batch input xml files to one flatfile output
I have a receive location where I would need to wait for couple of minutes to get
all the xml files needed to process. Every file in that receive location is of same format.
I would need to produce one output flat file for all the input xml files received within couple of minutes.A mapping need
to be applied on every file before it's converted to a flat file batch.
I tried to batch the input xml files but I am unable to implement the mapping which has to be applied on every input xml
file.
How do I approach this?Thank you for your response.The transformed xml has got header, body and trailer so when I processed two files by using the map in the receive port. The batched output flat file is as below:
HEADER 27052014
1 HSGbryan_oNSYS300270520141038
2 HSG3851911NSYS150220420141455 22042014
3 HSG3851909NSYS150220420141449 22042014
4 HSG3853034NSYS150220420141436 22042014
TRAILER 4
HEADER 27052014
1 HSGbryan_oNSYS150270520141045
TRAILER 1
However, the required output is
HEADER 27052014
1 HSGbryan_oNSYS300270520141038
2 HSG3851911NSYS150220420141455 22042014
3 HSG3851909NSYS150220420141449 22042014
4 HSG3853034NSYS150220420141436 22042014
5 HSGbryan_oNSYS150270520141045
TRAILER 5
Is there anything we can tweak in to have one header and trailer with the body having sequential row count for the entire flat file batched message?
Maybe you are looking for
-
How do I get my entire iTunes library off of my iPhone?
I have an iPhone 4s, and for some reason I have every song in my iTunes library on my phone. I put in my settings on the computer to only sync my playlist, but it still puts on other playlists that I can't delete off my phone. EDIT: I've noticed that
-
Sound broken on my new macbook pro
When I drag something to the trash, or to a new folder, or empty the trash, my compuer is not making any sounds as it usually does. The sound on my itunes does work, but otherwise my sound seems to have some kind of problem. Ideas?
-
Quick time buffer overrun message after iTunes 7.3 install/
I just updated to iTunes 7.3 on my Windows XP machine. Now whenever I start the Quicktime Player, I get the following Visual C++ Runtime Library error message... "Buffer Overrun Detected! C:\Program Files\QuickTime\QuickTimePlayer.exe A buffer overru
-
Can't get Adobe login to work in Muse forum
I have Muse questions and I'm really hoping I don't have to create yet another online account. (Whatever happened to that thumbprint login technology that was supposedly being developed by somebody years ago?!!) Do Adobe accounts not work on the Muse
-
Trying to download VirtualDj from app store: how do you know it is downloading
Seems like it is just spinning. Are there any indicators to let you know the process is working