on 09-01-2009 7:54 AM
Dear experts,
I have XML messages that I have to convert but before converting I want to delete the Doctype with an XSLT mapping.
My XML message starts like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="cbl_po.xsl"?>
<?soxtype PurchaseOrder urn:x-commerceone:document:com:commerceone:CBL:CBL.sox$1.0?>
<!DOCTYPE PurchaseOrder SYSTEM "po_ecos203.dtd">
<PurchaseOrder>
....
The "<!DOCTYPE PurchaseOrder SYSTEM "po_ecos203.dtd">" I want to get rid of.
So my XSL file looks like this. I read when using "copy-of" the doctype gets dropped:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
But somehow the mapping does not get rid of the Doctype because in Monitoring it says:
The XML page cannot be displayed
Cannot view XML input using XSL style
sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
The system cannot locate the resource specified. Error processing resource
'po_ecos203.dtd'. Error processing resource 'fi...
<!DOCTYPE PurchaseOrder SYSTEM "po_ecos203.dtd">
Does anyone know how to get rid of the Doctype?
Thank you very much for your help!
Best regards,
Peter
Hi!
Depending on the Sender Adapter Type you are using you may make use of an Adapter Module. This is possible e.g. for RFC and SOAP Adapter with Axis Framework.
In your Adapter Module you can read and manipulate the message.
By the way: Why do you want to get rid of <!DOCTPYE ...? It is not part of the payload, thus it should not make any problems.
Regards,
Volker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Volker,
- I thought so too that the Doctype should not maky any problems. But in Monitoring I keep getting the message
The system cannot locate the resource specified. Error processing resource 'po_ecos203.dtd'. Error processing resource 'fi...
<!DOCTYPE PurchaseOrder SYSTEM "po_ecos203.dtd">
Then I manually deleted the Doctype from one of my test messages and the message was processed without any problems! That is the reason why I want to get rid of it now.
- I am using a FTP adapter. Is there an Adapter Module to delete the Doctype - do you know?
Thank you again for any ideas!
Best regards,
Peter
Hello Swarup,
Thank you for this hint.
I have never worked with Java Mappings. I downloaded the ZIP file from the SAP 812966-page and imported it into "Imported Archives". It shows up in there as a java file named "DeleteDTDDeclarationWithDOM.java"
But when I go into "Interface Mappings" and try to define the type "Java class" my Mapping is not found!
Are there more steps I have to do with my Java-file to make it work?
Thank you again for your help!
Best regards,
Peter
Hello Swarup, Dear experts,
I used Eclipse, created a package, created the class "DeleteDTDDeclarationWithDOM" which implements "StreamTransformation" and copied the java file from SAP Note 812966 into it.
Via "Java Build Path" for my package I went to "Add External JARs" to add "aii_map_api.jar"
Then I ran the application but then Eclipse gave me the following error:
"Multiple markers at this line
- Occurrence of 'Map'
- Map is a raw type. References to generic type Map<K,V> should be
parameterized"
How to I parameterize this type Map?
Does anyone have expierience on that?
Thank you again for your help,
Peter
Hello Volker,
Thanks for the quick answer. Actually it is only a warning. And Eclipse suggested to suppress the warning.
I was able to still run it as a Java application by entering
@SuppressWarnings("unchecked")
right before where I got that error:
public void setParameter(Map param) {
trace = (MappingTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);
}
The class file was still created by Eclipse now.
I will proceed to take the java and class file, zip them and import them. That should be it then - hopefully!
Thank you,
Peter
Hello Swarup, Dear experts,
I managed to generate the .jar-file now and imported it, I was able to choose it in the interface mapping but when I test the mapping with a test message I get the following error in the monitoring (SXMB_MONI).
I looked at the trace:
<Trace level="1" type="T">LinkageError at JavaMapping.load(): Could not load <b>class</b>: mypackage/DeleteDTDDeclarationWithDOM</Trace>
<Trace level="1" type="T">java.lang.UnsupportedClassVersionError: mypackage/DeleteDTDDeclarationWithDOM (Unsupported major.minor version 50.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest
u2026
I am using XI 3. Is there a problem with the Java-version I created the .jar-file with?
I am using JRE 1.6.0_07 with Eclipse.
Thank you again for any ideas or hints!
Best regards,
Peter
Hi Peter,
Solution 1
If you have XI 3.0 and SP 9 use jre between 1.4.2_06 to 1.4.2_09
If you have SP greater than 11 then you can use jre 1.5.0 or greater.
Try to compile with a lower jre.
*Solution 2 (I guess you tried using htis I will give a try myself) *
Alternatively try using this XSLT mapping to remove the Doctype
<xsl:template match="/">
<xsl:copy-of select="." />
</xsl:template>
Regards
Suraj
Edited by: S.R.Suraj on Sep 8, 2009 1:46 AM
Hello Swarup, Dear experts,
Thank you for your help again, I managed to create the correct JAR-file now.
But now I have another problem. In SXMB_MONI it tells me that
"Application Java mapping threw an exception"
In the trace it says:
<Trace level="1" type="T">Resource not found: po_ecos203.dtd</Trace>
<Trace level="1" type="T">com.sap.aii.ibrun.server.mapping.persist.ResourceNotFoundException:
Unable to find resource po_ecos203.dtd (urn:tyrolit.com:edi:skf_pl, ffcbcc20-a5da-11d9-cd8e-da800a180a91, -1) at...
In my source XML there is the line
<!DOCTYPE PurchaseOrder SYSTEM "po_ecos203.dtd">
which I want to get rid of with that Java-mapping.
Why does it say now that the "Resource was not found: po_ecos203.dtd" --> that is what I want to get rid of, the Java-Mapping should delete that. It should not ask for it!
Thank you again for any ideas!
Best regards,
Peter
Hi Peter!
Strange! Of course! Like already mentioned it may have been a better idea to use an adapter module ...
But there is another idea: did you activate XML validation in your scenario?
If yes try to deactivate it and re-try to process the message without any speical handling.
Regards,
Volker
Hi Peter!
First of all: sorry for late feedback. However here you can find a How to Guide for XI 3.0 Adapter Module Development:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
Regards,
Volker
Problem solved with the following XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<xsl:copy-of select="PurchaseOrder" />
</xsl:template>
</xsl:stylesheet>
Edited by: Peter Wallner on May 4, 2010 4:42 PM
Hello Narayan,
I solved it with the following XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/">
<xsl:copy-of select="PurchaseOrder" />
</xsl:template>
</xsl:stylesheet>
I would think that you could also solve it with a java mapping like in this thread:
Best regards,
Peter
Hello Peter,
I'm having this similar issue of removin DOCTYPE from the xml file and have tried with your solution and did not work for me. Can you pls help me fix this. Thanks in advance!
The file which I've been testing with :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE StatusTransaction PUBLIC "Status" "Status.dtd">
<StatusTransaction>
<TransactionInformation Version="2.0.0">
<DocId>45678</DocId> .....
The xslt I'm using for removing <!DOCTYPE is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy-of select="StatusTransaction" />
</xsl:template>
</xsl:stylesheet>
I also tried with <xsl:copy-of select="." />
When I'm using the above xslt, still I'm getting the error : Unable to load external DTD subset via 'StatusTransaction' local file '.dtd. not found
Can you pls let me know for changes if needed. Pls advise.
Regards,
Pat
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.