XML File in XSLT with dc:subject
Hi
How to Read the XML File in XSLT
is there any rule to read
what is this dc:subject
can any one give me a sample code to read this in XSLT for a jsp page
<?xml version='1.0' encoding='UTF-8'?>
<record xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:subject xml:lang='en'>
Science--Physics
</dc:subject>
</record>
Thanks
rajiv
Normally I would be happy to help you, but after several years of trying to help here, I've decided not to contribute anymore because of the piss-poor way in which this site is being administered.
Others are still helping, but more may leave if things don't improve. May I recommend devshed or javaranch?
http://www.devshed.com/
http://www.javaranch.com/
If you would like to complain to the admins of this forum, either click the "Report Abuse" link or the "Feedback" link.
-- foofoo (shamelessly stolen the text from jverd).
Similar Messages
-
How to update XML file using XSLT
Hi there,
I have a "small" issue with exporting data to an XML file using XSLT.
A two steps process is needed to import data from a non-hierarchical XML file into ABAP, change the data, and then update the XML file with new values. The problem is not trivial, since the format of the XML file is a complex one: there are many interdependent elements on the same level, pointing to each other by using id and ref attributes. Based on these values the data can be read and written into an internal table. I use XSLT and XPath for that. So the inbound process is done and seems to work correctly. I have to mention that the file contains much more data than I need. I am working only with a small part of it.
Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT? I can pass only the internal table to the transformation, so how do I access the XML file in order to update it? I have tried to use the <B>xsl:document()</B> function to access the content of the file store locally on my PC, but it fails each time by throwing and URI exception. I have tried the absolute path without any addition and the path with the file:/// addition. Same result. Please advise.
Many thanks,
Ferenc
P.S. Please provide me with links only if they are relevant for this very matter. I will not give points for irrelevant postings...Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT?
XSLT approach: check these online tutorial
http://www.xml.com/pub/a/2000/08/02/xslt/index.html
http://www.xml.com/pub/a/2000/06/07/transforming/index.html
ABAP approach:
for example you have the xml (original) in a string called say xml_out .
data: l_xml type ref to cl_xml_document ,
node type ref to if_ixml_node .
create object l_xml.
call method l_xml->parse_string
exporting
stream = xml_out.
node = l_xml->find_node(
name = 'IDENTITY'
ROOT = ROOT
l_xml->set_attribute(
name = 'Name'
value = 'Charles'
node = node
(the above example reads the element IDENTITY and sets attribute name/value to the same)
like wise you can add new elements starting from IDENTITY using various methods available in class CL_XML_DOCUMENT
so how do I access the XML file in order to update it?
you have already read this XML into a ABAP variable right?
Sorry couldnt understand your whole process, why do you need to read local XML file?
Raja -
Create XML file from ABAP with SOAP Details
Hi,
I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<CUNS:HeaderInfo>
<CUNS:InterfaceTypeId>10006</InterfaceTypeId>
<CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
<CUNS:SchemaVersion>1.0</SchemaVersion>
<CUNS:DateTime>sy-datum</DateTime>
</CUNS:HeaderInfo>
</SOAP:Header>
<SOAP:Body>
<xsl:copy-of select="*"/>
</SOAP:Body>
</SOAP:Envelope>
</xsl:template>
</xsl:transform>
In ABAP program, I have written below code for calling above Transformation.
call transformation ('Z_ID')
source tab = im_t_output[]
result xml xml_out.
call function 'SCMS_STRING_TO_FTEXT'
exporting
text = xml_out
tables
ftext_tab = ex_t_xml_data.
Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
Is there any easy way to create the XML file in CALL Transformation. Please help.
ThanksTry ABAP forum, as it seems not to be PI related.
-
Open XML and using xslt with JavaScript
Hello,
I want the user to be able to choose an XML-file. This XML-file should not be placed in InDesign, there is not even a document needed for my script. All I need is a variable, containing the file. However, the XML-file should be transformed with xslt into another XML-file. How do I do this?
This is how I open the first XML-file, the one that should be transformed:
var xmlDoc = File.openDialog ("Choose XML");
if (xmlDoc == null) {return;}
xmlDoc.open("r");
xmlDoc = xmlDoc.read();
xmlDoc = new XML(xmlDoc);
I can adress different nodes and use xmlDoc as an XML-file, so that's fine, but how do I transform it?
I read the Scripting Guide and tried this:
var myDocument = app.documents.add();
var myXMLImportPreferences = app.xmlImportPreferences;
myXMLImportPreferences.transformFilename = "c:\myTransform.xsl";
var xx = myDocument.importXML(File.openDialog ("XML"));
However, it's not exactly what I want since I have to create a document and it's not working either, since xx stays undefined.
Thanks for your help.You can't get exactly what you want.
Your first code example uses the InDesign JavaScript interpreter's XML support, called E4X. It has absolutely nothing to do with the InDesign document object model or InDesign's internal support for XML. It exists only within the JavaScript interpreter. It does not support XSLT transformations.
Your second example leverages InDesign's built-in XSLT support (I'm not too sure how this works...); but that is only useful when importing XML into
InDesign, which, as you have learned, requires a document.
In the first example, you could call out to an external invokation of xsltproc and read in the input. How to do that differs for Windows and Mac.
In the second example, you could export the XML from your Document back out to an XML file and read it back in with E4X.
None of this is very appealing. What do you really need to do? -
How to find the existence of a tag in XML file through XSLT Mapping?
Hello Friends,
Working on an SAP XI interface ,I have come across a situation where I need to map the values only when a particular tag exists in the inbound XML file.I need to use the XSLT mapping for the same.
Requesting your advice on as to how may I validate the existence of a tag through XSLT mapping?
Thanks.Hello Friends
After research , I could also find another way to check the existence of a node .We can even use CHOOSE to check the existence.
<xsl:choose>
<xsl:when test="(/mynode)">
your action if the mynode is found
</xsl:when>
<xsl:otherwise>
action if mynode is not found
</xsl:otherwise>
</xsl:choose>
Thanks.
Wishes
Richa -
JSP XML file parsing XSLT using Xalan
Hi all
I have created an XML file "view_campaign.xml" using JSP as shown in a code below and i wanna know how i should proceed to parse the XML file and so i can display this XML as the XSLT file i created.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%
// Identify a carriage return character for each output line
int iLf = 10;
char cLf = (char)iLf;
// Create a new empty binary file, which will content XML output
File outputFile = new File("C:\\WebContent\\view_campaigns.xml");
//outputFile.createNewFile();
FileWriter outfile = new FileWriter(outputFile);
// the header for XML file
outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
try {
// Define connection string and make a connection to database
//DriverManager.registerDriver (new org.apache.derby.jdbc.ClientDriver());
Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/sample","app","app");
Statement stat = conn.createStatement();
// Create a recordset
ResultSet rset = stat.executeQuery("Select * From campagn");
// Expecting at least one record
if( !rset.next() ) {
throw new IllegalArgumentException("No data found for the campaigns table");
outfile.write("<campaigns>"+cLf);
outfile.write("<campaign>"+cLf);
outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
outfile.write("</campaign>"+cLf);
// Parse our recordset
// Parse our recordset
while(rset.next()) {
outfile.write("<campaign>"+cLf);
outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
outfile.write("</campaign>"+cLf);
outfile.write("</campaigns>"+cLf);
// Everything must be closed
rset.close();
stat.close();
conn.close();
outfile.close();
catch( Exception er ) {
%>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
this is my .XSL file
<?xml version="1.0" encoding="iso-8859-1" ?>
- <!-- DWXMLSource="view_campaigns.xml"
-->
<!DOCTYPE xsl:stylesheet (View Source for full doctype...)>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
- <xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gestion des campagnes</title>
</head>
- <body>
Gestion des campagnes
- <table border="1">
- <tr bgcolor="#9acd32">
<th align="left">Code</th>
<th align="left">Nom</th>
<th align="left">Type</th>
<th align="left">Client</th>
<th align="left">Nombre de positions</th>
<th align="left">Date d'ouverture</th>
<th align="left">Date de cl�ture</th>
</tr>
- <xsl:for-each select="campaigns/campaign">
- <tr>
- <td>
<xsl:value-of select="campaign_id" />
</td>
- <td>
<xsl:value-of select="campaign_name" />
</td>
- <td>
<xsl:value-of select="campaign_type" />
</td>
- <td>
<xsl:value-of select="client" />
</td>
- <td>
<xsl:value-of select="positions" />
</td>
- <td>
<xsl:value-of select="begin" />
</td>
- <td>
<xsl:value-of select="close" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>I would be greatful that u answer my question what i should do have any exemple case study.Hi,
Try this code
JspWriter out = pageContext.getOut(); // Get JSP output writter
javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance(); //Instantiate a TransformerFactory.
String realPath = "c:/applyXsl.xsl";
java.io.File file = new java.io.File(realPath); // crearte a file object for given XSL.
// Use the TransformerFactory to process the stylesheet Source and generate a Transformer.
javax.xml.transform.Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource(file));
java.io.StringReader inputStream = new java.io.StringReader("c:/xmlFile.xml"); // create an input stream for given XML doc
java.io.ByteArrayOutputStream obj = new java.io.ByteArrayOutputStream(); // Create an output stream for XSL applied XML doc.
// 3. Use the Transformer to transform an XML Source and send the output to a Result object.
transformer.transform(new javax.xml.transform.stream.StreamSource(inputStream), new javax.xml.transform.stream.StreamResult(obj));
String outputString = obj.toString(); // get the XSL applied applied XML document for print
out.println(outputString); // print the XSL applied XML in to JSP.
however you need xercesImpl.jar and xml-apis.jar files to run this program.
Regards,
Ananth.P -
UCCX 7.1 Holiday.xml file being overwritten with older file
I'm administering a UCCX server v7.1 in which the holiday.xml file in the wfaavid\documents\user directory keeps resorting to an older holiday.xml file after I manually copy an updated file into the directory. When I initially copy the file over, our Contact Center identifies the holidays fine. I find each holiday there after, an older version of the file with older dates appears. So I have to manually copy the file to the directory again that holiday morning. I'm assuming the switch occurs before hand but not sure when or why. Is there another directory I'm missing that I should be copying the updated file too? Or is there another explanation that is causing this issue?
Any help would be appreciated.That local directory is overwritten by the document in the repository (in the database).
That's working as designed. You'll need to leverage the web page AppAdmin to update your XML file, or do it from within a script with the Upload Document step. Those are the only two supported methods.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches. -
Creating XML-files in ABAP with format ISO-8859-1 after the use of unicode
Hello,
We have a problem with XML-files created in z_abap-programma.
Before the use of unicode the XML-file was of the format: ISO-8859-1.
After the introducting of unicode the format is UTF-16.
In the abap-program we are using:
CALL TRANSFORMATION xls-program
SOURCE t_vbak = it_vbak
RESULT XML xmlstring.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = xmlstring
IMPORTING
buffer = lx_xml_as_string.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lx_xml_as_string
IMPORTING
output_length = li_xml_size
TABLES
binary_tab = ltb_xml_table.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = li_xml_size
filename = lc_filename
filetype = 'BIN'
CHANGING
data_tab = ltb_xml_table
EXCEPTIONS
OTHERS = 24.
Is it prossible to create the XML-file with the format ISO-8859-1 after the unicode, please can you explane how to solve this problem.
Regards,
Theo Pijlmanhi theo,
did you read my thread i wrote some days before ? have a look in my sample coding find " if_ixml_encoding ..... " there you can set the encoding of character .
greetz
tony
thread:
Re: abap to xml
SAP Explanation for Interface if_ixml_encoding :
http://help.sap.com/saphelp_nw04/helpdata/de/bb/5766a6dca511d4990b00508b6b8b11/content.htm -
Read XML file by elements with spaces
Hi All,
* I want to read an XML file using DOM
<Employee>
<Name> aaa </Name>
<Age>27</Age>
</Employee>
* That is in the above example, i want read "Name" element value as " aaa" with spaces........
* I tried with DOM and also SAX, but it removed the spaces of the elements.........
* How to keep spaces of the elements Using DOM or SAX.............?
* Thanks in advance
WithRegards,
JavaImranI suspect you need to read again your documentation on the DOM. You probably need Node.getTextContent(); but the detail of what you are doing matters so I could be wrong.
-
Here is my situation. I've been ripping my cds to Lossless for almost a year now and I'm at about cd 3000. A few days ago my Mini got hung up on a cd and locked up. The cd drive even completely stopped spinning after about an hour. I did the only thing I could and turned the power off. It was totally unresponsive. When I re-booted I got the "iTunes Library has been renamed (damaged) error. I tried several fixes which didn't work such as simply renaming damaged(by removing the word damaged from the file name). Right now I have dragged the Library File and the XML file to my desktop and tried to restart iTunes to import the XML file but that's giving me none of my playlists. I have a playlist for every album in my library. I like this way so no need to comment on how it doesn't make sense to you. My database file is 43MB and the XML is just a few KB. My library is stored on an external drive. I will freak out if I have to create all these playlists again. I know that there is a playlist generator app that will automatically do this but I had these all last name, first name and aliases and how I wanted to find them so I put a lot of work into how I organized everything. What else can I try?
It's so funny you just replied to this because I've been waiting patiently for a week and I just now posted another snag I'm running into right above this post.
I never really had any kind of problems with all of the playlists. It never really hung up or anything like that at all & I'm using a very first generation Mac Mini. It would seamlessly play from any song I picked to any other song I picked by just clicking on it.
I had multiple reasons for using so many playlists if you want to read about them here:
http://forum.audiogon.com/cgi-bin/fr.pl?ddgtl&1230475284 -
Xml file without namespace with file adapter
Hi,
Please can you assist. We will be receiving a XML file from an application without the namespace in the file.
As I tested thusfar PI requires a namespace as part of the xml file.
How would it be possible to you handle this with the file adapter.
Ex.
<?xml version="1.0" encoding="UTF-8"?>
<applicatrion>
<orders>
<order>
<action>I</action>
<orderId>4261A92485</orderId>
</order>
</orders>
</application>
Regards
Willie HugoHi Hugo,
Please see if this link could clear some doubts http://www.w3schools.com/XML/xml_namespaces.asp
We generally get an idoc xml in the below format without any issues:
<?xml version="1.0" encoding="UTF-8" ?>
- <ORDERS05>
- <IDOC BEGIN="1">
- <EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>510</MANDT>
<DOCNUM>0000000000127051</DOCNUM>
<DOCREL>700</DOCREL>
<DIRECT>1</DIRECT>
<IDOCTYP>ORDERS05</IDOCTYP>
</EDI_DC40>
Thanks,
Sudhansu -
I have a XML version of a document, and an XSLT version that represents the SAME document.
How can I compare them and check that they are the same in the JAVA?
Thanks.Abder-Rahman wrote:
How can I compare them and check that they are the same in the JAVA?How would you do it NOT in Java?
If you know that, then when you get stuck writing the Java code to implement the algorithm, as a more specific question.
If you don't know how to do it NOT in Java, then you need to figure that out before coming here or even thinking about Java. -
Accessing the currently imported XML file in InDesign with JavascriptIsthere
Is there a way to access an XML document that has already been imported into InDesign through javascript. I can see how to get a pointer to the document if I import it through my script, but not how to access the XML if it is already linked to the document.
Thanks,
Jared PedrozaWhat I am trying to do is replace each instance of a certain XML element from the imported document with an inline anchored text box that contains the contents of the element. So I guess I do not need access to the actual XML document, but rather to the elements within InDesign. I have tried using app.activeDocument.xmlElements.xmlElements.itemByName("<tag>") but I can't access any methods, almost like I am not getting the correct object returned. See code below...
//Load in all the paragraph styles in the current document
var currentDocument = app.activeDocument;
//The following are not currently needed.
//var allParaStyles = currentDocument.allParagraphStyles;
//alert(allParaStyles[1].name);
//Create the dialog box to get parameters...
var settingsDialog = app.dialogs.add({name:"Replace a Tag with an Anchored Box", canCancel:true});
//Add the fields we need
with (settingsDialog)
//Add a dialog column
with(dialogColumns.add()) {
//Border panel
with(borderPanels.add()) {
with(dialogColumns.add()) {
staticTexts.add({staticLabel:"Tag:"});
with(dialogColumns.add()) {
var myTagSelection = textEditboxes.add({editContents:"Enter tag here..."})
//Display the box
if (settingsDialog.show() == true)
var selectedTag;
//If the user didn't click the cancel button, get the values back from the dialog
//get the selected XML tag
selectedTag = myTagSelection.editContents;
//alert(selectedTag);
//Find the tag in the document
var myCurrentXMLElement = currentDocument.xmlElements.itemByName(selectedTag); -
http://itunes.apple.com/us/podcast/village-parkway-baptist-church/id520252317
iTunes is using your feed at http://vpbc.downloadsvr.com/Podcasts/Audio%20podcasts/VPBC%2004152012%20audio%20 podcast%20945%20service.xml
When you want to add a new episodes to your podcast you don't make a new feed: you add the episode to the existing feed, then subscribers will see it immediately and the iTunes Store will pick it up in 1-2 days. You don't need to resubmit the feed - indeed you can't. -
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.
Maybe you are looking for
-
Error 403 Reported when trying to access web page through a program.
I was writing a program for fun, to try to download a web page, pdf or anything from the web. The program works fine when given local file system path in URL and also works well when i tried to access a page from the tomcat installed on my machine bu
-
I have a HP 2009 desktop monitor. the on/off button flashes but the screen stays black. what does this mena and how can i fix it ?
-
JavaScript (JS) To Maximize InDesign CS4 Application
I'm trying to write a JavaScript that will maximize the InDesign CS4 application window. I can control the document windows, but haven't found a way to control the application window. Any suggestions?
-
Sudden Change in CD Importing - Please Help!
Hi - I am new to iTunes, iPods and my new laptop. I just started adding CDs to my library last week and was very pleased with the process. The songs were downloading quickly and I was able to play other songs during the process with no interference.
-
Where do you find the "add a device" option in firefox 4.0 so that you can sync your mobile phone to your desktop?