Source structure of XML file as different from Message type?
Hi,
We are picking an xml file from the FTP server of the client.
We have source message type 'MT_Invoice' with data type as 'DT_Invoice'.
When we open the message mapping test tab, the source structure is as shown below.
<ns0:MT_Invoice xmlns:ns0="urn:maxxium:nordic:invoice:inbound">
<Invoices>
<Invoice>
</Invoice>
</Invoices>
</MT_Invoice>
My question is "What should be the structure of the XML file that the client is depositing on to the FTP server?".
Should it start with the tag 'MT_Invoice' with the namespace or should it simply start from <Invoices> tag.
I have tried various combinations for the source xml structure. But all are failing.
(This is evident from the fact that the mapping is failing. That's why I have given the structure from the source structure of the message mapping tab.)
Kindly help.
Thanks,
John
>
john j wrote:
> Hi,
>
> We are picking an xml file from the FTP server of the client.
>
> We have source message type 'MT_Invoice' with data type as 'DT_Invoice'.
>
> When we open the message mapping test tab, the source structure is as shown below.
>
> <ns0:MT_Invoice xmlns:ns0="urn:maxxium:nordic:invoice:inbound">
> <Invoices>
> <Invoice>
> .
> .
> .
> .
> </Invoice>
> </Invoices>
> </MT_Invoice>
>
> My question is "What should be the structure of the XML file that the client is depositing on to the FTP server?".
>
> Should it start with the tag 'MT_Invoice' with the namespace or should it simply start from <Invoices> tag.
>
> I have tried various combinations for the source xml structure. But all are failing.
>
> (This is evident from the fact that the mapping is failing. That's why I have given the structure from the source structure of the message mapping tab.)
>
> Kindly help.
>
> Thanks,
> John
you are picking an XML file. So you should create the MT which would represent exactly the XML format of the source file.
So ideally if your file starts with <invoice>, then name your MT as invoice
Similar Messages
-
The waveform of output from file is different from original one
I've a new question about displaying a waveform from a text file. The waveform which its data is from file is different from the original one.
I attached image files which included my two vi files and 3 waveform. In the compressed file, "ReadData_Waveform1.jpg" is a image of waveform from "ReadData.jpg" vi file with the configuration of "Transpose" is True,
"ReadData_Waveform2.jpg" is a image of waveform from "ReadData.jpg" vi file with the configuration of "Transpose" is False,
"WriteData_Waveform.jpg" is a image of waveform from "WriteData.jpg" vi file.
I attached the source file of waveform with text format as well.
Please help me to solve this question if there is anyone who can figure it out.
Thanks, Andy.
Attachments:
Question.zip 154 KB
data.txt 55 KBHi Andy
If you transpose the data when you write it, you also have to transpose it when you read it.
Just have a look at the simple example attached. I write data and read it again. Each file operation is called with the default-value for transpose (false). The data is read correctly.
Hope this helps.
Thomas
Using LV8.0
Don't be afraid to rate a good answer...
Attachments:
data.vi 35 KB -
Parsing XML file with different languages (Xerces)
How do we code or program to an XML file with different
languages , say english and spanish. WHen we parse such a document with the default locale , the presence of special characters throws errors .For eg when I use xerces and use
DOMParser parser = new DOMParser();
try
// Parse the XML Document
parser.parse(xmlFile);
catch (SAXException se)
se.printStackTrace();
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xfc) was found in the element content of the document.
System Error: void org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
So what locale do we set before we parse ?How to handle this problemYou need an encoding attribute in the xml declaration. If you don't, the parser assumes UTF-8, which are ASCII characters up to 127 - useful (only) for English.
So, something like this would allow you to use characters above 127, ISO-8859-1 is the encoding used by standard PCs.
<?xml version="1.0" encoding="ISO-8859-1"?>
You can find a (offical) list of encodings at:
http://www.iana.org/assignments/character-sets
I'm not sure about mixing various encodings. I think you have to resort external parsed entities, which can have their own encoding, but I think you cannot mix encodings in one XML file.
Good luck. -
XML file with different format
Hello
I have a requirement where the customer needs XML file with different format. How do I achieve the second format mentioned below instead of first format.
Normally we create the XML file in the following format:
- <Entries>
- <Organization>
<MemberName>0000000002</MemberName>
<FullName>BAY GYNECOLOGICAL ASSOCIATES</FullName>
<OrgId>0000000002</OrgId>
<OrgType>CUST</OrgType>
- <AssociatedToOrg>
<Name>0002</Name>
- </AssociatedToOrg>
</Organization>
Now the customer wants like the following format:
<Organization MemberName="522_Community_Customer" FullName="522 Community Customer" OrgId="DEA123456" OrgIdType="DEA" >
<AssociatedToOrg Name="MN"/>
</Organization>
Thanks
Nagayou can solve it with a XSL mapping. refer to the SDN to know how develop it
/people/aleksey.popov2/blog/2010/01/26/consuming-webservices-with-tag-in-wsdl-using-xslt
XSLT Editor for creating xlst mappings
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
http://wiki.sdn.sap.com/wiki/display/XI/XSLTMappingSteps
http://wiki.sdn.sap.com/wiki/display/XI/FileTOFile-UsingXSLTmapping%28forBeginners%29
http://wiki.sdn.sap.com/wiki/display/Snippets/ConvertflatXMLfiletonestedusing+XSLT
http://wiki.sdn.sap.com/wiki/display/Java/MultiMappingwithJavaandXSLTmappings
Edited by: Rodrigo Alejandro Pertierra on Oct 1, 2010 5:26 PM -
Splitting multiple IDoc XML files into single IDoc messages for R/3
Hi all. I have a problem splitting IDoc XML files coming in to XI. I currently have an interface that takes in single store sale IDoc transactions (type WPUBON01) in an IDoc XML file. I then have some complex graphical mapping on the IDoc before sending to R/3 via the IDoc adapter. This works fine. However, we now wish to include multiple sales in one file i.e. many WPUBON01 IDocs. I could use message splitting to do this BUT the mapping is so complex, I do not wish to have to change it to enable the processing of many IDocs in one file instead of just one.
What I want to do: have one mapping splitting a multiple IDoc XML file into single IDoc messages and then another taking these single messages as before and performing the mapping. I cannot find a way to do this in one interface; the main problem I'm having is getting XI to split the multiple IDocs into many single IDoc messages within XI itself. I'd be very grateful for any advice on the best way to do this.
Thankyou.
Stuart Richards (Halfords, UK)Bhavesh,
Thanks again for a clear explanation... I'm moving forwards but still struggling. I've been on this all afternoon today (after a break on other things) and just cannot get my message to split properly (though the SOAP adapter problem I had earlier is now fixed!). If my initial IDoc XML file contains this format:
<WPUBON01><IDOC>....</IDOC>
<IDOC>....</IDOC>
<IDOC>....</IDOC></WPUBON01>
.. I'm not sure what the cardinaility on the first message mapping and interface mapping should be. I'd have thought the source interface would be 1 and the target would be 0..unbounded but this isn't working. I'm trying different things but I get different errors each time. Currently, I have the above cardinality in my first interface and I'm passing in the following data:
<WPUBON01><IDOC><EDI_DC40><TABNAM>EDI_DC40</TABNAM><MANDT /><DOCNUM /><DOCREL>620</DOCREL><DIRECT>2</DIRECT><IDOCTYP>WPUBON01</IDOCTYP><MESTYP>WPUBON</MESTYP><MESCOD>ST6</MESCOD><SNDPOR>WPUX</SNDPOR><SNDPRT>KU</SNDPRT><SNDPRN>0518</SNDPRN><RCVPOR /><RCVPRT>KU</RCVPRT><RCVPRN>0518</RCVPRN><REFINT>00000003832292</REFINT></EDI_DC40><E1WPB01 SEGMENT="1"><POSKREIS>0518</POSKREIS><KASSID>29</KASSID><VORGDATUM>20071029</VORGDATUM><VORGZEIT>160633</VORGZEIT><BONNUMMER>1001</BONNUMMER><KASSIERER>100</KASSIERER><CSHNAME> </CSHNAME><BELEGWAERS>GBP</BELEGWAERS><E1WPB02 SEGMENT="2"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="3"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="4"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="5"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="6"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="7"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="8"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="9"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="10"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="11"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="12"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="13"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="14"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="15"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="16"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB06 SEGMENT="17"><VORZEICHEN></VORZEICHEN><ZAHLART>PTCS</ZAHLART><SUMME> </SUMME><KARTENNR /><ZUONR>1001</ZUONR></E1WPB06></E1WPB01></IDOC><IDOC><EDI_DC40><TABNAM>EDI_DC40</TABNAM><MANDT /><DOCNUM /><DOCREL>620</DOCREL><DIRECT>2</DIRECT><IDOCTYP>WPUBON01</IDOCTYP><MESTYP>WPUBON</MESTYP><MESCOD>ST6</MESCOD><SNDPOR>WPUX</SNDPOR><SNDPRT>KU</SNDPRT><SNDPRN>0518</SNDPRN><RCVPOR /><RCVPRT>KU</RCVPRT><RCVPRN>0518</RCVPRN><REFINT>00000003832293</REFINT></EDI_DC40><E1WPB01 SEGMENT="1"><POSKREIS>0518</POSKREIS><KASSID>29</KASSID><VORGDATUM>20071029</VORGDATUM><VORGZEIT>160634</VORGZEIT><BONNUMMER>1002</BONNUMMER><KASSIERER>100</KASSIERER><CSHNAME> </CSHNAME><BELEGWAERS>GBP</BELEGWAERS><E1WPB02 SEGMENT="2"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="3"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="4"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="5"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="6"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="7"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="8"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="9"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="10"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="11"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="12"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="13"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="14"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="15"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="16"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB06 SEGMENT="17"><VORZEICHEN></VORZEICHEN><ZAHLART>PTCS</ZAHLART><SUMME> </SUMME><KARTENNR /><ZUONR>1002</ZUONR></E1WPB06></E1WPB01></IDOC><IDOC><EDI_DC40><TABNAM>EDI_DC40</TABNAM><MANDT /><DOCNUM /><DOCREL>620</DOCREL><DIRECT>2</DIRECT><IDOCTYP>WPUBON01</IDOCTYP><MESTYP>WPUBON</MESTYP><MESCOD>ST6</MESCOD><SNDPOR>WPUX</SNDPOR><SNDPRT>KU</SNDPRT><SNDPRN>0518</SNDPRN><RCVPOR /><RCVPRT>KU</RCVPRT><RCVPRN>0518</RCVPRN><REFINT>00000003832294</REFINT></EDI_DC40><E1WPB01 SEGMENT="1"><POSKREIS>0518</POSKREIS><KASSID>29</KASSID><VORGDATUM>20071029</VORGDATUM><VORGZEIT>160634</VORGZEIT><BONNUMMER>1003</BONNUMMER><KASSIERER>100</KASSIERER><CSHNAME> </CSHNAME><BELEGWAERS>GBP</BELEGWAERS><E1WPB02 SEGMENT="2"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="3"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="4"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="5"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="6"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="7"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="8"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="9"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="10"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="11"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="12"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="13"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB02 SEGMENT="14"><VORGANGART /><QUALARTNR>ARTN</QUALARTNR><ARTNR>000000065601301390</ARTNR><VORZEICHEN>-</VORZEICHEN><MENGE>1</MENGE><AKTIONSNR>0000000000</AKTIONSNR><REFBONNR> </REFBONNR><E1WPB03 SEGMENT="15"><VORZEICHEN /><KONDITION>PN10</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03><E1WPB03 SEGMENT="16"><VORZEICHEN></VORZEICHEN><KONDITION>ZPN1</KONDITION><KONDVALUE>1.00</KONDVALUE><CONDID /><QUALCONDID /></E1WPB03></E1WPB02><E1WPB06 SEGMENT="17"><VORZEICHEN></VORZEICHEN><ZAHLART>PTCS</ZAHLART><SUMME> </SUMME><KARTENNR /><ZUONR>1003</ZUONR></E1WPB06></E1WPB01></IDOC></WPUBON01>
In the message monitor, I get a chequered flag. Great. However, I get the dreaded error 500 in the SOAP receiver comm channel:
SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error
Exception caught by adapter framework: SOAP Error
Delivery of the message to the application using connection AFW failed, due to: SOAP Error.
Any ideas as to what this might be?! I'm getting there.... if I get a solution out of this, I promise to write the blog myself!
Cheers
Stuart -
Is it possible to do message mapping using different namespace message type
Hi all,
Is it possible to do message mapping using different namespaces message types
Example :
i am having message type MT_1 in namespace http://sap.com/abc
and second message type MT_2 in namespace http://partner.com/xyz
so MT_1 can be mapped with MT_2 or not having different namespace.
ThanksRead through my reply in this thread for Defining Software component dependencies.
Though it explains this for Improted Archives, it also holds true for Message Types to be used in message mappings.
Re: Payload Extraction
Regards
Bhavesh -
Xml file not loading from different server
Hi,
I have a simple flash banner that is pulling a number from an xml file on a different server. When it gets to the frame where the number should be it just says "transferring data from eckul.com" and will not actually pull in the number. Unfortunately I can't put the files on the same servers. Any help would be much appreciated, below are the links and the xml code I'm using followed by the action script. Cheers
http://www.sainters.net/newsletters/2010/flash_test_membership2.html
http://www.eckul.com/number.xml
<?xml version="1.0"?>
<inventors>
<person>
<name>892</name>
</inventors>
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
trace("file not loaded!");
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.eckul.com/number.xml");so, in frame 1 of your fla before you execute that cross-domain load method, use:
System.security.loadPolicyFile("http:www.yourcrossdomain.com/subdirectoriesIfNeeded/crossd omain2.xml");
where the following (crossdomain.xml) is in www.yourcrossdomain.com's root (IF you want to allow allow subdirectory policy files):
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>
and in the subdirectory (and its descendents) that you want to allow access put crossdomain2.xml:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.thedomainthatstryingtoloadcrossdomaindata.com" />
</cross-domain-policy> -
Create file object from xml file in different package
I have my java class which is in a package...edu.xx.proj
It contains the following
File f = new File("formats.xml");
My xml file is in the package edu.xx.proj.xml
How do I get the file object for my xml file?
Ultimately I want that once the jar is shipped .. The path of xml file shld be independent of my OS path... it can only lookup the package path..
I will really appreciate it if someone can throw some input as to how to resolve this issue..
Thank youI have my java class which is in a
package...edu.xx.proj
It contains the following
File f = new File("formats.xml");
My xml file is in the package edu.xx.proj.xml
How do I get the file object for my xml file?
Ultimately I want that once the jar is shipped .. The
path of xml file shld be independent of my OS path...
it can only lookup the package path..
I will really appreciate it if someone can throw some
input as to how to resolve this issue..
Thank you
InputStream inputStream = getClass().getResourceAsStream("xml/formats.xml");
/* OR */
URL url = getClass().getResource("xml/formats.xml");hth -
Create xml file with values from context
Hi experts!
I am trying to implement a WD application that will have some input fields, the value of those input fields will be used to create an xml file with a certain format and then sent to a certain application.
Apart from this i want to read an xml file back from the application and then fill some other context nodes with values from the xml file.
Is there any standard used code to do this??
If not how can i do this???
Thanx in advance!!!
P.S. Points will be rewarded to all usefull answers.
Edited by: Armin Reichert on Jun 30, 2008 6:12 PM
Please stop this P.S. nonsense!Hi,
you need to create three util class for that:-
XMLHandler
XMLParser
XMLBuilder
for example in my XML two tag item will be there e.g. Title and Organizer,and from ur WebDynpro view you need to pass value for the XML tag.
And u need to call buildXML()function of builder class to generate XML, in that i have passed bean object to get the values of tags. you need to set the value in bean from the view ui context.
Code for XMLBuilder:-
Created on Apr 4, 2006
Author-Anish
This class is to created for having function for to build XML
and to get EncodedXML
and to get formated date
package com.idb.events.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.idb.events.Event;
public class XMLBuilder {
This attribute represents the XML version
private static final double VERSION_NUMBER = 1.0;
This attribute represents the encoding
private static final String ENCODING_TYPE = "UTF-16";
/*Begin of Function to buildXML
return: String
input: Event
public String buildXML(Event event) {
StringBuffer xmlBuilder = new StringBuffer("<?xml version=\"");
xmlBuilder.append(VERSION_NUMBER);
xmlBuilder.append("\" encoding=\"");
xmlBuilder.append(ENCODING_TYPE);
xmlBuilder.append("\" ?>");
xmlBuilder.append("<event>");
xmlBuilder.append(getEncodedXML(event.getTitle(), "title"));
xmlBuilder.append(getEncodedXML(event.getOrganizer(), "organizer"));
xmlBuilder.append("</event>");
return xmlBuilder.toString();
/End of Function to buildXML/
/*Begin of Function to get EncodedXML
return: String
input: String,String
public String getEncodedXML(String xmlString, String tag) {
StringBuffer begin = new StringBuffer("");
if ((tag != null) || (!tag.equalsIgnoreCase("null"))) {
begin.append("<").append(tag).append(">");
begin.append("<![CDATA[");
begin.append(xmlString).append("]]>").append("</").append(
tag).append(
">");
return begin.toString();
/End of Function to get EncodedXML/
/*Begin of Function to get formated date
return: String
input: Date
private final String formatDate(Date inputDateStr) {
String date;
try {
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("yyyy-MM-dd");
date = simpleDateFormat.format(inputDateStr);
} catch (Exception e) {
return "";
return date;
/End of Function to get formated date/
Code for XMLParser:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLParser {
Enables namespace functionality in parser
private final boolean isNameSpaceAware = true;
Enables validation in parser
private final boolean isValidating = true;
The SAX parser used to parse the xml
private SAXParser parser;
The XML reader used by the SAX parser
private XMLReader reader;
This method creates the parser to parse the user details xml.
private void createParser()
throws SAXException, ParserConfigurationException {
// Create a JAXP SAXParserFactory and configure it
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware(isNameSpaceAware);
saxFactory.setValidating(isValidating);
// Create a JAXP SAXParser
parser = saxFactory.newSAXParser();
// Get the encapsulated SAX XMLReader
reader = parser.getXMLReader();
// Set the ErrorHandler
This method is used to collect the user details.
public Event getEvent(
String newsXML,
XMLHandler xmlHandler,
IWDMessageManager mgr)
throws SAXException, ParserConfigurationException, IOException {
//create the parser, if not already done
if (parser == null) {
this.createParser();
//set the parser handler to extract the
reader.setErrorHandler(xmlHandler);
reader.setContentHandler(xmlHandler);
InputSource source =
new InputSource(new ByteArrayInputStream(newsXML.getBytes()));
reader.parse(source);
//return the results of the parse
return xmlHandler.getEvent(mgr);
Code for XMLHandler:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
Created on Apr 12, 2006
Author-Anish
*This handler class is created to have constant value for variables and function for get events,
character values for bean variable,
parsing thr date ......etc
package com.idb.events.util;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import java.util.*;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLHandler extends DefaultHandler {
private static final String TITLE = "title";
private static final String ORGANIZER = "organizer";
IWDMessageManager manager;
private Event events;
private String tagName;
public void setManager(IWDMessageManager mgr) {
manager = mgr;
This function is created to get events
public Event getEvent(IWDMessageManager mgr) {
manager = mgr;
return this.events;
This function is created to get character for setting values through event's bean setter method
public void characters(char[] charArray, int startVal, int length)
throws SAXException {
String tagValue = new String(charArray, startVal, length);
if (TITLE.equals(this.tagName)) {
this.events.setTitle(tagValue);
if (ORGANIZER.equals(this.tagName)) {
String orgName = tagValue;
try {
orgName = getOrgName(orgName);
} catch (Exception ex) {
this.events.setOrganizer(orgName);
This function is created to parse boolean.
private final boolean parseBoolean(String inputBooleanStr) {
boolean b;
if (inputBooleanStr.equals("true")) {
b = true;
} else {
b = false;
return b;
This function is used to call the super constructor.
public void endElement(String uri, String localName, String qName)
throws SAXException {
super.endElement(uri, localName, qName);
/* (non-Javadoc)
@see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
This function is used to call the super constructor.
public void fatalError(SAXParseException e) throws SAXException {
super.fatalError(e);
This function is created to set the elements base on the tag name.
public void startElement(
String uri,
String localName,
String qName,
Attributes attributes)
throws SAXException {
this.tagName = localName;
if (ROOT.equals(tagName)) {
this.events = new Event();
public static void main(String a[]) {
String cntry = "Nigeria";
XMLHandler xml = new XMLHandler();
ArrayList engList = new ArrayList();
engList = xml.getCountries();
ArrayList arList = xml.getArabicCountries();
int engIndex = engList.indexOf(cntry);
System.out.println("engIndex :: " + engIndex);
String arCntryName = (String) arList.get(engIndex);
System.out.println(
">>>>>>>>>>>>>>>>>>>>" + xml.getArabicCountryName(cntry));
Hope that may help you.
If need any help , you are most welcome.
Regards,
Deepak -
Transforming xml file with different elements into HTML
hi all !
i have an xml object that has been generated from database using java. the xml file has numerous elements that have been merged into single file. all elements have been got from different table :-
<?xml version = '1.0' ?>
<ROWSET>
<ROW id= "1">
<EMPID>1</EMPID>
<EMPADDRESS>H 3 STREET 4</EMPADDRESS>
<EMPPHONE>98764653</EMPPHONE>
</ROW>
<ROW id="2">
<EMPID>5</EMPID>
<EMPQUAL>GRADE 12</EMPQUAL>
<EMPGRADE>A</EMPGRADE>
</ROW>
</ROWSET>
(its just a sample data, might not be wel formed)
as it shows that each element "ROW" has data corresponding to different employee and with different details. actually these elemnt are the updates in an employee profile that have to be communicated to a distant located database. what i need is a tranformation into HTML so that the recieving user can view this file as html with relative headings of corresponding tables.
(the schema at both ends is exact replica)
any help in this regards would be obliging.thank you bro!
the xml file has been created by importing multiple files resulted from XSU into a master file in java. we are running a web based project in a distributed environment. so i would need to make this page appear in a web browser with ACCEPT and REJECT command buttons as the receiver is the approving agent. what all i have thought of so far is to create a style sheet with templates of all heading of each table from where the data is coming from and then run a check on what table the data is from and place that specific heading on the entry. the style sheet would be placed at both ends so only the xml file will be transported and transformation would be done auto.
i hope it works. but am not sure wether its the right approach or not. -
Unmarshaling XML file with JAXB from JAR doesn't work?
Hi
I'm pretty new to JAXB... I'm unmarshaling an XML file, and everything works fine in my JUnit test, using XML files. However, the caller of my unmarshalling is a Web Start application using signed JARs.
When I try to access the XML file, I log the URL and get an exception:
INFO[slf5s.PRIORITY] javawsApplicationMain[slf5s.THREAD] ch.ige.main.client.menu.MenuBuilder[slf5s.CATEGORY] Creating menu from URL jar:file:C:/Program%20Files/JRE/1.4.2/cache/http/...Main.jar!/res/JippsAdminMenuBaum.xml[slf5s.MESSAGE]
ERROR[slf5s.PRIORITY] javawsApplicationMain[slf5s.THREAD] ch.ige.main.client.MenuPane[slf5s.CATEGORY] exception caught[slf5s.MESSAGE]
java.io.IOException: Couldn't unmarshal configuration from java.util.jar.JarVerifier$VerifierStream@15f1f9c: null
at ch.ige.main.client.menu.MenuBuilder.unmarshalConfiguration(MenuBuilder.java:110)
at ch.ige.main.client.menu.MenuBuilder.<init>(MenuBuilder.java:86)
at ch.ige.main.client.MenuPane.createMenuBuilder(MenuPane.java:485)
at ch.ige.main.client.MenuPane.createTreeLevel(MenuPane.java:460)
at ch.ige.main.client.MenuPane.jbInit(MenuPane.java:316)
at ch.ige.main.client.MenuPane.<init>(MenuPane.java:122)
at ch.ige.jippsadmin.MepJipps.<init>(MepJipps.java:32)
at ch.ige.jippsadmin.JippsMain.run(JippsMain.java:64)
at ch.ige.auth.ClientAuthenticator.executePrivilegedCode(ClientAuthenticator.java:166)
at ch.ige.authz.client.AuthMain.executePrivilegedCode(AuthMain.java:128)
at ch.ige.authz.client.AuthMain.run(AuthMain.java:213)
at ch.ige.jippsadmin.JippsMain.main(JippsMain.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)Btw, does anyone know where to find the runtime JARs that are required for JAXB (from JWSDP 1.5)?
Thanks & best regards,
EricWell... once again this was a ClassLoader problem... solved!
-
Creating XML file using data from database table
I have to create an xml file using the data from multiple table. The problem That i am facing is the data is huge it is in millions so I was wondering that is there any efective way of creating such an xml file.
It would be great if you can suggest some approach to achieve my requirement.
Thanks,
-VinodAn example from the forum: Re: How to generate xml file from database table
Edited by: Marco Gralike on Oct 18, 2012 9:41 PM -
Parse exisitng xml file and recreate another xml file with different struct
Is it possible in java using dom parser to parse an exisiting xml file and recreate a new xml file from data obtained by parsing old xml file.
I checked on old forum threads and everywhere either parsing xml file has been explained or creating new xml file from scratch has been shown.
Any examples/guidance will be appreciated....The general process is:
Document dom1 = ... // the parsed document
Document dom2 = ... // new document constructed on the fly
Node nD1 = ... // some random node found in dom1
// copy the node from dom1 and associate with dom2
Node nD2 = dom2.importNode(nD1, true);
// ... treat nD2 as a node which can now be inserted into dom2 ...
Node otherD2 = ... // some other node already in dom2
otherD2.appendChild(nD2);Note, in this example the nD1 node is copied (including any sub-nodes) into a new node, nD2. You can alternately move the node from one Document to another using Document.adoptNode(), however this may fail (see the javadoc). -
File displaying different from Photoshop to Illustrator
I have a simple chalkboard background I made in Photoshop and I'm importing into Illustrator. My issue is the file displays completely different from Photoshop to Illustrator. See image below.
I've had this happen to other files but this one is so incredibly different, I can't understand what's happening and I can't manage the design with it being this different. Any ideas?
Thanks in advance for your help!
RachelThanks again Monika. I can't figure this out. The color management is all synchronized among all my Adobe applications. Yes the file is in layers and when I view the JPG in Photoshop, it looks as it should. It's only when I bring it into Illustrator does it look like that. I opened up a new Illustrator doc and placed the same JPG (as well as dragged the PSD file directly from the Photoshop window into Illustrator) and it looks better and more like it should. My other doc was a new doc too so I'm not sure what happened. At any rate, I can't explain what happened and I'm just hoping it doesn't happen again.
Thanks for your help! -
hi all
When I execute build.xml file of simple BPEL project from JDev it runs properly. But when I try to execute it from normal command window It gives me an following error.
...........droping jar file xyz.jar from path as i doesn't exists.
While all jar files are exist there.But Ant drops it from Classpath variable.
So JDev sets some environment before executing such build.xml file.Like {oracle.home} variable u need to set while runnig build.xml from command window.
Any suggestions...???
/mishityou cant run a .war file from command prompt
.war files should be executed in a server
how to execute a single servlet class
do you mean to run the servlet or compile the servlet?
any way you need a server and if you are a beginner Apache tocat will be the best server to start with you can down load it from
http://tomcat.apache.org/
Maybe you are looking for
-
Iasdeploy not working in ias6.5
I Just installed ias6.5 on Windows NT with Sp6. Installation went on fine, but i could not run sample fortune application. Fortune application itself is not registered in the server and if i try to manually register the application by iasdeploy deplo
-
Adobe Premiere Elements 12 will launch and then vanish
Okay so just bought Adobe Premiere Elements 12. Loaded it up and went to run it. First time I ran it I get the Adobe Premiere Elements 12 Launch pad, you know where you select the Organizer or the video editor. I select video editor, it gives me a su
-
IDVD Randomly Quitting during burn?
Hullo! Posting here cause I've been quite unsuccessful in burning two dvds of mine. I have about 25 episodes in .avi format that seem to work in preview, work in quicktime/VLC ect. But halfway through the burn process iDVD just randomly quits on me,
-
Can the itunes gift card work on the app store?
Hi. I have an iPad and I want to download this and I want to know if you can use the iTunes gift card for the App Store. Leave any messages below. Thanks!
-
http://i1133.photobucket.com/albums/m586/illinois429/1251.jpg Excuse the poor image quality. There is a green icon on the top right hand side of the document. When it's alone on the page the icon appears as it is meant to appear: R 69 G 255 B 0.