XSLT and XML integration problem
Hi there,
Got a problem that I dont understand why its happening. I have an XML document (produced by the JDOM ResultSet Builder).
And I run it through a stylesheet and the data comes up normally. When I now add the banner and navigation bar details to the stylesheet document leaving all the transformatio stuff the same, but there is no longer an output in my browser.
Checking catalina.out shows a
java.lang.nullPointerException
which occurs just when Im about to do the transformation .....
Transformer transformer = template.newTransformer();
Any ideas why this is so.
Many thanks
JS
Here's my code FYI
XML
<?xml version="1.0" encoding="UTF-8"?>
<result>
<entry>
<StudentID>9917217</StudentID>
<DCSCentralID>1</DCSCentralID>
<FirstName>Jason</FirstName>
<LastName>Smartt</LastName>
<DateOfBirth>10 June 1976 00:00:00 o'clock BST</DateOfBirth>
<TermTimeAddress>25 Oakwood Close, Burton, London</TermTimeAddress>
<TermTimePostCode>SE5 3LS</TermTimePostCode>
<PermanentAddress>15 West Wickham Road, Bromley</PermanentAddress>
<PermanentPostCode>BR4 5TT</PermanentPostCode>
<PermanentPhoneNumber>02074556789</PermanentPhoneNumber>
<MobileTelephone>07987 654664</MobileTelephone>
<EmailAddress>[email protected]</EmailAddress>
<EntryQualifications>AAC</EntryQualifications>
<YearOfEntry>1999</YearOfEntry>
<YearOfGrad>2003</YearOfGrad>
<CurrentStage>3</CurrentStage>
<CandidateNumber>E08956</CandidateNumber>
<LecturerID>TC01</LecturerID>
<UCASCode>G4N2</UCASCode>
<Photograph />
</entry>
</result>
XSL Document
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<xsl:apply-templates select="result/entry"/>
</html>
</xsl:template>
<xsl:template match="result/entry">
<head>
<title>MyDetails</title></head>
<body bgcolor="#FFFFFF">
<table border="1" width="100%" height="82" cellspacing="0" cellpadding="0" bgcolor="#FFCC00" bordercolordark="#666666" bordercolorlight="#CCCCCC">
<tr>
<td width="22%" height="90" bordercolor="#0000FF" valign="middle" align="center"><!--mstheme--><font face="Arial, Arial, Helvetica">
<h1 align="center"><i><font face="Arial Black" color="#000000">my</font></i><font face="Arial Black" color="#000000">DCS</font></h1>
<!--mstheme--></font>
</td>
<td width="61%" height="90" bordercolorlight="#000000"><!--mstheme--><font face="Arial, Arial, Helvetica">
</td>
<td width="17%" height="90" bordercolorlight="#000000"><!--mstheme--><font face="Arial, Arial, Helvetica">
</td>
</tr>
</table>
<!--mstheme--><font face="Arial, Arial, Helvetica"><!--mstheme--></font>
<table border="0" width="100%" cellpadding="0" cellspacing="0" height="355">
<tr>
<td width="100%" colspan="2" bgcolor="#FFFF00">
<p align="center"><font face="Verdana"><b>MyDetails</b></font></p></td>
</tr>
<tr>
<td width="50%"><b>Personals</b></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><font face="Verdana">Student ID</font></td>
<td width="50%"><font face="Courier"><xsl:apply-templates select="StudentID"/></font></td>
</tr>
<tr>
<td width="50%"><font face="Verdana">DCSCentralID</font></td>
<td width="50%"><font face="Courier"><xsl:apply-templates select="DCSCentralID"/></font></td>
</tr>
<tr>
<td width="50%"><font face="Verdana">First Name</font></td>
<td width="50%"><font face="Courier"><xsl:apply-templates select="FirstName"/></font></td>
</tr>
<tr>
<td width="50%"><font face="Verdana">Surname</font></td>
<td width="50%"><font face="Courier"><xsl:apply-templates select="LastName"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Date Of Birth</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="DateOfBirth"/></font></td>
</tr>
<tr>
<td width="50%" height="21"></td>
<td width="50%" height="21"></td>
</tr>
<tr>
<td width="100%" colspan="2" height="21"><b>Address Information</b></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Term-Time Address</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="TermTimeAddress"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Term-Time Postcode</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="TermTimePostCode"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Permanent Home Address</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="PermanentAddress"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Permanent Home Postcode</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="PermanentPostCode"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Permanent Phone Number</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="PermanentPhoneNumber"/></font></td>
</tr>
<tr>
<td width="50%" height="21"></td>
<td width="50%" height="21"></td>
</tr>
<tr>
<td width="50%" height="21"><b>Contact Details</b></td>
<td width="50%" height="21"></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Mobile Phone Number</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="MobileTelephone"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Email Address</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="EmailAddress"/></font></td>
</tr>
<tr>
<td width="50%" height="21"></td>
<td width="50%" height="21"></td>
</tr>
<tr>
<td width="50%" height="21"><b>Academic Information</b></td>
<td width="50%" height="21"></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Entry Grades</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="EntryQualifications"/></font></td>
</tr>
<tr>
<td width="50%" height="20"><font face="Verdana">Year of Entry</font></td>
<td width="50%" height="20"><font face="Courier"><xsl:apply-templates select="YearOfEntry"/></font></td>
</tr>
<tr>
<td width="50%" height="21"><font face="Verdana">Year of Graduation</font></td>
<td width="50%" height="21"><font face="Courier"><xsl:apply-templates select="YearOfGrad"/></font></td>
</tr>
<tr>
<td width="50%" height="21"><font face="Verdana">Current Stage</font></td>
<td width="50%" height="21"><font face="Courier"><xsl:apply-templates select="CurrentStage"/></font></td>
</tr>
<tr>
<td width="50%" height="21"><font face="Verdana">UCAS Code</font></td>
<td width="50%" height="21"><font face="Courier"><xsl:apply-templates select="UCASCode"/></font></td>
</tr>
<tr>
<td width="50%" height="21"><font face="Verdana">Candidate Number</font></td>
<td width="50%" height="21"><font face="Courier"><xsl:apply-templates select="CandidateNumber"/></font></td>
</tr>
<tr>
<td width="50%" height="21"><font face="Verdana">Tutor Code</font></td>
<td width="50%" height="21"><font face="Courier"><xsl:apply-templates select="LecturerID"/></font></td>
</tr>
</table>
</body>
</xsl:template>
<xsl:template match="StudentID">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="DCSCentralID">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="FirstName">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="LastName">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="DateOfBirth">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="TermTimeAddress">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="TermTimePostCode">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="PermanentAddress">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="PermanentPostCode">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="PermanentPhoneNumber">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="MobileTelephone">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="EmailAddress">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="YearOfEntry">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="YearOfGrad">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="CurrentStage">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="UCASCode">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="CandidateNumber">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="LecturerID">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Thx again.
J
Thanks dvohra
But in my servlet, I already have the transformer factory defined as follows
public class JDOMServlet extends HttpServlet {
private TransformerFactory tFactory = TransformerFactory.newInstance();
private ResultSet rs = null;
private StreamSource xsltSource;
private Templates template;
public void init(ServletConfig config) throws ServletException {
super.init(config);
ServletContext ctx = config.getServletContext();
try {
//Want to cache the stylesheet for future resuse
//then it doesnt have to be loaded constantly
URL xslURL = ctx.getResource("/WEB-INF/viewStudentDetails.xsl");
System.out.println(xslURL);
xsltSource = new StreamSource(new java.net.URL(xslURL.toString()).openStream());
//xsltSource = new StreamSource(ctx.getResourceAsStream("/Web-inf/viewStudentDetails.xsl"));
template = tFactory.newTemplates(xsltSource);
catch (Exception e) {
e.printStackTrace();
I think the key point is that, this transformation servlet worked fine, when all it was outputting was the xml data, styled in a table. As soon as I enter more table info, (i.e. for the banner and navigation bar), the null pointer exception pops up.
....a lost and puzzled jase....
Thanks again.
JS
Similar Messages
-
Question about Java,XSLT and XML
I am new to Java and XML. I'm not quite clear the relationship between Java,XSLT and XML.
To exercise, I am going to write a Java program that makes embedded calls to an XSLT processor(XALAN), to produce results for several constrained transformations from a given XML document(x.xml) such as:
1.Transform the x.xml (which satisfies d1.dtd) in such a way that it now conforms to the DTD d2.dtd. Output the resulting xx.xml document.
2.query some information from the x.xml and then form an Html output.
3.summary some information, do some statistics from the x.xml and then form an Html output.
I don't konw which java classes and XSLT functions might be used.(Actually I don't know how/where to start).
Can anyone give me some clue ?
thanks a lot!You must provide XSLT stylesheeds to specify transformations (1), (2),
and (3); let's call those stylesheets task1.xsl and so on.
The following code will transform x.xml into xx.xml according to task1.xsl. It gives you an idea which packages and classes to use, but it doesn't teach you proper Java programming technics :)
import java.io.File;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class Test
public static void main(String[] args) throws Exception
TransformerFactory factory = TransformerFactory.newInstance();
Source config = new StreamSource(new File("task1.xsl"));
Transformer transformer = factory.newTransformer(config);
Source source = new StreamSource(new File("x.xml"));
Result result = new StreamResult(new File("xx.xml"));
transformer.transform(source, result);
}To read about XSLT, see:
http://www.w3.org/TR/xslt
there is a tutorial on using XSLT with Java:
http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/index.html. -
Recently added to DCI's Corporate and e-Business Portals
Conference:
Databases, Portals, Web Services, and XML Integration Magic
When: July 29, 2001, 9:00 AM - 5:00 PM
Where: Hynes Convention Center, Boston
http://www.dci.com/brochure/porbos/seminars.aspRecently added to DCI's Corporate and e-Business Portals
Conference:
Databases, Portals, Web Services, and XML Integration Magic
When: July 29, 2001, 9:00 AM - 5:00 PM
Where: Hynes Convention Center, Boston
http://www.dci.com/brochure/porbos/seminars.asp -
XSLT and XML - Splitting out address data for a single XML item?
Hi,
I am currently having to change my XSLT code for processing XML feeds from the NHS because the technolgy has been moved from SOAP-based to RESTful (both of which mean very little to me!). While most of the XML feeds display correctly I have been unable to resolve the following:
The address data seems to be located under a single item <s.addressLine> rather than <address1>, <address2> <address3> <address4> as in the previous setup. As a consequence of this I am unable to split out my address data into seperate address fields (in column 2 below). The code below ....
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:s="http://syndication.nhschoices.nhs.uk/services">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/">
<table class="xslt_table">
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
<xsl:for-each select="atom:feed/atom:entry">
<tr>
<td><xsl:value-of select="atom:content/s:organisationSummary/s:name"/></td>
<td><xsl:value-of select="atom:content/s:organisationSummary/s:address"/></td>
<td><xsl:value-of select="atom:content/s:organisationSummary/s:address/s:addressLine"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
....generates the following result:
1
2
3
Royal Eye Infirmary
Apsley RoadPlymouthDevonPL4 6PL
Apsley Road
Mount Gould Hospital
Mount Gould RoadPlymouthDevonPL4 7QD
Mount Gould Road
Scott Hospital
Beacon Park RoadPlymouthDevonPL2 2PQ
Beacon Park Road
Peninsula NHS Treatment Centre
20 Brest RoadPlymouthDevonPL6 5XP
20 Brest Road
Derriford Hospital
Derriford RoadCrownhillPlymouthDevonPL6 8DH
Derriford Road
Nuffield Health, Plymouth Hospital
Derriford RoadPlymouthDevonPL6 8BG
Derriford Road
Plympton Hospital
Market RoadPlymouthDevonPL7 1QR
Market Road
St Barnabas Hospital
Higher Port ViewSaltashCornwallPL12 4BU
Higher Port View
Liskeard Community Hospital
Clemo RoadLiskeardCornwallPL14 3XD
Clemo Road
I would be very, very grateful for any thoughts and suggestions on what I might be able to do to resolve this.
Best wishes
SimonThanks dvohra
But in my servlet, I already have the transformer factory defined as follows
public class JDOMServlet extends HttpServlet {
private TransformerFactory tFactory = TransformerFactory.newInstance();
private ResultSet rs = null;
private StreamSource xsltSource;
private Templates template;
public void init(ServletConfig config) throws ServletException {
super.init(config);
ServletContext ctx = config.getServletContext();
try {
//Want to cache the stylesheet for future resuse
//then it doesnt have to be loaded constantly
URL xslURL = ctx.getResource("/WEB-INF/viewStudentDetails.xsl");
System.out.println(xslURL);
xsltSource = new StreamSource(new java.net.URL(xslURL.toString()).openStream());
//xsltSource = new StreamSource(ctx.getResourceAsStream("/Web-inf/viewStudentDetails.xsl"));
template = tFactory.newTemplates(xsltSource);
catch (Exception e) {
e.printStackTrace();
I think the key point is that, this transformation servlet worked fine, when all it was outputting was the xml data, styled in a table. As soon as I enter more table info, (i.e. for the banner and navigation bar), the null pointer exception pops up.
....a lost and puzzled jase....
Thanks again.
JS -
FaceBook and twitter integration problem
My face book and twitter tab are disappear from my notification any one plz guide my
I am having the same problem - both integration tabs have disappeared from my notification center. I know they were there after I upgraded to iOS6 on Friday, but as of yesterday they were gone.
-
SetInterval and XML Load Problem
Hello,
I 'm having the simple problem of making sure the XML is
loaded before beginning the Interval sequence. Therefore it is
missing some of the XML data when loading. See example:
http://alt.coxnewsweb.com/statesman/img/advertising/_jacob/Site1/products.html
I tried a success boolean with the XML onLoad Handler, but my
setInterval stopped working. I could easily just not know how to
properly implement XML onLoad.
Can someone help me out with properly loading the XML
document before the setInterval is initiated.
Thank You - Jacob
Here is the Working Code of the example given...
//New XML Object
var mydata:XML = new XML();
//ignores formatting of XML files tabs, returns, ect.
mydata.ignoreWhite = true;
//Setup onLoad Function
mydata.onLoad = loadXML;
//Loads actual XML Data File
mydata.load("data.xml");
//setInerval Vars
var intervalId:Number;
var count:Number = 1;
var maxCount:Number = 20;
var duration:Number = 100;
//Thumbnail Position Vars
var originalx:Number = 20;
var originaly:Number = 55;
currentx = originalx;
currenty = originaly;
var i:Number = 0;
//Create Thumbnails Interval
function thumbInterval():Void {
//trace(i);
//Controls # of Thumbnails per line
if ((i % 5 == 0) && (i > 0)) {
currenty += 125;
currentx=originalx;
//Attatch Library MC
_root.attachMovie("thumbnailMC", "thumbnailMC" + i, 1000 +
i);
//Load Image, text, and position
_root["thumbnailMC" + i].thumbnailname =
mydata.firstChild.childNodes
.childNodes[0].firstChild.nodeValue;
_root["thumbnailMC" + i].textbox.productdescr =
mydata.firstChild.childNodes.childNodes[1].firstChild.nodeValue;
_root["thumbnailMC" + i]._x = currentx;
_root["thumbnailMC" + i]._y = currenty;
currentx += 130;
i++
if(count >= maxCount) {
clearInterval(intervalId);
count++;
intervalId = setInterval(this, "thumbInterval",
duration);Please use the attach code option to post your code. bracket
i bracket is seen as italic by this forum.
And where is the loadXML function?
The xml is loaded when the onLoad event gets fired. Your
loadXML() is the place where you want to call a function that
initiates the interval. -
Help needed with Java 1.4 and xml Runtime problem
I am working on a java 1.3 and JAXP1.1 written code. Now I want to compile and run it using J2SE 1.4. Here are the import statements from the existing code.
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.Locator;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import java.sql.*;
import java.net.*;
import java.io.*;
When I run the existing(using java 1.3 and Jaxp1.1) code I have to include the files crimson.jar and jaxp.jar in the windows 2000 CLASSPATH and works fine.
But when I compile and run it using J2SE 1.4 which has the built in support for the saxp, I thought that I don't have to specify any CLASSPATH for the new 1.4 so I don't specify any Classpath and it gives me the Microsoft "ClassFactory cannot find the requested class" error which means that even thought the new java 1.4 has the xml classes as libraries yet it still requies some .jar files to be listed in the CLASSPATH.
If I am right then what path will work(i.e what jar class I need to add to the CLASSPATH).
Thanks for your help.
RA.Thanks for your reply,
I think I didn't specify when the error occurs. The ClassFactory related error occurs when I run the program, it compiles without any error.
From what I understood somewhere in the java 1.4 docs, that the new 1.4 has the xml libraries built in by default so one doesn't need to give the classpaths just like we don't give any CLASSPATH for using swing and many of the other java packages. That is one thing.
Second thing is that I also tried to use the java_xml_pack-spring02 and java_xml_pack-summer02; but non of them include the crimson.jar and the jaxp.jar files in them which are the 2 .jar files that makes the program run fine when used under the java 1.3 with combination of the jaxp1.1(which was downloaded seperately and then the CLASSPATH for it was set.).
Can you please help what .jar files do I need to use instead. I tried to use the ones that the new java_xml_pack-spring02 and java_xml_pack-summer02 has for the jaxp in them.
Thanks again.
RA -
Hi every one,
This problem persistes to both MM and BW in our project
In MM we need to fing out certain fields and tables for which condition records are available in SAP. For this we need to map and find the relation between tables and fields in order to extract the data by extractor in BW.
For one of the tables and fileds in Vendor i.e
1. Characteristic - CABN - ATNAM
2. Characteristic Value - CAWN - ATWRT
3. Vendor Name - ADDR1_DATA - NAME1
For these I need to map these fileds and need to find out the relation for other tables as well like EKPO and EKKO.
But I am unable to find out relation between for example EKPO, EKKO, CAWN and CABN. Can anyone explain me wr and how can I find out the relation. Since so far ADDR1_DATA is a structure, from this how can we find out the fileld NAME1 in which table and how that table is linked to CABN or CAWN
Please guys this is an urgent, your immediate repond is highly appreciate.
Thanks in advance
chanduHi
This is mainly for procurement by vendor characteristic. As i explained previously main tension for this is need to extract conditon records for the available data elemts in MM. As far as MM concern they configured certain dataelements and for this, certain condition records of particular structure or table are stored & available in certain tables in data dictionary.
for Ex:
1.like ADDR1_DATA(Vendor Name- NAME1) are being maintained in table ADRC,
2.characteristis and char values in CABN & CAWN resp'
3. PO and INVOICE data elements in EKKO - BEDAT, EKPO - NAME1.
And for the above mentioned tables and fields, we need to find relation b/w these tables, so that mappping and extraction of condition records will be done.
For Ex: In EKKO & EKPO these tables are related based on EBELN avialable in both of the tables which is a key field, like wise I am not able to find relation between CABN,CAWN and EKKO or EKPO.
I need to join these tables so that extraction is possible
This will be an clear question I hope
regards
chandu -
Bi 7.0 and MDM integration problem
will it be possible to do seperate application of MDM built on BI 7.0 application in the single server which will result to provide set of tables .
As per requirement in BI we have to consolidate and harmonise of master data as a whole.
Edited by: shaik sarfraz on Oct 15, 2008 10:26 AMDear,
Plz chk:
http://portal.acm.org/ft_gateway.cfm?id=355306&type=pdf&dl=GUIDE&dl=ACM
http://www.redbooks.ibm.com/redbooks/pdfs/sg246489.pdf
http://www.cio.sc.gov/SCEA/eap/All_Enterprise-Applications.pdf
http://www.sap.info/public/INT/int/glossary/int/glossaryletter/Word-38053d4a869829887_glossary/S
http://www.inforte.com/ideas/points_of_view/content/pov_integratedplanningbusinesscontent.pdf
http://www.esri.com/news/arcnews/fall06articles/sap-and-esri.html
Thanks -
Anyone got any links to introduction courses to XSLT and XML?
cheers
An Introduction to XML for Developers
http://suned.sun.com/US/catalog/courses/WP-1501-90.html
XML Fundamentals for Developers
http://suned.sun.com/US/catalog/courses/WP-1502-90.html
Applying the Extensible Markup Language (XML)
http://suned.sun.com/US/catalog/courses/WP-1503-90.html -
Defining XSLT from Abap to XML and XML to Abap (Internal Table)
Hi Experts, I need help with this XSLT for call transformation. I have defined an internal table and intend to use it as a source for Call Tranformation. But I have a Problem defining its XSLT and help would be greatly appreciated! I also wonder if this XSLT can be used for XML to internal table? Or do I have to define another XSLT again.... Hope to hear from any of u soon!
CODES->>>
TYPES: BEGIN OF CONTENT,
CONTENT1(20),
CONTENT2(20),
END OF CONTENT.
TYPES: T_CONTENT TYPE TABLE OF CONTENT.
DATA: BEGIN OF I_DATA OCCURS 0,
KEY1(10),
KEY2(10),
CONT TYPE T_CONTENT,
END OF I_DATA.
DATA: WA_TBL TYPE CONTENT.
DATA: LI_TBL TYPE T_CONTENT.
START-OF-SELECTION.
populate data 1
CLEAR I_DATA.
I_DATA-KEY1 = 'AMI'.
I_DATA-KEY2 = 'LEE'.
CLEAR WA_TBL.
REFRESH LI_TBL.
WA_TBL-CONTENT1 = 'PENHAS ROAD'.
WA_TBL-CONTENT2 = 'SG'.
APPEND WA_TBL TO LI_TBL.
WA_TBL-CONTENT1 = 'GILLMAN ROAD'.
WA_TBL-CONTENT2 = 'SG'.
APPEND WA_TBL TO LI_TBL.
I_DATA-CONT = LI_TBL.
APPEND I_DATA.
populate data 1
CLEAR I_DATA.
I_DATA-KEY1 = 'KAI'.
I_DATA-KEY2 = 'LEE'.
CLEAR WA_TBL.
REFRESH LI_TBL.
WA_TBL-CONTENT1 = 'SUNSET WAY'.
WA_TBL-CONTENT2 = 'SG'.
APPEND WA_TBL TO LI_TBL.
WA_TBL-CONTENT1 = 'BEDOK NORTH'.
WA_TBL-CONTENT2 = 'SG'.
APPEND WA_TBL TO LI_TBL.
I_DATA-CONT = LI_TBL.
APPEND I_DATA.
call transformation (xslt)
source i_data = i_data
result xml xmlstr.here is the code sample using ixml library .
just create a report program and copy paste the following code.
if time permits, later on i will post the xslt program which you can use it call transformation.
REPORT y_test_xml.
DATA: l_ixml TYPE REF TO if_ixml,
l_ixml_sf TYPE REF TO if_ixml_stream_factory,
l_istream TYPE REF TO if_ixml_istream,
l_ostream TYPE REF TO if_ixml_ostream,
l_booklist TYPE REF TO if_ixml_element,
l_document TYPE REF TO if_ixml_document,
l_parser TYPE REF TO if_ixml_parser,
l_root_element TYPE REF TO if_ixml_element,
l_book_record TYPE REF TO if_ixml_element,
l_date TYPE REF TO if_ixml_element ,
l_time TYPE REF TO if_ixml_element ,
l_book_group TYPE REF TO if_ixml_element,
l_book_cat TYPE REF TO if_ixml_element ,
others TYPE REF TO if_ixml_element ,
link TYPE REF TO if_ixml_element ,
description TYPE REF TO if_ixml_element ,
xml TYPE xstring ,
size TYPE i ,
l_xml TYPE REF TO cl_xml_document .
DATA: xml_out TYPE string ,
temp_string TYPE string .
TYPES: BEGIN OF add_category,
category_id(10),
category_desc(40),
END OF add_category,
add_t_category TYPE add_category OCCURS 0 .
TYPES: BEGIN OF add_book_grp,
book_category TYPE add_t_category,
END OF add_book_grp,
add_t_book_grp TYPE add_book_grp OCCURS 0.
TYPES: BEGIN OF add_book,
book_num(10) TYPE c,
short_desc(40) TYPE c,
book_group TYPE add_t_book_grp,
END OF add_book,
add_t_book TYPE add_book OCCURS 0.
TYPES: BEGIN OF type_data,
date TYPE sy-datum,
time TYPE sy-uzeit,
book_record TYPE add_t_book,
END OF type_data.
DATA: i_data TYPE type_data OCCURS 0 WITH HEADER LINE.
DATA: itab LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: cat_wa TYPE add_category ,
bk_gp_wa TYPE add_book_grp ,
bk_rec_wa TYPE add_book ,
bk_wa LIKE LINE OF i_data .
DATA: cat_tab TYPE STANDARD TABLE OF add_category ,
bk_gp_tab TYPE STANDARD TABLE OF add_book_grp ,
bk_rec_tab TYPE STANDARD TABLE OF add_book .
MOVE: '03' TO cat_wa-category_id ,
' BK GP 3' TO cat_wa-category_desc .
APPEND cat_wa TO cat_tab .
MOVE: '02' TO cat_wa-category_id ,
' BK GP 2' TO cat_wa-category_desc .
APPEND cat_wa TO cat_tab .
bk_gp_wa-book_category = cat_tab.
APPEND bk_gp_wa TO bk_gp_tab .
MOVE: '0012345678' TO bk_rec_wa-book_num ,
'OMS book' TO bk_rec_wa-short_desc .
bk_rec_wa-book_group = bk_gp_tab .
APPEND bk_rec_wa TO bk_rec_tab .
CLEAR:bk_gp_tab, cat_tab .
REFRESH :bk_gp_tab, cat_tab .
MOVE: '01' TO cat_wa-category_id ,
' BK GP 1' TO cat_wa-category_desc .
APPEND cat_wa TO cat_tab .
MOVE: '09' TO cat_wa-category_id ,
' BK GP 9' TO cat_wa-category_desc .
APPEND cat_wa TO cat_tab .
bk_gp_wa-book_category = cat_tab.
APPEND bk_gp_wa TO bk_gp_tab .
MOVE: '00123456789' TO bk_rec_wa-book_num ,
'SAP book' TO bk_rec_wa-short_desc .
bk_rec_wa-book_group = bk_gp_tab .
APPEND bk_rec_wa TO bk_rec_tab .
MOVE: sy-datum TO bk_wa-date ,
sy-uzeit TO bk_wa-time .
bk_wa-book_record = bk_rec_tab .
APPEND bk_wa TO i_data .
CLEAR: cat_wa , bk_gp_wa ,bk_rec_wa , bk_wa .
l_ixml = cl_ixml=>create( ).
l_ixml_sf = l_ixml->create_stream_factory( ).
l_document = l_ixml->create_document( ).
l_root_element = l_document->create_element( name = 'asx:abap' ).
l_root_element->set_attribute( name = 'xmlns:asx' value = 'http://www.sap.com/abapxml' ) .
l_root_element->set_attribute( name = 'version' value = '1.0' ).
l_document->append_child( new_child = l_root_element ).
others = l_document->create_simple_element( parent = l_root_element name = 'asx:values' ).
l_booklist = l_document->create_simple_element( parent = others name = 'BOOKLIST' ).
LOOP AT i_data INTO bk_wa .
CLEAR temp_string .
MOVE: bk_wa-date TO temp_string .
l_date = l_document->create_simple_element( parent = l_booklist name = 'DATE' value = temp_string ).
CLEAR temp_string .
MOVE: bk_wa-time TO temp_string .
l_time = l_document->create_simple_element( parent = l_booklist name = 'TIME' value = temp_string ).
LOOP AT bk_wa-book_record INTO bk_rec_wa .
l_book_record = l_document->create_simple_element( parent = l_booklist name = 'BOOK_RECORD' ) .
CLEAR temp_string .
MOVE: bk_rec_wa-book_num TO temp_string .
l_date = l_document->create_simple_element( parent = l_book_record name = 'BOOK_NUM' value = temp_string ).
CLEAR temp_string .
MOVE: bk_rec_wa-short_desc TO temp_string .
l_time = l_document->create_simple_element( parent = l_book_record name = 'SHORT_DESC' value = temp_string ).
l_book_group = l_document->create_simple_element( parent = l_book_record name = 'BOOK_GROUP' ).
LOOP AT bk_rec_wa-book_group INTO bk_gp_wa .
LOOP AT bk_gp_wa-book_category INTO cat_wa .
l_book_cat = l_document->create_simple_element( parent = l_book_group name = 'BOOK_CATEGORY' ).
CLEAR temp_string .
MOVE: cat_wa-category_id TO temp_string .
l_date = l_document->create_simple_element( parent = l_book_cat name = 'CATEGORY_ID' value = temp_string ).
CLEAR temp_string .
MOVE: cat_wa-category_desc TO temp_string .
l_time = l_document->create_simple_element( parent = l_book_cat name = 'CATEGORY_DESC' value = temp_string ).
ENDLOOP .
ENDLOOP .
ENDLOOP .
ENDLOOP .
l_ostream = l_ixml_sf->create_ostream_xstring( xml ).
l_document->render( ostream = l_ostream ).
CREATE OBJECT l_xml.
CALL METHOD l_xml->parse_xstring
EXPORTING
stream = xml.
l_xml->render_2_string(
EXPORTING
pretty_print = 'X'
IMPORTING
* RETCODE = RETCODE
stream = xml_out
size = size
CALL METHOD l_xml->display.
Hope this is helpful.
do let us know how it goes.
Regards
Raja -
DB, XML, XSLT - I have a problem, HELP
Hi Friends!!
I have a problem and I need your help guys. I was wondering if there is any tool I can use to minimize my Data Base troubles. I work with 3 DataBases (Oracle, DB2, SQLServer) and I have to re-write almost all my SQL code 3 times. I think I could use XML and XSLT and make some magic like the Java magic of "Write once, runs anywhere". Does anyone know what I have to do to solve my problem ??
Thanks a lot my friends
CleversonOracle XML SQL Utility -- XSU converts a xml to a
oracle database.
http://otn.oracle.com/tech/xml/oracle_xsu/content.html
DB2 XML Extender converts xml to a db2 database.
http://www-3.ibm.com/software/data/db2/extenders/xmlext
Another question if I may,
I am looking for a general tool (using JDBC) to extract data from a genral data base (I need inofmrix, oracle, sqlserver, db2 and more) into xml file. I need it to be an effecient also and not create DOM documents. Do you know about a tool like this (maybe an open source?).
Thank you very much,
David -
Import XML, apply XSLT and embed images
Hi everyone. I've been looking for days now about a way to export the content of a website as XML and import it then into InDesign, involving some basic text formatting and maybe links, lists and tables. Getting a XML version of a website isn't actually the problem. But including some InDesign readable formatting structure caused me some headache.
First of all, I used InDesign from CS2 and read a lot about INX structure, XML Namespaces and Tagged Text. None of what I did seemed to result in any acceptable or properly working import. So I've read about CS3 having a new feature of applying XSL Stylesheets when importing a XML file and finally downloaded a trial version to test this out. Problem is, I can't find any helpful documentation on how to use this feature right. Neither in the web nor in your forums.
So how does a XSL file have to look like in order to import XML with some basic formatting?
Let's say the XML looks like this, very simple:
] <?xml version="1.0" encoding="UTF-8"?>
] <?xsl-stylesheet type="text/xsl" href="style.xsl"?>
] <root>
] <text>
] <bold>This text is bold</bold> and <italic>this seems to be italic</italic>.
] </text>
] <underline>I'm under the line</underline>
] </root>
How does my XSLT code in "style.xsl" have to look like in order to tell InDesign that the content of <bold> has to be bold, the one of <italic> italic and leaving <underline> underlined?
I tried placing Tagged Tags around the content with XSL but this just resulted in errors or plain text output in InDesign. I also tried to understand the magical code structure of INX, but left it behind until I recognized how complex it is.
Until now, only Tagged Tags do what they shall do for me. Only problem is, the file with this Tagged Tags has to be TXT, but I want XML. Isn't there any way to apply a XSL file over a XML file and replace the XML tags with some Tagged Tags, and finally import everything successful into InDesign? I tried something like that and told the XSL to output the file as Text with
i <xsl:output method="text" />
but InDesign replies with an error as "text" is not valid for DOM structuring.
Moreover, another problem is with importing images without having them saved on the local machine. Meaning, how to send images embed in XML files?
Here I also tried many things like <![CDATA[base64-code-here]]> and so on, but never happened to tell InDesign that it has to do something with this code instead of just displaying it. Using
i <image href="data:image/jpeg;base64,base64-code-here" />
or anything alike didn't work at all.
In the end, I want to allow downloading a XML version of the viewed site on my website which can be imported into InDesign with all basic formatting used on the site itself. Getting the XML file prepared is just a matter of some PHP scripting. Now I only have to know what InDesign can actually read, and of course, if InDesign is even able to do anything of what I've planned.
I hope someone can help me.
Thank you very much in advance, DanXSL will re-arrange incoming XML so that you can flow the XML into an InDesign document that may be arranged differently than the incoming XML file. You still need to set up tags and associate those tags with styles in order to achieve what you want. You can use Maivald's "A Designer's Guide to Adobe InDesign and XML: Harness the Power of XML to Automate your Print and Web Workflows" as a starting point, but you will need to play with the pieces to figure it out.<br /><br />For your simple example, you will need to set up tags in text frames for <bold> and <italic>, create paragaph (or object) styles of [bold] and [italic] and then associate those styles with the tags. Only then can you import the XML file and have things work. InDesign has no pre-defined knowledge of what any XML tag means, even when the meaning seems obvious. You are free to define your <bold> XML tag to mean italic text, for example.<br /><br />Though I've read through the Maivald book and converted a Spanish cookbook to English (as a gift for my mom), I am not by any means overly knowledgeable here. It could well be that there are many ways to achieve the goal and I only know one, lol.<br /><br />Hope this helps.
-
BE 3000 with Jabber (for Mac) and webex connect integration problems
Hi,
This is my first question on the forum so please be gentle!
I have a customer who has a Business Edition 3000 and they have purchased WebEx connect and Jabber integration to go with it.
My problem is I am having difficulty getting the setup to work and I have a number of questions on how to set this up. Most of the docs on Cisco's website seem to be related to either CUCME or full CUCM, but not a lot on BE 3000. My questions are below:
1. I have been reading the documentation for WebEx connect and it states to set the IP address of the BE 3000 server in the Configuration>Additional Services>Unified Communications>Voicemail tab. This is currently on the network with a 192.168.x.x address however. My predecessor put this IP address in the WebEx configuration page but I'm not sure this will work with a private IP as I don't know how this communicates back. The documentation isn't very clear on this. Does this have to be a public IP address / FQDN for it to work?
2. Are there any SRNDs for this type of setup that could help? Again, looking through the website hasn't turned anything up yet.
Note:
we are using the following software:
Jabber for MAC:
uc-client-mac-8.6.7.20127.fcs.zip
MAC OS:
OSX 10.8.3
BE 3000:
MCS7890C1-BE8
8.6.4.10000-15.
Thanks in advance for any help.
Regards,
JasonHi - I have done this via the admin portal but still cannot get the Jabber client for Mac to register for voice. The Windows version works fine for the same user and CUCM device. Are there any other settings that need to be enabled specific to the Mac client?
Thanks. -
Problems with reports and XML-publisher - No XML
Hi!
I'm having a problem with Apps and XML-publisher. I made a report file, which queries some views. When executing in reports, I get all the data I expect.
Now, when I upload the reportfile to Apps and let it generate XML, my xml-file is empty (well, almost empty)
<?xml version="1.0" ?>
<!-- Generated by Oracle Reports version 6.0.8.27.0 -->
<T03501684>
<LIST_G_PERSOON>
<LIST_G_PERSOON />
</T03501684>
Anyone who can shed any light upon this problem?OK, finally solved the problem... A good night's sleep always helps ;).
After just trying each queried table one after an other, I found the problem:
The difference between Oracle Apps (Dutch locale) and the reports builder (English) is the language... And our functional people have changed some names, but the Dutch ones, leaving the english names in place and one of the tables I query has language specific data, which is also appears in a where clause.
Maybe you are looking for
-
PR need to generate for Service material in third party process
Dear All Is it possible to create Service PR for the service material in sale order like third party material.process Please suggest how to configure the same? Regards
-
SoundBlaster 5.1 not working in Windows 7
)SoundBlaster 5. not working in Windows 7E Hello all, I installed a SoundBlaster 5. VX sound card into my system: A Fujitsu-Siemens Celsius M430, 3.4 GHz Intel processor, 2GB of RAM and a fresh installation of Windows 7 Ultimate (retail version). I i
-
BMW 335i ipod interface connection problem with ipod classic 80GB
Hi all, i have a 2007 BMW 335i with dealer installed ipod interface, and i been using it since, it's simply i just connect ipod with the cable in the glove compartment and leave it there, and it charges and stanby, when i start up the car the audio j
-
Manual Test Script to test iDoc in SD
Hi all Can you please guide me as to how i should write a manual test script in SD to execute a test for iDocs. Regards Hema
-
Latest Adobe flash wont load correctly on Mac OSX 10.5.8
Any Advice? I have successfully uninstalled the former Adobe Flash...after the new one downloads,i get verification failed..tryed 6 times