XML, jdom problem

Hello Java-People,
I am having a problem with Java and XML using the jdom package (www.jdom.org).
An exception
(java.lang.NoClassDefFoundError: org/xml/sax/SAXNotRecognizedException
     at YAAFile.openXMLDataFile(YAAFile.java:161))
is thrown.
I use java 1.4.1_01 on MacOS X (10.2.6). My IDE is Project Builder.
The following classes are involved:
YAAObject: stores my data in bean style with setters and getters, only used to hold the data.
YAAFile: holds the YAAObject instances in a vector and saves them in a xml file, opens xml file and returns the objects to other classes.
A third class that holds the YAAFile class.
1st test scenario:
My class YAATest calls:
YAAFile f1 = new YAAFile();
f1.openXMLDataFile();
YAAObject[] array = f1.returnYAAObjectArray();
for (int i = 0; i < array.length; i++){
array.outputData();
This works fine. The outputData() method puts the content via System.out.println() on the console.
2nd (application) scenario:
My class YouAreAl calls:
(above) YAAFile currentYAAFile;
currentYAAFile = new YAAFile();
currentYAAFile.openXMLDataFile();
Does not work. I get the output:
java.lang.NoClassDefFoundError: org/xml/sax/SAXNotRecognizedException
     at YAAFile.openXMLDataFile(YAAFile.java:161)
     at YouAreAl.<init>(YouAreAl.java:173)
     at YouAreAl.main(YouAreAl.java:260)
     at java.lang.reflect.Method.invoke(Native Method)
     at apple.launcher.LaunchRunner.run(LaunchRunner.java:88)
     at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
     at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)
-[NSJavaVirtualMachine initWithClassPath:] cannot instantiate a Java virtual machine
YouAreAl has exited with status 0.
Both scenarios execute the following code at the openXMLDataFile() method:
protected void openXMLDataFile(){
builder = new SAXBuilder(); //here the exception is thrown!
Document doc = null;
try{
doc = builder.build(DataFileName);
catch (JDOMException e)
System.err.println("JDOMException openXMLDataFile 1");
System.err.println(e.getMessage());
catch (IOException e)
System.err.println("IOException openXMLDataFile 3");
System.err.println(e.getMessage());
...and so on...
The exception is thrown at line:
builder = new SAXBuilder();
As both scenarios execute the same piece of code I do not understand where the difference is.
I have the jdom.jar in the Library/Java/Extensions directory.
In my opinion builder wants to throw the SAXNotRecognizedException but can not find it. The point is why does it not word in the second scenario when everything is fine in the first one?
If there is anyone out there having a deeper understanding of this matter, please give me a hint.
Thanks in advance
Tobias

Hi people,
I found the problem. I'll post it here in case anyone runs into the same kind of problem.
The reason for the exception was not the source code but the built product.
Scenario one built a .jar file and it worked just fine.
Scenario two built an .app file and it threw an exception.
When compiling scenario two on the console it ran fine as well. So thr problem seems to lie either in the packaging or the IDE. It looks as if you are not allowed to use extensions when packaging your class files as an .app
So I'll stick with jar files for a while...
Regards,
Tobias

Similar Messages

  • Txt to xml. Problems with characters(&, , ',...)

    I want to generate a xml file with text from a txt file but i have problems with special characters such as &, <... I'd like to know if there�s any class or library to filter the text in order to generate my xml without problems.
    Thank you.

    Use JDOM to generate your XML. It will worry about escaping issues for you.
    Here's a (probably rather inelegant) example for you to play around with:
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.*;
    public class DateBoom {
         public static void main(String[] args)
              throws Exception
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();
              String dodgyText = "< & '";
              Document document = builder.newDocument();
              Element root = document.createElement("root");
              root.setAttribute("dodgy",dodgyText);
              document.appendChild(root);
              Element child = document.createElement("child");
              root.appendChild(child);
              child.appendChild(document.createTextNode(dodgyText));
              Transformer transform = TransformerFactory.newInstance().newTransformer();          
              Source source = new DOMSource(document);
              Result result = new StreamResult(System.out);
              transform.transform(source,result);
    }Your alternative is to use something like String regular expressions (regex) to do this manually, but the XML oriented libraries will catch more corner cases than you're likely to anticipate, making them more reliable.

  • WIJ 20002 xml Parser Problem - Rich Client

    Hi,
    I have a problem with the rich client on a new installation:
    Business Objects Enterprise XI 3.1 SP3 on Windows 2008 Standard.
    If I connect with the rich client "import document"is disabled.
    if I try to create a new document from the rich client it returns the error below (I used the rich client on two workstations):
    WIJ 20002
    Version: null
    Analisi dello stack:
    java.lang.RuntimeException: java.lang.RuntimeException: XML parser problem:
    XMLJaxpParser.parse(): Element type "ABOUT_Patentnumbers" must be followed by either attribute specification, ">" or "/>".
    at com.businessobjects.wp.xml.jaxp.XMLJaxpParser.parse (Unknown Source)
    at.com.businessobjects.webi.richclient.XMLviaOccaRC.getServerConfiguration (Unknown Source)
    Have you any solution?

    The fixpack 3.5 client resolves the problem.

  • XML - ExportDocument problem

    I'm exporting a xml document that I'm creating dynamically in my application.
    I'm having the following problems (working with 30M.2).
    1)
    It's not possible to edit a DTD (or creating one run time) so I have to write a
    template doc XML to have it.
    I'm afraid that this is a costraint on the DOM1 so ...
    2)
    Once I complete the construction of the doc, I need to write it down (let's say
    on a file, but could be also in memory to send it on http).
    When I write it (using exportdocument function) I just find the root element
    with all it's children, no haeder (<?xml version="1.0" ?><!DOCUMENT ...>) so I
    cannot have the dtd information on the stream, and cannot enforce validation of
    the doc when someone read it afterwards.
    I admit I'm new of the subject, but or I miss something or something is wrong:
    having trouble to get a dtd and not being able to code it's information.
    Anyone has some ideas?
    TIA
    Luca

    I'm interested in DTDs. For example in the reported situation, why, if you
    know you've created a valid XML document would you want to give a DTD to
    someone at the other end? If someone has a DTD at the other end and want to
    use it to validate your XML then fine but if you create the XML and are
    controlling the format then wouldn't they just assume the XML correct if the
    DTD wasn't being controlled by a 3rd party or themselves?
    DTDs don't help you create a document but just validate it, I'd thought. If
    there is more to DTDs I'd appreciate if someone felt like ellaborating.
    Thanks.
    Matthew Middleton
    OrYx Software Consultant
    Lawpoint Pty. Limited
    A Solution 6 Company
    Ph: +61 2 9239 4972
    Fax: +61 2 9239 4900
    E-mail matthewmwriteme.com
    ----- Original Message -----
    From: Luca Gioppo <Luca.GioppoCSI.IT>
    To: <forte-userslists.xpedior.com>
    Sent: Tuesday, August 08, 2000 8:24 PM
    Subject: (forte-users) XML - ExportDocument problem
    >
    >
    I'm exporting a xml document that I'm creating dynamically in myapplication.
    I'm having the following problems (working with 30M.2).
    1)
    It's not possible to edit a DTD (or creating one run time) so I have towrite a
    template doc XML to have it.
    I'm afraid that this is a costraint on the DOM1 so ...
    2)
    Once I complete the construction of the doc, I need to write it down(let's say
    on a file, but could be also in memory to send it on http).
    When I write it (using exportdocument function) I just find the rootelement
    with all it's children, no haeder (<?xml version="1.0" ?><!DOCUMENT ...>)so I
    cannot have the dtd information on the stream, and cannot enforcevalidation of
    the doc when someone read it afterwards.
    I admit I'm new of the subject, but or I miss something or something iswrong:
    having trouble to get a dtd and not being able to code it's information.
    Anyone has some ideas?
    TIA
    Luca
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

  • !DOCTYPE !ENTITY war file xml splitting problem

    Hi,
    I am trying to split a file - struts-config.xml - which eventually gets
    located into my war file.
    Here is the xml file.
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
    Configuration 1.0//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
    <!ENTITY struts_FormBeans SYSTEM "./struts_FormBeans.xml">
    <!ENTITY struts_GlobalForwards SYSTEM
    "./struts_GlobalForwards.xml">
    <!ENTITY struts_ActionMappings SYSTEM
    "./struts_ActionMappings.xml">
    >
    The problem that I run into is that the xml parser at deploy time cannot
    locate the struts_FormBeans.xml file which is located in the same place as
    the struts-config.xml file.
    Does anyone know a way to tell it to look in the war file?
    or Does anyone know a better place to post a question like this?
    Thanks in advance!!

    The problem that I run into is that the xml parser at deploy time cannot
    locate the struts_FormBeans.xml file which is located in the same place as
    the struts-config.xml file.Uh-uh. Ran into this also.
    Does anyone know a way to tell it to look in the war file?Not me, but I wish I could.
    or Does anyone know a better place to post a question like this?This seems more like a Struts issue to me. Look here:
    http://marc.theaimsgroup.com/?l=struts-user&m=100016330124990
    and follow the thread. Someone suggested a patch to the ActionServlet, I
    haven't tried it yet. It sounds good and will probably do what you want.
    --Renaud
    "IH" <[email protected]> wrote in message news:[email protected]..
    Hi,
    I am trying to split a file - struts-config.xml - which eventually gets
    located into my war file.
    Here is the xml file.
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
    Configuration 1.0//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
    <!ENTITY struts_FormBeans SYSTEM "./struts_FormBeans.xml">
    <!ENTITY struts_GlobalForwards SYSTEM
    "./struts_GlobalForwards.xml">
    <!ENTITY struts_ActionMappings SYSTEM
    "./struts_ActionMappings.xml">
    >
    The problem that I run into is that the xml parser at deploy time cannot
    locate the struts_FormBeans.xml file which is located in the same place as
    the struts-config.xml file.
    Does anyone know a way to tell it to look in the war file?
    or Does anyone know a better place to post a question like this?
    Thanks in advance!!

  • Parsing a XML file using Jdom-Problem.

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    LOL
    This is what you get for working 12 hours straight....
    I changed:
    xmlObject["mydoc"]["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]<br>
    to:
    #mydoc["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]#<br>
    xmlObject is the name of my xml object in memory, and then you reference from the root of the xml doc down the chain.
    Sorry for the inconvenience,
    Rich

  • Parsing a XML using Jdom --- Problem pls help

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • XSLT usage with JDOM problem

    When I try to do an XSL transformation on a JDOM tree
    using Oracle's xml classes from xmlparserv2.jar (includes
    the javax.xml.transform api) I get the following:
    java.lang.ClassCastException: org.jdom.transform.JDOMSource$DocumentReader
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:201)
    The same code works with xalan/crimson as well as saxon/aelfred, anyone
    seen this and knows a solution? Code snippet:
    private Frame transform(Document in, URL stylesheet) {
         TransformerFactory f = TransformerFactory.newInstance();
         InputStream s = stylesheet.openStream();
         Transformer transformer = f.newTransformer(new StreamSource(s));
         JDOMResult out = new JDOMResult();
         out.setFactory(new FPLNodeFactory());
         transformer.transform(new JDOMSource(in), out);
         s.close();
         return (Frame)out.getDocument().getRootElement().detach();
    I was wondering if there is a problem with the Oracle's impelmentation or am I using it incorrectly.
    Thanks.
    Suhas.

    This forum is mostly reviewed by folks using the XML features in the database (which basically means version 9.2). This is an XDK question--I would post it to Technologies > XML > General.

  • 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

  • XML parsing problem

    Hi, my problem is :
    In my Application i want to parse an XML file with DOM parser. The problem is that in my Project "MyProject -> Project Properties -> Libraries and Classpath"
    I have included some 15 libraries which are useful for my Application: ADF Faces Runtime 11, ADF Web Runtime and etc.
    Problems are causing the libraries: BC4J Runtime,ADF Model Runtime, MDS Runtime Dependencies
    because when added my source which is parsing an XML file stops working.The source code is:
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    File file =
    new File("C:\\Documents and Settings\\ilia\\Desktop\\begin.xml");
    Document doc = db.parse(file);
    Element root = doc.getDocumentElement();
    NodeList dots = root.getElementsByTagName("w:t");
    Element firstDot = (Element)dots.item(0);
    String textValue = firstDot.getFirstChild().getNodeValue();
    I use DOM because i need to change some values in the XML file, but its not working neither for reading nor for writing.When debugging I see that it gets the root of the xml but " firstDot.getFirstChild().getNodeValue() " returns null and it breaks with NullPointerException. And that's only when the libraries mentioned above are added to the project. Without them it works just fine !
    I don't know, it's like when added the parser validates my xml against some schema and returns null.
    The xml file is very simple MS Word Document saved as .xml .But I don't think that's the problem.
    Thanks in advance !
    iliya

    Hi all,
    I found the solution to my problem.The right way to parse and change an XML file with DOM parser using the Oracle XML Parser v2 should look like this:
    JXDocumentBuilderFactory factory =
    (JXDocumentBuilderFactory)JXDocumentBuilderFactory.newInstance();
    JXDocumentBuilder documentBuilder =
    (JXDocumentBuilder)factory.newDocumentBuilder();
    File file = new File("c:/Documents and Settings/ilia/Desktop/begin.xml");
    InputStream input =
    new FileInputStream(file);
    XMLDocument xmlDocument = (XMLDocument)(documentBuilder.parse(input));
    System.out.println("Encoding: " + xmlDocument.getEncoding());
    System.out.println("Version: " + xmlDocument.getVersion());
    NodeList namespaceNodeList =
    xmlDocument.getElementsByTagNameNS("http://schemas.microsoft.com/office/word/2003/wordml","t");
    XMLElement namespaceElement17 = (XMLElement)namespaceNodeList.item(17);
    namespaceElement17.getFirstChild().setNodeValue("someString");

  • XML Parsing - problem with a value of an element if starting with space

    Hi Experts,
    I need your valuable guidence to get out of a problem in parsing an XML file.
    An XML file is read into xstring variable and it is processed to be split into the corresponding itab.
    Please find the code below
    types: begin of ty-itab,
                field(4096),
              end of ty-itab.
    Data:
    g_ixml                       TYPE REF TO if_ixml,
    g_ixmldocument               TYPE REF TO if_ixml_document,
    g_ixmlstreamfactory          TYPE REF TO if_ixml_stream_factory,
    g_ixmlstream                 TYPE REF TO if_ixml_istream,
    g_ixmlparser              TYPE REF TO if_ixml_parser,
    g_ixmlnodemainlist        TYPE REF TO if_ixml_node_list,
    g_ixmlnodelistmainelement TYPE REF TO if_ixml_node_list,
    g_sxmldata                TYPE string,
    g_ixmlnode                TYPE REF TO if_ixml_node.
      DATA: wa_xmltab TYPE xstring,
                itab type table of ty-itab.
    OPEN DATASET l_file IN BINARY MODE FOR INPUT MESSAGE v_msg.
    READ DATASET l_file INTO wa_xmltab.
    PERFORM f_create_xmltable USING wa_xmltab
                                  CHANGING v_msg.
    IF NOT v_msg IS INITIAL.
          msg = v_msg.
          EXIT.
        ELSE.
          itab[] = it_xmldata[].
        ENDIF.
    CLOSE DATASET l_file.
    Subroutine to convert xstring to char type ITAB.
    FORM f_create_xmltable USING  value(pi_inputxmlstring) TYPE xstring
                           CHANGING v_msg.
    *-- create the main factory
      g_ixml = cl_ixml=>create( ).
    *-- create the initial document
      g_ixmldocument = g_ixml->create_document( ).
    *-- create the stream factory
      g_ixmlstreamfactory = g_ixml->create_stream_factory( ).
    *create input stream
      g_ixmlstream = g_ixmlstreamfactory->create_istream_xstring( string =
    pi_inputxmlstring ).
    *-- create the parser
      g_ixmlparser = g_ixml->create_parser( stream_factory =
    g_ixmlstreamfactory
                                      istream        = g_ixmlstream
                                      document       = g_ixmldocument ).
    *-- parse the stream
      IF g_ixmlparser->parse( ) NE 0.
    *if parser cannot be created then give error exit
        IF g_ixmlparser->num_errors( ) NE 0.
          EXIT.
        ENDIF.
      ENDIF.
    *-- we don't need the stream any more, so let's close it...
      CALL METHOD g_ixmlstream->close( ).
      CLEAR g_ixmlstream.
    *get the number of main nodes of the XML document
      g_ixmlnodemainlist = g_ixmldocument->get_children( ).
    *set number of elemtns
      g_inummainelements = 0.
      g_imainelementsctr = 0.
      g_inummainelements = g_ixmlnodemainlist->get_length( ).
      g_ifirstlevelctr = 0.
    *loop through the document till all have nodes have been covered.
      WHILE g_ifirstlevelctr LT g_inummainelements.
    *get the first node
        g_ixmlnode = g_ixmlnodemainlist->get_item( g_ifirstlevelctr ).
    *check the type of node
        g_isnodeelement = g_ixmlnode->get_type( ).
    *if node is not of type Element then continue
    *because we have got to read only text from element nodes.
        IF g_isnodeelement NE c_nodeelement.
          g_ifirstlevelctr = g_ifirstlevelctr + 1.
          CONTINUE.
        ENDIF.
    *get nodes of the element just found.
        g_ixmlnodelistmainelement = g_ixmlnode->get_children( ).
    *get number of children of main element
        g_inumchildelements = g_ixmlnodelistmainelement->get_length( ).
    *loop trhough the number of children
        WHILE g_imainelementsctr LT g_inumchildelements.
          g_ixmlnodemainelement = g_ixmlnodelistmainelement->get_item(
        g_imainelementsctr ).
    *get type of node
          g_isnodeelement = g_ixmlnodemainelement->get_type( ).
          IF g_isnodeelement NE c_nodeelement.
            g_imainelementsctr = g_imainelementsctr + 1.
            CONTINUE.
          ENDIF.
    *get name of the node.
          g_selementvalue = g_ixmlnodemainelement->get_name( ).
    *get children of node
          g_childnodelist = g_ixmlnodemainelement->get_children( ).
          g_inumchildren =  g_childnodelist->get_length( ).
          g_ichildelementcounter = 0.
    *while there are number of children of node.loop through
          WHILE g_ichildelementcounter LT g_inumchildren.
    *get the child node
            g_childnode = g_childnodelist->get_item(
    g_ichildelementcounter ).
    *check the type of node
            g_isnodeelement = g_childnode->get_type( ).
    *if node is not of element type continue
            IF g_isnodeelement NE c_nodeelement.
              g_ichildelementcounter = g_ichildelementcounter + 1.
              CONTINUE.
            ENDIF.
    *otherwise get element name
            g_selementname = g_childnode->get_name( ).
    *get value stored in this node.
            g_selementvalue = g_childnode->get_value( ).
            g_numelem = g_inumchildren - 1.
            IF g_ichildelementcounter EQ g_numelem.
              CONCATENATE: g_slinedata g_selementvalue
                      INTO g_slinedata.
            ELSE.
    *      store the value of noide in delimiter ~ line
    *      Check for Invalid characters in file
                IF g_selementvalue CA '&'.
                  REPLACE ALL OCCURRENCES OF '&amp;' IN g_selementvalue WITH
                endif.
    *if value contains delimiter then error
                IF g_selementvalue CA '~'.             
                  V_MSG = text-003.
                  EXIT.
                ELSE.
                  CONCATENATE: g_slinedata g_selementvalue '~'  .
                  INTO g_slinedata.
                ENDIF.
            ENDIF.
    *continue
            g_ichildelementcounter = g_ichildelementcounter + 1.
          ENDWHILE.
          g_ichildelementcounter = 0.
    *increment the main element counter by one to go to the next node
          g_imainelementsctr = g_imainelementsctr  + 1.
    *move the current delimiter line creted to internal table to be given
    *back to the calling program
          MOVE g_slinedata TO wa_xmldata-data.
          APPEND wa_xmldata TO it_xmldata.
          MOVE '' TO g_slinedata.
          MOVE '' TO wa_xmldata-data.
        ENDWHILE.
    *increment counter to move to hte next node.
        g_ifirstlevelctr = g_ifirstlevelctr + 1.
        g_imainelementsctr = 0.
      ENDWHILE.
    ENDFORM.                    "f_create_xmltable
    XML structure
    <?xml version="1.0" encoding="utf-8"?>
    <ABCInbound xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XYZSchema\ABCInbound.xsd">
    <HH>
    <RecordType>HH</RecordType>
    <Source>ABC</Source>
    <Destination>XYZ</Destination>
    <TimeStamp>20050909220546</TimeStamp>
    </HH>
    <BH>
    <RecordType>BH</RecordType>
    <DocType>AB</DocType>
    <Reference>2205516125</Reference>
    <DocumentDate>20080909</DocumentDate>
    <PostingDate></PostingDate>
    <CompanyCode>ABC</CompanyCode>
    <Currency>INR</Currency>
    <ExchangeRate>1.0000</ExchangeRate>
    <Park></Park>
    <ItemNumber>2</ItemNumber>
    </BH>
    <BL>
    <RecordType>BL</RecordType>
    <Reference>2205516125</Reference>
    <RefLineItem>1</RefLineItem>
    <AcctType>K</AcctType>
    <DrCrIndicator>H</DrCrIndicator>
    <Account>01000003</Account>
    <Amount>364.00</Amount>
    <VendorName-1>TOM &amp; JERRY IS MY</VendorName-1>
    <VendorName-2> NAME TO BE PAID</VendorName-2>
    <VendorName-3>1987566Z</VendorName-3>
    <VendorName-4>22</VendorName-4>
    <Street>UCX STREET</Street>
    <City>ROAD 4</City>
    <PostalCode>515004</PostalCode>
    <Country>IND</Country>
    <ContactPerson></ContactPerson>
    <AlternatePayeeCode></AlternatePayeeCode>
    <AlternatePayeeName-1></AlternatePayeeName-1>
    <AlternatePayeeName-2></AlternatePayeeName-2>
    <AlternatePayeeName-3></AlternatePayeeName-3>
    <PaymentTerms></PaymentTerms>
    <BaselineDate></BaselineDate>
    <PaymentMethods></PaymentMethods>
    <Allocation></Allocation>
    <LineItemText>item text</LineItemText>
    <TaxCode></TaxCode>
    <TaxAmount>0.00</TaxAmount>
    <WHTaxCode></WHTaxCode>
    <WHTaxbase>0.00</WHTaxbase>
    <Fund></Fund>
    <FundCenter></FundCenter>
    <CostCenter></CostCenter>
    <InternalOrder></InternalOrder>
    <TaxAutomatically></TaxAutomatically>
    <SpecialGLIndicator></SpecialGLIndicator>
    </BL>
    <TT>
    <RecordType>TT</RecordType>
    <TotalRecords>1</TotalRecords>
    <TotalValue>222</TotalValue>
    </TT>
    </ABCInbound>
    when the above xml file is read and populated into ITAB, for element vendorname-2 which has a space in first position , that space is ignored.
    This is being used for a FB01 posting and vendor is paid based on Name1+Name2 printed on cheque and due to the space ignoring problem, the vendor name is displayed wrongly thus causing problems.
    I appreciate if someone could guide me thru and help me in solving this problem.
    How to preserve the leading or trailing space.
    g_selementvalue = g_childnode->get_value( ).
    when i check g_selementvalue, space is ignored.
    i will be greateful if someone could guide me through.
    Regards,
    Simha
    Edited by: Simha on Dec 11, 2008 10:49 AM

    0.02: A C C E P T: Request="NEXT"
    0.06: Fetch session state from database
    0.08: ...Check session ... owner
    0.08: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.08: Session: Fetch session header information
    0.08: ...Metadata: Fetch page attributes for application ..., page 330
    0.08: ...Validate item page affinity.
    0.08: ...Validate hidden_protected items.
    0.08: ...Check authorization security schemes
    0.08: Session State: Save form items and p_arg_values
    0.08: ...Session State: Save "P330_PROJECT" - saving same value: ""
    0.09: ...Session State: Saved Item "P330_SHUTTLE" New Value=""
    0.09: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.09: Branch point: BEFORE_COMPUTATION
    0.09: Computation point: AFTER_SUBMIT
    0.09: Tabs: Perform Branching for Tab Requests
    0.09: Branch point: BEFORE_VALIDATION
    0.09: ...Evaluating Branch: BEFORE_VALIDATION type: "REDIRECT_URL" button: 12904321314585385 branch: (Unconditional)
    0.09: Perform validations:
    0.09: ...Item Not Null Validation: P330_SHUTTLE
    0.09: ...Validation did NOT pass
    This is from debugging, what does the point "0.09: ...Session State: Saved Item "P330_SHUTTLE" New Value="" "
    mean ? I think it means, that the Shuttle somehow sets itself to null ?! but i dont understand why...
    There is no computation or anything that deletes the shuttle, the page is quite small, there is not much more than the shuttle and the validations and computations to give default value and transforming the shuttle items into a collection to continue working with the IDs.
    I dont check whats the problem
    Edited by: user12154443 on 21.07.2010 09:47

  • XML Parser Problem

    am using XML parser for PL/SQL in Oracle9i Enterprise Edition Release 9.0.1.1.1
    When i run the sample xml program, i get error which is as follows. While compiling no errors. But while executing it reports error as given below.
    SQL> execute domsample('c:\xml', 'family.xml', 'errors.txt');
    begin domsample('c:\xml', 'family.xml', 'errors.txt'); end;
    ORA-20100: Error occurred while parsing: No such file or directory
    ORA-06512: at "COMMODITYBACKCONNECT.XMLPARSER", line 22
    ORA-06512: at "COMMODITYBACKCONNECT.XMLPARSER", line 79
    ORA-06512: at "COMMODITYBACKCONNECT.DOMSAMPLE", line 80
    ORA-06512: at line 1
    What need to be done to rectify the above problem.
    when i do the following validation check
    SQL>
    SQL> select substr(dbms_java.longname(object_name),1,30) as class, status
    2 from all_objects
    3 where object_type = 'JAVA CLASS'
    4 and object_name = dbms_java.shortname('oracle/xml/parser/v2/DOMParser')
    5 ;
    CLASS STATUS
    oracle/xml/parser/v2/DOMParser VALID
    oracle/xml/parser/v2/DOMParser VALID
    Please advice to how remove the following error:
    ORA-20100: Error occurred while parsing: No such file or directory

    Found the solution on metalink. There is a file under /$ORACLE_HOME/javavm/install/init_security.sql
    which needs to be run under username where you are installing xml parser.
    This step is not in readme.txt file provided as a part of download from the OTN website.

  • 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
    Dirk

    Hi 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>

  • Data Services Fix Pack 12.2.1.2 issued to resolve XML loader problem

    We've had a few customers contacting us about the following error message:
    "The message type for datastore <my_ds> has not been set". Please notify Customer Support"
    Note that the text "<my_ds> will be the name of the XML loader you have in your dataflow.  This error occurs when you are adding a new loader to a dataflow that is an XML type. 
    The customers that have reported this issue were all building real-time jobs and the loader type was XML Message Target.
    In order to address this issue you will need to download and install the latest update which is 12.2.1.2.  The above issue was introduced in 12.2.1.1 (3.2 SP1).  You will ONLY have to install the client components (Designer) in order to address this issue.  no updates are necessary to the server side of the application to address this problem.
    An SAP Note has also been written up on this issue:  [1423045|https://bosap-support.wdf.sap.corp/sap/support/notes/1423045]
    Thanks,
    Ryan

    there is a connection timeout when trying to contact the laptop.the last lines it shows are:
    PCI: setting IRQ 0 as level-triggered
    ALI15X3: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0x8080-0x8087, BIOS settings: hda: DMA, hdb:pio
    ide1: BM-DMA at 0x8088-0x808f, BIOS settings: hdc: pio, hdd: pio
    hda: IC25N060ATMR04-0, ATA DISK drive

  • XML alignment problem when opening with notepad - XML generated from SAP

    Hi all,
    I am sending a mail with attachment as XML format by using the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    I am getting the xml file in mail and it was properly aligned when i open it. But when i open it with notepad the alignments are changing. 
    Below is the code for sending a mail. The content of the XML file populaed in int. table  lt_attachment.
    lt_attachment[] = pt_attachment[].
      LOOP AT lt_attachment INTO ls_attachment.
        ls_objtxt-line = ls_attachment-container.
        APPEND ls_objtxt TO lt_objtxt.
        CLEAR : ls_attachment, ls_objtxt.
      ENDLOOP.
    Creating the document to be sent
      ls_mailsubject-obj_name     = 'MAILATTCH'.
      ls_mailsubject-obj_langu    = sy-langu.
      ls_mailsubject-obj_descr    = 'You have got mail'.
      ls_mailsubject-sensitivty   = 'F'.
      lv_cnt = LINES( lt_objtxt ).
      ls_mailsubject-doc_size     = ( lv_cnt - 1 ) * 255 + STRLEN( ls_objtxt ).
      DESCRIBE TABLE lt_objtxt LINES lv_tab_lines.
    Header of the email
      ls_objpack-transf_bin = space.
      ls_objpack-head_start = 1.
      ls_objpack-head_num   = 0.
      ls_objpack-body_start = 1.
      ls_objpack-body_num   = lv_tab_lines.
      ls_objpack-doc_type   = lc_raw.
      APPEND ls_objpack TO lt_objpack.
      CLEAR ls_objpack.
      ls_objpack-transf_bin = lc_x.
      ls_objpack-head_start = 1.
      ls_objpack-head_num   = 1.
      ls_objpack-body_start = 1.
      ls_objpack-body_num   = lv_tab_lines.
      ls_objpack-doc_type   = 'XML'.
      ls_objpack-obj_name   = 'data'.
      ls_objpack-obj_descr  = 'data'.
      ls_objpack-doc_size   = ls_objpack-body_num * 255.
      APPEND ls_objpack TO lt_objpack.
      CLEAR ls_objpack.
    Add Recipients
      ls_reclist-rec_type = 'U'.
      ls_reclist-com_type  = 'INT'.
      ls_reclist-receiver =  pv_mail.
      APPEND  ls_reclist TO lt_reclist.
    Mail Contents
      ls_mailtxt-line = 'Please find attached your XML doc.'.
      APPEND ls_mailtxt TO lt_mailtxt.
      CLEAR ls_mailtxt.
      ls_mailtxt-line = lc_regards.
      APPEND ls_mailtxt TO lt_mailtxt.
      CLEAR ls_mailtxt.
      ls_mailtxt-line = lc_dewa.
      APPEND ls_mailtxt TO lt_mailtxt.
      CLEAR ls_mailtxt.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = ls_mailsubject
         put_in_outbox              = lc_x
         commit_work                = lc_x
        TABLES
          packing_list               = lt_objpack
          contents_bin               = lt_objtxt
          contents_txt               = lt_mailtxt
          receivers                  = lt_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
      IF sy-subrc EQ 0.
        COMMIT WORK.
        SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
        pv_return = 'Success'.
      ELSE.
        pv_return = 'Failed'.
      ENDIF.
      CLEAR: ls_objtxt,ls_reclist, ls_objpack ,ls_doc_chng.
      REFRESH: lt_objtxt,lt_reclist,lt_objpack.
    Could any one help me on this.
    Thanks & Regards,
    Vineel.

    Can't you PREVIEW your question before posting? Here you have more than 2500 characters, so we can't read your code.
    Your "problem" seems normal to me (you shouldn't open an XML file with Notepad). Could you give an example how it looks like and how you'd like to make it appear?

Maybe you are looking for