Xml file problems to update
hello experts i have a problem to update my xml file in mime folder im using resourcepath to generate the url then write it in.
so i have an iframe that load an html file in mime folder too. but this html show the xml file content but not show the last changed
can you help me pls !
i make the changes in the xml file using webdynpro:
xmlUrl = WDURLGenerator.getResourcePath
(wdComponentAPI.getComponent().getDeployableObjectPart(), "NOTICIAS/xml/eboseNews.xml");
DocumentBuilderFactory factory;
factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document xmldoc = builder.parse(xmlUrl);
xmldoc.getDocumentElement().normalize();
//NUEVO NODO HIJO DE CHANEL
Element itemElement = xmldoc.createElement("item");
IPublicFormularioCust.ICabNoticiaElement elemCab = wdContext.currentCabNoticiaElement();
//NODOSS HIJOS DE ITEM
Element titleElement = xmldoc.createElement("title");
titleElement.appendChild(xmldoc.createCDATASection(elemCab.getTitulo().trim()));
Element linkElement = xmldoc.createElement("link");
linkElement.appendChild(xmldoc.createCDATASection("docs/" + elemCab.getLink().getResourceName().trim()));
Element descripElement = xmldoc.createElement("description");
descripElement.appendChild(xmldoc.createCDATASection(elemCab.getDescripcion().trim()));
Element categoryElement = xmldoc.createElement("category");
categoryElement.appendChild(xmldoc.createCDATASection(elemCab.getCategoria().trim()));
Element pubdateElement = xmldoc.createElement("pubDate");
pubdateElement.appendChild(xmldoc.createCDATASection(new SimpleDateFormat("dd/MM/yyyy").format(Constantes.FECHACTUAL)));
//AGREGANDO NODOS HIJOS A ELEMENTO ITEM
itemElement.appendChild(titleElement);
itemElement.appendChild(linkElement);
itemElement.appendChild(descripElement);
itemElement.appendChild(categoryElement);
itemElement.appendChild(pubdateElement);
//AGREGANDO ELEMENTO ITEM
Node channelNode = xmldoc.getDocumentElement().getElementsByTagName("channel").item(0);
channelNode.insertBefore(itemElement, xmldoc.getElementsByTagName("item").item(0));
//Serializando el XMLDOC en un StringWriter
xmlSerializer.serialize(xmldoc);
FileWriter fw = new FileWriter(new File(xmlUrl));
fw.write(sw.toString());
so later i can see the changes but when i reloaded the page dont appear the changes only have the information when i deployed the project. This xml is show in with javascript. This javascript belongs to html file that is loaded into a iframe.
Similar Messages
-
Output XML file problem (in FILE to RFC scenario)
hi,
my problem is that in the export parameter i have 3 variables but my output xml file shows only 2 parameters . I have checked my mapping all 3 parameters are mapped properly in output mapping .
Initially when i started the scenario there were only 2 parameters in my export list .
i completed this suuccesfully and then as per new requirement one more parameter was needed to be added i added a new parameter and reimported my rfc .
the response tab of the reimported RFC shows me the newly added parameter but my final xml file only shows me the previous 2 it doesnt show me the newly added one is there any seeting which i need to change like in idoc where we have to readd the idoc in IDX2
With regards
Bhawarlal ChoudharyHi,
2 Introduction
Configuring IDoc adapter in Exchange Infrastructure 3.0 requires some configuration on the SAP
systems, for both XI and the backend system where the IDoc message is to be sent. These steps, although
simple, are many times missed or mis-configured, causing the delivery of messages to fail.
Since IDoc adapter uses the ABAP stack, instead of J2EE, the configuration requirements are mainly in
ABAP.
Setting up IDoc adapters requires the XI integration server to be able to communicate with the backend
SAP system, and also to make sure that the Logical System Name used when posting IDoc exists on the
backend SAP system.
3 The Step By Step Solution
The basic steps for the IDoc configuration are outline below:
1. Configure SM59 on XI to communicate to SAP backend system.
2. Configure port on XI for IDoc communication.
3. Create or verify the Logical System Name on the SAP backend system.
4. Create or verify business system in XIs System Landscape Directory.
5. Verify the Logical System Name of the business system.
6. Verify or add the Logical System Name for the sender business system.
7. Create/configure the Communication Channel for the IDoc receiver adapter
3.1 Configure SM59 on XI to communicate to SAP backend system.
1. Using transaction SM59, create an RFC destination with Connection Type = 3.
In this example, the RFC destination name is NDVCLNT510.
2. Enter the logon information:
3. Test the connection by clicking on Testing connection and Remote logon.
Both must be successful.
3.2 Configure port on XI for IDoc communication.
4. Go to transaction IDX1 on XI, and create a port. In this example, the Port name is SAPNDV.
The Port name must be in the form of SAPxxx, where xxx is the system ID of the backend SAP
system.
The Client must be the client number of the backend SAP system.
Select the RFC Destination which was created in the previous step.
3.3 Create or verify the Logical System Name on the SAP backend system.
5. Enter transaction SALE on the SAP backend system.
6. Create or verify the Logical System Name. In our example, NDVCLNT510 is verified.
3.4 Create or verify business system in XIs System Landscape Directory.
The business system name for the SAP backend system must contain a valid Logical System Name. This Logical System Name is the one verified or created in the previous step.
7. In the System Landscape Directory, select the SAP backend business system. If one does not exist, then create the business system. Verify the Logical System Name.
3.5 Verify the Logical System Name of the business system.
8. In the Integration Directory, doubleclick on the business system (in our example, it is NDVCLNT510).
Navigate the menu:
Service Adapter Specific Identifiers.
If information is empty or incorrect, then it will have to be synchronized with the content of the System Landscape Directory. Follow the steps below for synchronization.
9. (Optional) Synchronization of the business system in Integration Directory to the business system in System
Landscape Directory.
Double-click on the business system in the Integration Directory.
Switch to Edit mode.
Select menu: Service Adapter-Specific Identifiers
10. (Optional) Within the dialog box, click on the button as indicated below to resynchronize.
11. (Optional) If the expected data from the System Landscape Directory is not updated, then the SLD cache may need to be cleared first.
3.7 Create/configure the Communication Channel for the IDoc receiver adapter.
15. In the Integration Directory, create an IDoc receiver communication channel.
The RFC Destination is from step 3.1.
The Port is from step 3.2.
NOTE:
There is no need to create an IDoc sender Communication Channel for XI. Instead, the backend SAP system must be configure to send the IDoc to XI.
4 Appendix
Transaction: IDX2
There are a couple of situation where IDX2 can be useful on the XI system.
1. When we want to test connection between the XI and SAP backend system.
2. When an IDoc has changed, and the meta data stored in XI needs to be update. When an IDoc is sent from the SAP backend system to XI, XI will first check to see if the meta data for the IDoc is already in its persistent cache. If not, then XI will use the configuration in IDX1 to retrieve the IDoc meta data from the backend system. If the
meta is already in cache, then it will NOT do so. Therefore, when an IDoc has changed, it is necessary to manually update the new meta data on XI, or delete it from the cache, so that the latest version can be retrieved. IDX2 is used for this purpose.
Go to transaction IDX2 and click on Create.
Enter the IDoc Type and the Source Port as defined in step #2. Click Continue.If successful, the following will show up. If error occurs, then the IDX1 configurations will need to be re-checked.
Regards
Hemant
If find helpful plz award points -
Perfectly good XML file no longer updating in iTunes
Hey there, forum.
Ok, so I have this podcast that has sucessfully updated 36 or so times, I've never had a problem until now.
The podcast XML file is updating just like it has been, and and I can go to http://www.imboredpictures.com/e78podcastfeed.xml and verify this. Episodes 1-37 show up just fine. But my most recent update (which has been posted for over 2 weeks) does not show up - either on the itunes store or when I select the "Update Podcast" command in my subscriptions. Users are also unable to subscribe to the podcast using the "Subscribe to Podcast" command in iTunes and then pasting in the URL that links to the xml file.
So, if someone could please offer any suggestions, and/or a reason why this thing would suddenly STOP working, pleas let me know.
Thanks!Escape the "&" in line 46 - it's breaking the XML:
http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.imboredpictures.com%2Fe7 8podcastfeed.xml
Hope this helps,
Greg -
XML File - Problem.with naming tags with XI standard functions
Hello,
simple (?) problem:
Receiver expects an XML file via file adapter.
(The source data comes from an RFC connect to XI.)
In the XML tags like these are expected (following W3C definitions):
A) </gdt:ValueGroup>
How to define a data type with a ":" in its name or to convert it to the required tag?
B) <gdt:ExtendedAttribute gdt:guid="4c102d6b077de7c1f0e27391e40bb80f" gdt:code="X01" >GR2 LI3</gdt:ExtendedAttribute>
This one is a real nice one. The part with "gtd:guid=" within the tag is variable. How to add such values into tag names?
Any ideas if this is possible with standard and how.
If this is the limit of XI I think we need an XSLT- or JAVA-maping program to generate the required file.
Thank you for any help!
Best regards
DirkHi Dirk,
just one thing:
>>>>The part with "gtd:guid=" within the tag is variable.
this is ok as it's just an attribute
of the ExtendedAttribute tag's name
so it can be variable without any problems
(you can fill it in the mapping for example)
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
I am upgrading my Solution Manager 7.0 from stack 17 to stack 18(EHP1) but whenever I try to generate the xml file on the service marketplace, all I get is "The table does not contain any entries"
To recreate...
go to service.sap.com/swdc --> SAP Support Packages --> Support Package Stacks --> SAP Solution Manager 7.0
Then...
Target Stack = SAP SOLUTION MANAGER 7.0 EHP 1-Initial Delivery
Source Stack = 17 (8/2008)
when I click NEXT, it goes straight to page 3 of 3, and I get buttons for Previous Step, Print List, Save as file, Add to download basket, Side Effects report, etc...
Then the table where all the packages should be is empty, except for the message "the table does not contain any entries"
We have tried this with multiple people on multiple machines, all the same result. By the way I just upgraded from abap & java stack 15 to 17.. and I had no issues getting the xml file there. (I downloaded the DVDs of the actual patches so I just need the xml)
Thanks!
Edited by: Bill McCrea on Jan 15, 2009 2:42 PMAfter reading your question, I went to the SPstack webpage, and selected a SOLMAN EHp1 stack 16-17, DB2 UDB. when I was on the "Step 3 of 3 Downloadable support packages" I was able to select the Save as File button and I was able to generate the XML. It may have been a temporary problem. Make sure that you don't have a pop-up blocker that would prevent the window from appearing.
Regards
---Bill -
Namespace in output xml file problem?
Hi,
i imported an xsd in IR for developing an interface and the output was satisafactory except for a small problem in the namesapce which the file contains.
My xml file output looks like
<?xml version="1.0" encoding="UTF-8" ?>
- <MT_OSD_FILE xmlns="http://localfile/ext" Version="123" >
-field1
-field2
But where as the required format in the naming is
<?xml version="1.0" encoding="UTF-8" ?>
- <MT_OSD_FILE Version="123" xmlns="http://localfile/ext">
-field
-field
how to get the namespace before the version(attribute)
any ideas?Hi Prabhas,
<MT_OSD_FILE Version="123" xmlns="http://localfile/ext">
OR
<MT_OSD_FILE xmlns="http://localfile/ext" Version="123">
Both are same. Because, both Version and xmlns are arrtributes. And they should be unique (which they are) and they can be in any order.
Check XML standard [Link1|http://www.w3.org/TR/REC-xml-names/] Declaring Namespaces Such an attribute's name must either be xmlns or begin xmlns:. These attributes, like any other XML attributes, may be provided directly or by default.
Regards,
Raghu_Vamsee -
Sliding Flash Interface - Using Links from an XML file Problem
Hi All,
Working on a new site for the company i've recently started
working for... fairly new to flash but wanted to try this sliding
interface for the graphic banner at the top of the page...
have a look here at an early version of the site - sliding
graphic interface at the top with coloured rollover buttons (a lot
of work still to do! feel free to post constructive criticism)
(am I allowed to post links??)
here is the unfinished version with no links in the flash bit
http://www.westfieldhealth.com/website/index.asp
The Problem:
I am pulling in a 'heading' 'text' and 'image' into the
sliding graphic interface from the following xml file... (there are
4 different xml files for 4 different slides)
<?xml version="1.0" encoding="iso-8859-1"?>
<content>
<dialogue>
<heading>Interested in selling our health
plans?</heading>
<text>Click here to learn more...</text>
<img>home_window/intSmall.jpg</img>
</dialogue>
</content>
I want to add a link to the xml that would be specific to
each instance of the window...
eg
<link>contact-us/index.asp</link>
But my limited knowledge of flash means I have no idea how to
pull the link through from the xml file to use in the flash...
Perhaps I need link text to pull as well
eg
<link-text>click here to contact us</link-text>
Here is the function that pulls in the img, heading and txt
public function onComplete(event:Event):void {
var loader:URLLoader = event.target as URLLoader;
if (loader != null) {
externalXML = new XML(loader.data);
mover_mc.heading_txt.htmlText =
externalXML.dialogue[0].heading;
mover_mc.myText_txt.htmlText = externalXML.dialogue[0].text;
var url:URLRequest = new
URLRequest(externalXML.dialogue[0].img);
myLoader.load(url);
} else {
trace("loader is not a URLLoader!");
Can anyone help me on how to pull in the link from the xml
and use it to navigate to a different page on the site
Thanks very much
Hans
link to
my unfinished flash file...What is the exact error you get (what db version also), could you post a simplified version of the SQL which fails also? I have splitter based maps that successfully read from file via the XMLType(bfilename....) style code and insert into multiple targets, I did this on 11g though.
Cheers
David -
Web.xml file problem in tomcat
Hi i need help in this... its urgent
currently i just subscribe to a web hosting site and i need to start the private tomcat in the web server..
The followings are the instructions and i have follow them but i do not know how to create a web.xml file to store in the folder indicated for example a HelloServlet that im testing :
To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in /var/www/html/WEB-INF directory.
www root directory or webapps:/var/www/htm
Classes directory located in: /var/www/html/WEB-INF/Classes/
There you will need to upload your Java class file.
Our default url-mapping for servlet is: /servlet/*
To check servlet in your browser: www.mydomain.net/servlet/HelloWorld
Jsp Files - Upload anywhere in /var/www/html
all the above steps are follow except the web.xml file which i suppose to write and store in the folder... but i actually try to write one but i still cannot load my servlet on the webpage... test on standalone tomcat works.
pls help its urgent!!!first sorry about cross posting the subject. i didnt know i am not suppose to do that. i post in a few forums that are related to my topic. sorry
The tomcat on the web server is of version Private J2EE / Tomcat 4.1.29 and the standalone tomcat i am using is also tomcat 4.1
the web.xml in my standalone server in root/web-inf/ is as follows and it is configure for authentication purposes. It works together with the tomcat-users.xml located on conf directory
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<security-constraint>
<web-resource-collection>
<web-resource-name>
Restricted Area
</web-resource-name>
<url-pattern>/secure/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/Login.html</form-login-page>
<form-error-page>/Error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>The Secure ROLE</description>
<role-name>manager</role-name>
<role-name>tomcat</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>
Restricted Area
</web-resource-name>
<url-pattern>/Customer/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>customer</role-name>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/Login.html</form-login-page>
<form-error-page>/Error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>The Secure ROLE</description>
<role-name>customer</role-name>
<role-name>tomcat</role-name>
</security-role>
</web-app>
using this web.xml, my stanalone web pages works fine for all servlets and jsp. however if i copy this over to the web server, i still cannot load my servlets and jsp. moreover it doesnt work for authentication purpose anymore. i don't know why too
i have try the codes you write before and it also doesnt work
the problem is i cannot get the support form the web hosting site. This is the link that suppose to teach me but it doesn not tell me how to configure my web.xml
https://www.eroute.net/JSPSupport.htm -
Export a Final Cut Pro XML file problem about translation issue
When I export the final cut pro xml file, there is always translation issue like that 'Transition <....> not translated, Cross Dissolve used instead.'
Most of the transition type can cause the translation issues except the wipe and cross dissolve.
Is there any body knowing the reason? Is that OK?
By the way , I am using the trial version of cs5Hey Ani_,
I've been working with Adobe products for a long time and typically when you come across an error that has anything to do with a XML file export problem its due to things such as effects you may have added in, color corrections, cross fades or any type of video transitions between clips. Remember your work flow should be
Import your footage into Premiere Pro
Name your clips (helps find things later on)
Place clips on time line in the order you wish (ONLY MAKE CUTS don't add anything, transitions color effects nothing)
Then once your clips are all placed on the timeline in your correct order you then EXPORT> Final Cut Pro XML
Now you can bring this into other programs for color grading or whatever else your going to do. You will notice you have no errors on the export.
Once your done doing what your doing to the clips in another program (for example: Divinci Resolve color grading) you can then export them back to your main project then add your effects and transitions. -
Hi all,
I am trying to read an xml file and display the output. i get a blank display. Can anybody please help me out.
Thanks in advance
I cant attach the xml file. Since its not a valid extension. Please find the xml code below.
<Company>
<Name>Samsung</Name>
<Location>
<City>Busan</City>
<Country>South Korea</Country>
</Location>
</Company>
Regards,
KM
Solved!
Go to Solution.
Attachments:
Read Data from XML File.vi 9 KBIf you can change saved .xml file, you can modify it to be compatible with Labview XML shema and use Unflatten from XML like in your VI. If you cannot, you should use XML Parser library. In attachement you can find 2 exmaples for these situations.
Attachments:
Modified XML file.vi 12 KB
XML Parsing 1.vi 20 KB -
Multiple Target from an XML file problem
I've an XLM file from which I import (using a pluggable mapping generated from xml_etl_ulils) data into a table.
I need to execute some controls and log errors on these data.
I created a splitter to split correct data (and put them into the table) and bad data (to log).
However the generated mapping goes into an error because it tries to read 2 times the same XML data.
The only way I found is to put all data (good and bad) into a temporary table and then apply the splitter to move data from that table to the targets.
However that is not a clean solution because I need to have and manage 2 tables for each real table.
Any clever suggestion ?
Tks
TullioWhat is the exact error you get (what db version also), could you post a simplified version of the SQL which fails also? I have splitter based maps that successfully read from file via the XMLType(bfilename....) style code and insert into multiple targets, I did this on 11g though.
Cheers
David -
Reading from XML file and updating the table ????
Hi
I have package which reads the hier.XML file and does Update inserts into the 5 tables
i have table called MAIN_tbl with the column cur_date.
The package kicks if this cur_date is one day less than the hier.XML file DT.
Currently i m manually checking this date's to make sure the Main_tbl cur_date is n sync with
hier.XML file DT.
for example :- hier.xml file DT is "20091020" then main_table cur_date should be 10/19/2009
in order to kicks of the pakage.
what i m looking to do ??
compare the hier.xml DT with the main_table cur_date,
if cur_date is -1(Preivous day) of hier.xml DT then run hier_pkg(Package)
if not then update main_table cur_date to -1(previous day) of the hier.xml DATE
Then later write the above logic to update the main_table in a procedure, and
then call the package from the procedure.
below are the top few lines of the hier.XML file which is relevant to the one which we are trying to do
<?xml version = '1.0'?>
<HIER_POSTING num ="111" HIER_TYP="CD" DT="20091020" Global="Y">
FYI : The hier.XML file is located in UNIX space.
How do i accomplish this. any idea ????
Thank you so much in advance. For giving a thought on this problem!!!Any thought on this guys ???
Thanks!! -
hai ....this is anitha.
iam having some problem regarding the updation of the xml file. i can update the Node Values, its Attributes, its Childnodes etc.. successfully, but only once. first time it is working fine. but when again iam trying to update other nodes, the previously updated values r lost.. iam sending the code also.
pls give the reply asp.
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.DOMException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileInputStream;
import javax.servlet.http.*;
import java.util.ArrayList;
import java.util.Iterator;
//import javax.servlet.http.HttpSession;
public class empXml
String xmlFilePath="";
File xmlFile=null;
FileWriter fout=null;
Element emp;
Element empName;
Element empDesig;
Element empDiv;
//Element newNode;
public void createXml(ArrayList arr)throws IOException, DOMException
try
for(Iterator itr=arr.iterator();itr.hasNext();)
System.out.println(itr.next());
//System.out.println((String)(itr.next()));
xmlFile=new File("D:\\Tomcat 4.0\\webapps\\news\\jsp\\employee.xml");
System.out.println(" Employees Information ");
fout = new FileWriter(xmlFile);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Document doc = docBuilder.getDOMImplementation().
createDocument("", "employee", null);
Element root = doc.getDocumentElement();
emp = doc.createElement("emp");
empName = doc.createElement("empname");
empName.appendChild(doc.createTextNode(arr.get(0).toString()));
emp.appendChild(empName);
empDesig = doc.createElement("empdesig");
empDesig.appendChild(doc.createTextNode(arr.get(1).toString()));
emp.appendChild(empDesig);
empDiv = doc.createElement("empdiv");
empDiv.appendChild(doc.createTextNode(arr.get(2).toString()));
emp.appendChild(empDiv);
root.appendChild(emp);
DomTreeBuilder.printDomTree(doc,fout); // Builds The Dom Tree
System.out.println("Employees XML File is Successfully Generated");
}catch (Exception e)
System.err.println("Error while Generating file"+ e.getMessage());
finally
fout.close();
}//end of createXml
}//end of class createNewsXml
class DomTreeBuilder
public static void printDomTree(Node node,FileWriter fout) throws IOException
int type = node.getNodeType();
switch (type)
// print the document element
case Node.DOCUMENT_NODE:
fout.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
printDomTree(((Document)node).getDocumentElement(),fout);
break;
// print element and any attributes
case Node.ELEMENT_NODE:
fout.write("<");
fout.write(node.getNodeName());
if (node.hasAttributes())
NamedNodeMap attrs = node.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
printDomTree(attrs.item(i),fout);
fout.write(">");
if (node.hasChildNodes())
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
printDomTree(children.item(i),fout);
break;
// Print attribute nodes
case Node.ATTRIBUTE_NODE:
fout.write(" " + node.getNodeName() + "=\"");
fout.write(node.getNodeValue());
if (node.hasChildNodes())
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
printDomTree(children.item(i),fout);
fout.write("\"");
break;
// handle entity reference nodes
case Node.ENTITY_REFERENCE_NODE:
fout.write("&");
fout.write(node.getNodeName());
fout.write(";");
break;
// print cdata sections
case Node.CDATA_SECTION_NODE:
fout.write("<![CDATA[");
fout.write(node.getNodeValue());
fout.write("]]>");
break;
// print text
case Node.TEXT_NODE:
fout.write(node.getNodeValue());
break;
// print comment
case Node.COMMENT_NODE:
fout.write("<!--");
fout.write(node.getNodeValue());
fout.write("-->");
break;
// print processing instruction
case Node.PROCESSING_INSTRUCTION_NODE:
fout.write("<?");
fout.write(node.getNodeName());
String data = node.getNodeValue();
fout.write(" ");
fout.write(data);
fout.write("?>");
break;
} // end of Switch
if (type == Node.ELEMENT_NODE)
fout.write("</");
fout.write(node.getNodeName());
fout.write('>');
} // printDomTree(Node)
} // End of DomBuilder Class
waiting for the reply soon.
thanks and regards,
anithaHi,
There was no problem in this code. When I executed it worked well, anyway I changed slightly because to add more than one elements. I posted the entire code here:
Regards
Baskar
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.DOMException;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
public class empXml {
String xmlFilePath = "";
File xmlFile = null;
FileWriter fout = null;
Element emp;
Element empName;
Element empDesig;
Element empDiv;
// Element newNode;
public static void main(String[] args) {
try {
empXml x = new empXml();
ArrayList ar = new ArrayList();
ar.add("baskar,SE,Hitachi");
ar.add("krish,SE,Hitachi");
ar.add("preet,SE,Hitachi");
ar.add("Jan,SE,Hitachi");
ar.add("Sam,SE,Hitachi");
x.createXml(ar);
} catch (Exception e) {
e.printStackTrace();
public void createXml(ArrayList arr) throws IOException, DOMException {
String empl[] = new String[arr.size()];
arr.toArray(empl);
try {
Iterator itr = arr.iterator();
xmlFile = new File("employee.xml");
System.out.println(" Employees Information ");
fout = new FileWriter(xmlFile);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Document doc = docBuilder.getDOMImplementation().createDocument("",
"employee", null);
Element root = doc.getDocumentElement();
for (int i = 0; i < empl.length; i++) {
StringTokenizer st = new StringTokenizer(empl, ",");
emp = doc.createElement("emp");
empName = doc.createElement("empname");
empName.appendChild(doc.createTextNode(st.nextToken()));
emp.appendChild(empName);
empDesig = doc.createElement("empdesig");
empDesig.appendChild(doc.createTextNode(st.nextToken()));
emp.appendChild(empDesig);
empDiv = doc.createElement("empdiv");
empDiv.appendChild(doc.createTextNode(st.nextToken()));
emp.appendChild(empDiv);
root.appendChild(emp);
DomTreeBuilder.printDomTree(doc, fout); // Builds The Dom Tree
System.out.println("Employees XML File is Successfully Generated");
} catch (Exception e) {
e.printStackTrace();
} finally {
fout.close();
}// end of createXml
}// end of class createNewsXml
class DomTreeBuilder {
public static void printDomTree(Node node, FileWriter fout)
throws IOException {
int type = node.getNodeType();
switch (type) {
// print the document element
case Node.DOCUMENT_NODE: {
fout.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
printDomTree(((Document) node).getDocumentElement(), fout);
break;
// print element and any attributes
case Node.ELEMENT_NODE: {
fout.write("<");
fout.write(node.getNodeName());
if (node.hasAttributes()) {
NamedNodeMap attrs = node.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
printDomTree(attrs.item(i), fout);
fout.write(">");
if (node.hasChildNodes()) {
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
printDomTree(children.item(i), fout);
break;
// Print attribute nodes
case Node.ATTRIBUTE_NODE: {
fout.write(" " + node.getNodeName() + "=\"");
fout.write(node.getNodeValue());
if (node.hasChildNodes()) {
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
printDomTree(children.item(i), fout);
fout.write("\"");
break;
// handle entity reference nodes
case Node.ENTITY_REFERENCE_NODE: {
fout.write("&");
fout.write(node.getNodeName());
fout.write(";");
break;
// print cdata sections
case Node.CDATA_SECTION_NODE: {
fout.write("<![CDATA[");
fout.write(node.getNodeValue());
fout.write("]]>");
break;
// print text
case Node.TEXT_NODE: {
fout.write(node.getNodeValue());
break;
// print comment
case Node.COMMENT_NODE: {
fout.write("<!--");
fout.write(node.getNodeValue());
fout.write("-->");
break;
// print processing instruction
case Node.PROCESSING_INSTRUCTION_NODE: {
fout.write("<?");
fout.write(node.getNodeName());
String data = node.getNodeValue();
fout.write(" ");
fout.write(data);
fout.write("?>");
break;
} // end of Switch
if (type == Node.ELEMENT_NODE) {
fout.write("</");
fout.write(node.getNodeName());
fout.write('>');
} // printDomTree(Node)
} // End of DomBuilder Class -
Problems with mapping after bundling messages into one XML-file
Hi all,
Case 1: one DebMas IDoc ==> XI ==> one XML-file : no problems with mapping.
Case 2: several DebMas IDoc's ==> XI ==> one XML-file : problems with mapping.
Explanation:
Incoming DebMas IDoc's:
Businesspartner 1 : no Customer Master Partner Functions (E1KNVPM).
Businesspartner 2 : Customer Master Partner Functions (E1KNVPM).
Businesspartner 3 : Customer Master Partner Functions (E1KNVPM).
Businesspartner 4 : Customer Master Partner Functions (E1KNVPM).
After bundling into one XML-file:
Businesspartner 1 : no Customer Master Partner Functions (E1KNVPM).
Businesspartner 2 : no Customer Master Partner Functions (E1KNVPM) !!!!
Businesspartner 3 : Customer Master Partner Functions of Bp 2 (E1KNVPM) !!!!.
Businesspartner 4 : Customer Master Partner Functions of Bp 3 (E1KNVPM) !!!!.
All the payloads of the IDoc's are correct.
In the message mapping we use a Container for the Partner Functions (shown as below)
Is this a serious bug in the mapping of SAP XI ?
Does anyone knows how to solve this serious problem.
E1KNVVM -
> Partner_Container
E1KNVPM -
> Partner
PARVW -
> ParnerRole
KUNN2 -
> PartnerNumber
Regards,
Theo PijlmanHi,
Example:
Input idoc has field F1 with occurence 0..unbnd
My input values for field F1 is
1
none
2
3
Say, I have a mapping, F1---->TargetF1
In the target only 3 TargetF1s will be created for the values 1,2,3 and nothing will be created for the field F1 with no value.
To overcome this, use collapse contexts.
F1->collapsecontexts>TargetF1
This way, the TargetF1 fields created will have the following values:
1
blank
2
3
Collapse contexts makes sure that a target is created, even if there is a context change specified at the source.
Hope this is clear.
Regards,
Smitha. -
Updating xml file by iTunes library
I have several iTunes libraries, managing them with 'iTunes Library Manager', bought from Dougscripts.
When I add songs to my (main) library or make some changes in the data, all is perfectly visible in iTunes.
As I use the iTunes data in a FileMaker Pro program, I want of course to update the information in the FMP program by running a script which reads the newly added songs from the xml file of the (main) iTunes library.
This does not work, the newly added songs are not found.
When I save the library, select another library and subsequently reload the main library, it works.
Apparently, the xml file of the (main) library is not updated, unless it is forced by the saving, closing and reloading operation.
Is there another way to force the library to update its xml file?My point is, that this does not happen.
While the library is in use and even after it or iTunes itself is closed, the xml file is not updated, at least my script cannot find the recently added songs.
Only after expressly saving the library and opening another library and reopening the original library, my script finds the new songs, so only then the xml file has been updated.
Maybe you are looking for
-
HI I know this topic is duplicate but the reason that i'm creating it is because blackberry support team or developers have not done anything to fix it yet. I agree with ehsanp and farvardinzad on they posts here and here : , this is so annoying u
-
It is some kind of dark yellow and is very bright as it seems with some personas. Changing color should not be that big of a deal and i don't wanna download any themes.
-
I keep trying to redeem my itunes cards i got for christmas, .
I tried to do this on my ipod touch and i did everything correctly but whenever i click redeem , it keeps on asking me for my password. Over and over again and it refuses to redeem the card. What can i do to fix this?
-
Flex 4 Video player not showing the video in any other machines
I created a new Flex 4 project, and used Video display component and source was set to a file in src folder. It works fine in my computer. But after moving the content from bin-release to another machine, video is not showing. The flv file is in the
-
CS3 Volume Media - Where to buy?
We have a TLP license for CS3 Design Premium. We have a license certificate with keys for Mac and Windows. When we purchased the license we also purchased Mac volume media as it was to be used on a Mac. We now want to switch the installation across