Avoid explicit closing tag in XML using graphical mapping
Hi,
I created a data type with an element called TAG1 which has an attribute called attr.
I mapped an empty constant to the element and the value XXX to the attribute. I`m using graphical mapping and the XML I get is the following:
<TAG1 attr = u201CXXXu201D></TAG1>
But for reasons of volume I need to generate the XML without the explicit closing tag, such as:
<TAG1 value = u201CXXXu201D/>
Is there any possibility to achieve this with graphical mapping?
Thanks & Best Regards,
Viviana
> But for reasons of volume I need to generate the XML without the explicit closing tag, such as:
>
> <TAG1 value = u201CXXXu201D/>
>
> Is there any possibility to achieve this with graphical mapping?
This is not posible. The graphical mapping always creates start and end tag, even for empty elements.
You need a seperate mapping step with XSLT or Java mapping.
Regards
Stefan
Similar Messages
-
How to make an explicit closing tag in XML(e4x).
I'm working with some XML data and I'm having trouble forcing the way my closing tags are generated.
I want the long hand form, such as:
var xmlData:XML =
<code>
<codeSnippet>
</codeSnppet>
</code>;
But when I try to insert nodes within the codeSnippet node as child nodes(<snippet />, etc.), and then write to a file, it
makes the codeSnippet node look like <codeSnippet /> and the <snippet /> nodes are after, which will not work.
How can I make it NOT treat an empty node as <codeSnippet /> and explicitly keep it as in long hand form, such as:
<codeSnippet>
</codeSnppet>
Thanks...
fdI figured it out for myself.
So, does that mean I get the 10 points?
fd -
Closing tag in xml transformation
Hi experts,
I have the following ABAP code:
ABAP itab to XML string
CALL TRANSFORMATION id SOURCE data = ti_stocks[]
RESULT XML ps_output.
The result in ps_output should be an xml like this
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<ZTABLE_STO>
<FIELD1 /> ABC</FIELD1>
<FIELD2 />0300</FIELD2>
<FIELD3 />1</FIELD3>
</ZTABLE_STO>
etc.
However, if my internal table ti_stocks contains the field1 with an empty value then the xml is incorrect without its corresponding closing tag:
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<ZTABLE_STO>
<FIELD1 />
<FIELD2 />0300</FIELD2>
<FIELD3 />1</FIELD3>
</ZTABLE_STO>
etc.
How can I resolve this problem? I would like to have an open tag and a closing tag for every field.
FIELD1 is a char type field.
Thank you,
Oscar
Edited by: Oscar Arranz on Jan 26, 2012 2:46 PMHello everyone, sorry for my english, I had the same requeriment for the end tag, the simple transformation give this result <xxx/> when the value was empty, and I did something similar to Oscar,
i did the simple transformation and the result whas and xstring, i used a function to pass it to string, and then I make a replacement.
here is some code:
* Genera XML
data: xml_xstring type xstring.
data: w_xml type string.
data: ixml type ref to if_ixml,
streamfactory type ref to if_ixml_stream_factory,
encoding type ref to if_ixml_encoding,
ixml_ostream type ref to if_ixml_ostream.
data: resstream type ref to if_ixml_ostream.
****Create an instance of the Ixml Processor
ixml = cl_ixml=>create( ).
* ****Create the Stream Factory
streamfactory = ixml->create_stream_factory( ).
* ****Create an Endcoding and Byte Order
encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
* * ****Create the output stream with a pointer to our binary string
ixml_ostream = streamfactory->create_ostream_xstring( xml_xstring ).
* ****Set the Encoding into a stream
ixml_ostream->set_encoding( encoding = encoding ).
****Call simple Transformation
call transformation zdte_libros
source zcaratula = x_doc
result xml ixml_ostream.
*From xstring to string.
call function 'HR_RU_CONVERT_HEX_TO_STRING'
exporting
xstring = xml_xstring
importing
cstring = w_xml.
* <xxx/> to <xxx><xxx/>
replace all occurrences of regex '<([^><\s]+)( [^><]+)?/>' in w_xml with '<$1$2></$1>'.
Hope it helps someone with the same problem . -
Can i use graphical mapping to do such conversion or do i need java mapping
Hi Folks,
Need all your help and experience in solving this .
Can you let me know is it possible do to such kind of conversion in XI using file adapter or do I need to do java mapping
Say from rom database I get data in this format
Seq Field Name Field Value
1 Cust No Cust 1
1 S SS1
1 Score1 10
1 Score 2 12
2 Cust No Cust 2
2 S SS2
2 Score1 5
2 Score 2 10
Based on this my o/p has to be
Cust 1 SS1 10 12
Cust 2 SS2 5 10
( ie values in the last column )
The number of rows returned from database can vary . like here for 1 seq it gives 4 in the example bt it can be any number
Like
Seq Field Name Field Value
1 Cust No Cust 1
1 S SS1
1 Score1 10
1 Score 2 12
1 Score3 15
2 Cust No Cust 2
2 S SS2
2 Score1 5
2 Score 2 10
2 Score3 25
Based on this my o/p has to be
Cust 1 SS1 10 12 15
Cust 2 SS2 5 10 25
is there any way that we can use graphical mapping plus file content conversion to do this or is java based mapping the only solution
Thanks
amitHi Amit,
You can do this using Graphical mapping and File Content Conversion.You concatenate the necessary fields in a Context and assign it to the the field Data(or field name of your wish )) in the target which will of the structure
<Records>
<Record>
<Data>concatenated value</Data>
</Record>
</Records>
and in File Content Conversion
make Records,Record 0:1 and Data as 0:unbounded
and give Recordset Structure as Record
then Record.fieldSeparator as 'nl'
This will give you desired output
Regards,
Sundar -
Hi,
i want to create events on the graphics as the maps in BSP. we can do this in HTML using <map> and <area>extensions.
There is <graphics> extension in BSP, but i don't know how to use this extension.
<%@extension name="graphics" prefix="graphics" %>
<graphics:map>
</graphics:map>
Does anybody know how to use the graphics as maps in bsp? Can somebody help me please?
Thanks.Look at the below sample BSP application:
GRAPH_BSP_TEST
GRAPH_TUT_CHART
GRAPH_TUT_JNET
Hope it might help.
Raja -
Remove tags from XML using transformation
Can anybody tell me how to remove empty tags using xsl transformation.
<App_Data App="MOD" Name="Metadata_Id" Value="SP1282"/>
<App_Data App="MOD" Name="Metadata_Spec_Major_Version" Value=""/>
<App_Data App="MOD" Name="Metadata_Spec_Minor_Version" Value=""/>
My XML will have tags similar to above. My requirement is to remove all tags having attribute Value="". How can i achieve this using transformation.
Thanks
KrishYou need to add the xsi:nil="true" attribute to your xsl-construct to be able to ommit the xml-element which are empty.
To be able to do this you need to add a choose-when-otherwise xsl construct inside your mapping file to test for ""-values.
The xsi:nill='true' isn't supported in the transform-activity yet, you need to add this attribute manually inside your xsl-mapping file.
Kind regards,
Nathalie -
How to create Nested (Multi level ) tag in XML using DBMS_XMLQUERY function
Hi,
I need Following out put in CLOB Column.
XML format Like :
<?xml version="1.0" encoding="UTF-8"?>
<ReceiptHeader>
<Id>1234556</Id>
<Type>DD</Type>
<Receipts>
<ReceiptDEO>
<StoreId>11380001</StoreId>
<EmployeeId>NOLO980</EmployeeId>
<LineItems>
<ReceiptLineItem>
<CartonId>ABC12345</CartonId>
<ShippedQty>1.0000</ShippedQty>
<UnitCost>118.500000</UnitCost>
</ReceiptLineItem>
</LineItems>
<ReceiptDate>Wed Jun 20 11:50:01 CEST 2012</ReceiptDate>
<ReceiptNumber>3127855</ReceiptNumber>
</ReceiptDEO>
</Receipts>
</ReceiptHeader>
And i'm using dbms_xmlquery.newcontext ( );
Can you please help to get above output.
- Thanks,
PallaviHi ,
Thanks for reply .
Version is "Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production".
First I tried with DBMS_XMLGEN ,, it doesnt work properly.
Then tried with XMLAGG and XMLELEMENT but giving me output in 1 row. I need proper XML format.
Following is some data, For which I had created view of 2 tables.
ID STORE_ID EMPLOYEE_ID ACTUAL_ARRIVAL_DATE CARTON_ID SHIPMENT_ID QUANTITY_RECEIVED UNIT_COST RECEIPT_DOC_ID RECEIPT_Date
3772 12340001 PALS001 16-Feb-11 2A632 29 28.000 118.50000 1234 16-Feb-11
3775 12340001 PALS001 16-Feb-11 1A633 30 120.000 218.50000 7866 16-Feb-11
3776 12340001 PALS001 16-Feb-11 2A634 30 75.000 345.75000 7876 16-Feb-11
3773 12340001 PALS001 16-Feb-11 3A632 30 45.000 200.10000 7869 16-Feb-11
3774 12340001 PALS001 16-Feb-11 3A632 30 10.000 450.45000 7869 16-Feb-11
Please suggest better way..
-Thanks,
Pallavi -
Remove the unnecessary tags in XML using PL/SQL
Hi Friends
from the below XML, its generate by a complex SQL query, Now we need to remove all the object type tags, and all the empty tags.
Version - PL/SQL Release 11.2.0.3.0 - Production
<MajorLine>
<MAJOR_LINE_OBJECT_TYPE> -- Need to remove these Objects types showing in the XML
<LINEID>143424538</LINEID>
<ITEMNAME>TC-ABC-123</ITEMNAME>
<ITEMPATH>78245</ITEMPATH>
<QUANTITY>10</QUANTITY>
<SERVICELINE/> -- Need to remove all the Empty tags
<MINORLINE>
<MINOR_LINE_OBJECT_TYPE> -- Need to remove these Objects types showing in the XML
<LINEID>143424799</LINEID>
<ITEMNAME>TCC-abc</ITEMNAME>
<ITEMPATH>78245</ITEMPATH>
<QUANTITY>10</QUANTITY>
<SERVICELINE/>-- Need to remove all the Empty tags
<MINOR_MINOR_LINES>
<M_MINOR_LINE_TYPE> -- Need to remove these Objects types showing in the XML
<LINEID>143424798</LINEID>
<ITEMNAME>SF15-abc-xyz</ITEMNAME>
<ITEMPATH>78245</ITEMPATH>
<QUANTITY>10</QUANTITY>
</M_MINOR_LINE_TYPE>-- Need to remove these Objects types showing in the XML
</MINOR_MINOR_LINES>
</MINOR_LINE_OBJECT_TYPE>--Need to remove these Objects types showing in the XML
</MINORLINE>
</MAJOR_LINE_OBJECT_TYPE>-- Need to remove these Objects types showing in the XML
</MajorLine>
i tried one of the queries posted in this blog ,PFB to remove the empty tags , but it didnt work for me unfortunately. Please help.
PFB
WITH sample_data AS (
SELECT xmltype('<MajorLine>
<MAJOR_LINE_OBJECT_TYPE>
<LINEID>143424538</LINEID>
<ITEMNAME>hijk</ITEMNAME>
<ITEMPATH>78245</ITEMPATH>
<QUANTITY>10</QUANTITY>
<SERVICELINE/>
<MINORLINE>
<MINOR_LINE_OBJECT_TYPE>
<LINEID>143424799</LINEID>
<ITEMNAME>efg</ITEMNAME>
<ITEMPATH>78245</ITEMPATH>
<QUANTITY>10</QUANTITY>
<SERVICELINE/>
<MINOR_MINOR_LINES>
<M_MINOR_LINE_TYPE>
<LINEID>143424798</LINEID>
<ITEMNAME>abc</ITEMNAME>
<ITEMPATH>78245</ITEMPATH>
<QUANTITY>10</QUANTITY>
</M_MINOR_LINE_TYPE>
</MINOR_MINOR_LINES>
</MINOR_LINE_OBJECT_TYPE>
</MINORLINE>
</MAJOR_LINE_OBJECT_TYPE>
</MajorLine>') xmldoc
FROM dual
SELECT deleteXML( t.xmldoc
, '/MajorLine/*[.="" or contains(.,"?")]'
) as result
FROM sample_data t
My email ID is [email protected] -- You can reach me
thanks in advance ... Arun thomas THey Odie. Great to see you again, the query is
SELECT XMLELEMENT (
"MajorLine",
major_line_object_type (
oola_major.line_id,
oola_major.ordered_item,
oola_major.header_id,
oola_major.ordered_quantity,
CAST (
MULTISET (
SELECT oola_ser.line_id,
oola_ser.ordered_item,
--oola_ser.header_id,
oola_ser.ordered_quantity,
CAST (
MULTISET (
SELECT oola_ser2.service_start_date,
oola_ser2.service_end_date,
oola_ser2.service_duration
FROM oe_order_lines_all oola_ser2
WHERE oola_major.line_id =
oola_ser2.service_reference_line_id
AND oola_ser2.header_id =
oola_major.header_id) AS service_period_table_type)
FROM oe_order_lines_all oola_ser
WHERE oola_major.line_id =
oola_ser.service_reference_line_id
AND oola_ser.header_id = oola_major.header_id) --As of now excluding cross order service line
AS SERVICE_TABLE_TYPE),
CAST (
MULTISET (
SELECT oola_minor.line_id,
oola_minor.ordered_item,
oola_minor.header_id,
oola_minor.ordered_quantity,
CAST (
MULTISET (
SELECT oola_ser1.line_id,
oola_ser1.ordered_item,
-- oola_ser1.header_id,
oola_ser1.ordered_quantity,
CAST (
MULTISET (
SELECT oola_ser3.
service_start_date,
oola_ser3.
service_end_date,
oola_ser3.
service_duration
FROM oe_order_lines_all oola_ser3
WHERE oola_minor.line_id =
oola_ser3.
service_reference_line_id
AND oola_ser3.header_id =
oola_major.
header_id) AS service_period_table_type)
FROM oe_order_lines_all oola_ser1
WHERE oola_minor.line_id =
oola_ser1.service_reference_line_id
AND oola_ser1.header_id =
oola_major.header_id) --As of now excluding cross order service line
AS SERVICE_TABLE_TYPE),
CAST (
MULTISET (
SELECT oola_minor_m.line_id,
oola_minor_m.ordered_item,
oola_minor_m.header_id,
oola_minor_m.ordered_quantity
FROM oe_order_lines_all oola_minor_m
WHERE oola_minor.line_id =
oola_minor_m.link_to_line_id
AND oola_minor_m.header_id =
oola_major.header_id) --As of now excluding cross order service line
AS m_minor_line_table_type)
FROM oe_order_lines_all oola_minor
WHERE --oola_minor.top_model_line_id=oola_major.line_id
oola_minor.link_to_line_id = oola_major.line_id
AND oola_minor.header_id = oola_major.header_id
AND oola_minor.item_type_code != 'SERVICE') AS MINOR_LINE_TABLE_TYPE)))
AS "XMLOutput"
FROM oe_order_lines_all oola_major
WHERE oola_major.line_id = 143424538 AND oola_major.link_to_line_id IS NULL;
can we rewirte it to get the desired out put ..
Desired output is Just remove the Object_type tags and empty tags coming in the output xml.
The previous issues i mentioned are not solved yet . actually will update the challenges ..
Odie .. thanks.. again -
EDI flat file to X12 xml using XSLT mapping
Hi all,
I have a scenario EDI File -> XI -> file. Here on the source side, it is a txt IDOC document. I have created an XSLT mapping to convert txt document to X12 xml.
Can any body please suggest that what should be the message type that i need to choose at source inbound message?
Thanks
-KulwantHi
It is not very clear from what you have explained above..
1) whats the format when the msg enters XI?
2) which stage of the flow this XSLT mapping is located...??
3) when you say that your XSLT converts txt to xml, then whats the ROOT tag you use??
4) whats your incoming msg structure??
make the above clear for better answers
Regards
Vishnu -
Convert XML using XSLT mapping
Hi,
I have an XML in the following format and would want to cnvert it in the target format shown below. Kindly let me know the XSLT mapping to conert from hierarchy to flat structure.
<u><b>Source XML:</b></u>
<group Level1="Mac Tools Item Classifications">
<group Level2="6-Other Merchandise">
<group Level3="61-Racing">
<group Level4="011-Collectibles">
<group Level5="001-NASCAR"/>
<group Level5="002-NHRA"/>
<group Level5="003-Other"/>
</group>
<group Level4="012-Apparel">
<group Level5="001-Jackets"/>
<group Level5="002-Shirts"/>
<group Level5="003-Other">
<group PartNumber="SHOE823-060"/>
<group PartNumber="SHOE823-070"/>
<group PartNumber="SHOE823-080"/>
<group PartNumber="SHOE823-085"/>
<group PartNumber="SHOE823-090"/>
</group>
</group>
</group>
</group>
</group>
<u><b>Target XML:</b></u>
<Group>
<part>
<Level1/>
<Level2/>
<Level3/>
<Level4/>
<PartNumber/>
</part>
<part>
<Level1/>
<Level2/>
<Level3/>
<Level4/>
<PartNumber/>
</part>
</Group>
I am not clear how to capture level1, level 2, etc. till the end node.
Regards,
SwaroopaHI,
This is a sample
<b>
<xsl:variable name="var0_floatToString" select="user0:floatToString(/body/getQuote/inputGetQuote/@customerIDFloatAttr)"/>
<xsl:if test="@customerIDFloatAttr">
<xsl:attribute name="customerIDFloatAttr">
<xsl:value-of select="@customerIDFloatAttr"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="customerIDAttr">
<xsl:value-of select="$var0_floatToString"/>
</xsl:attribute></b>
using <xsl:attribute name here name ="leval1" like that u can use in XSLT Mapping .
Hope it helps
Regards.,
V.Rangrajan -
Multiple occurances of lin itm seg based on a field using graphical mapping
Hi
I have a scenario where in i have to populate the target segment multiple times based on quantity field LFIMG
Source structure in IDOC and target structure is XSD. In the following we need to have multiple occurances of S_LIN based on LFIMG. So if the value of LFIMG is 6 we need to have 6 occurances of S_LIN.
Source structure
E1EDL24 (segment)
LFIMG (field)
Target structure
ITEM (segment)
GSHL (segment)
S_LIN (segment)Hello Kalyan,
You need to write an udf like this.
LFIMG (change context Queue)---->UDF ---> S_LIN
Variable : source and separator(",")
String[] values = source.split(separator);
for(int i = 1 ; i < values.length ; i++){
result.addValue(values<i>);
result.addValue(ResultList.CC);
Regards
Pothana -
Tag casing in XML using XMLDOM
Hi,
Is there a way of disabling the Uppercasing function with XMLDOM, as I like to produce a tag which is of mix case, it always makes it uppercase as the tag....> But for reasons of volume I need to generate the XML without the explicit closing tag, such as:
>
> <TAG1 value = u201CXXXu201D/>
>
> Is there any possibility to achieve this with graphical mapping?
This is not posible. The graphical mapping always creates start and end tag, even for empty elements.
You need a seperate mapping step with XSLT or Java mapping.
Regards
Stefan -
Graphic Mapping:IDOC to File-Avoid Error in Adapter Engine
Hi all,
I'm using Graphic Mapping in my IDOC to File scenario in which each segment in source IDOC will generate a ROW in target File with the condition: DATBI >= currentdate (and some other conditions)
I have a UDF and use the mapping function CREATEIF for this purpose:
DATBI -> UDF -> CREATEIF -> ROW
Problem scenario: In the source IDOC if all the segments have DATBI < currentdate then there is no ROW created, and I get the error in Adapter Engine
Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'Conversion configuration error: Unknown structure ...
How can I avoid this?
I've tried to put this condition using XPATH in Interface Determination and got the error.
There is a way to use function current-date() in XPATH condition?
Thanks for your help,
ElaineHi all,
How can I "suppress the row node if condition fails"? I'm new in PI, so please give more details.
My FCC as follows:
Record Structure: Record, Row
Row.addHeaderLine 0
Row.fieldSeparator ,
Record.fieldSeparator 'nl'
Row.endSeparator ; 'nl'
It works fine if the condition satisfied.
In Message Mapping, I've use Test to double check my mapping, and in the scenario that conditions fails, there is no Row in the target message.
Please advise.
Thanks,
Elaine -
How to use Advance java function in graphical mapping in XI 2.0?
Hi,
currently I am using a simple java function to make an RFC call to R3 system.
I want to avoid making connection for each lookup. Instead I want to make a single connection for whole message queue and get the corresponding values in some array or container object.
please suggest a solution.
I think this is possible using Advance java function, but I am not able to find any example on using Advance java function at help.sap.com.
thaks in advance.Hi!!!
I'm not sure if I understood you well.
Do you want to preload some data into your structures in the memory and keep them there so you don't need to make a new connection during processing the whole message or every message?
In my opinion you can cache some data during processing a message, but it's impossible to cache some data between processing messages.
If you write your java mapping or you use graphical mapping (even with user-defined function), then you have a java class. The problem is that XI 2.0 reloads this class during processing every message, so even if you load some data from your data source into your structures in the memory, this data will be lost after reloading your mapping class.
Regards,
Andrzej Filusz -
Can we use XSLT mapping after graphical Mapping
Hi,
Can we use XSLT mapping after graphical mapping?
My requirement is to generate two namespace attributes in the target output.
So first I want to generate a structure using graphical mapping and then want to use XSLT mapping only to generate the second namespace XSI (leaving the rest of the structure as it is). Is it possible?
<ns1:Test xmlns:ns1="wmdata.dwbi.interface" xsi:schemaLocation="wmdata.dwbi.interface w_interface_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Please post some solution. (I will reward points)
Br,
Madan AgrawalHi Madan,
Can we use XSLT mapping after graphical mapping?
To me it seems feasible...
But to using the two mappings one after another you will have to use BPM .
Use transformation step for this to use the mapping and change in structure.
Regards,
Maybe you are looking for
-
Safari history is out of order in ios5
The most recent web page is not being loaded but the old page once the back arrow is clicked. It seems to appear in ios 5 only!
-
Log4j : How to avoid duplicate logmessages in a multithreaded application?
Hi, I m using log4j for my heavily multithreaded JAVA application. After my application comes up, a few minutes later , I find many duplicate logger messages on the console(only logger messages in threads are being displayed 8-9 times each). Is it th
-
Reversal of opening balance for RG23a
sirs, In the initial stages of go live, we have put an initial balance for RG23A. This has been updated with J1IH. But the entry was wrongly entered by the client. This has to be reversed. I need a guidance how to reverse this. regards, ebenezer
-
Firefox will not open or won't start (see /questions/964132 )
was Ok till recently
-
Acces rules not blocking entire site
Hello we are trying to block all url acces to rapidshare (and megaupload, gigasize , etc) we are using the syntax http://*rapidshare*/*.* and used also http://*rapidhsare* then when i type for example RapidShare: 1-Click Webhosting i am allowed to ge