Document.toString

Given the following XML message represented by a Document object, document..toString() is returning:
[Document: [DocType: <!DOCTYPE GTP001O>
], Root is [Element: <GTP001O/>]]
File "[Document: [DocType: <!DOCTYPE GTP001O>
], Root is [Element: <GTP001O/>]]" not found.
Here is the XML Message represented by my Document object:
<?xml version="1.0" encoding="UTF-8"?>
<GTP001O>
<C261>GTP001O</C261>
<BDT>
<C1>001</C1>
<C2>54121480</C2>
<C3>LIM</C3>
<C5>MIA</C5>
<P46>28JUN02</P46>
<P93>2255</P93>
<P92>LI</P92>
<P756>9</P756>
<P541>02</P541>
<P506>A</P506>
<C75>AFC</C75>
<P100>NIL</P100>
</BDT>
<RTN>
<C43>MIA</C43>
<C47>AA</C47>
</RTN>
<QWD>
<C315>01</C315>
<C80>0011</C80>
<C314>K</C314>
<C81>00310.0</C81>
<C107> CONSOLIDATION</C107>
<DIM />
</QWD>
<QWDT>
<P58>0000683</P58>
<C373>0000683</C373>
<C374>0011</C374>
</QWDT>
<GPX>
<P778>1100</P778>
<P779>1200</P779>
<P780>1300</P780>
<P781>1400</P781>
<P782>1500</P782>
<P783>TEST REMARKS</P783>
<P784>11</P784>
</GPX>
</GTP001O>
I thought calling doc.toString() would give me the above String representation of my XML message.
Why is it returning the following:
[Document: [DocType: <!DOCTYPE GTP001O>
], Root is [Element: <GTP001O/>]]
File "[Document: [DocType: <!DOCTYPE GTP001O>
], Root is [Element: <GTP001O/>]]" not found.
Thanks

Hi,
I think calling doc.toString() would not be the right thing to do here
instead you retrieve an Element from the document and get that element's
text...I think that would be feasible....here is the code how to retrieve text from the element
try
               NodeList loDOBList = foXmlDocument.getElementsByTagName("Node Name");
                                   Node n = loDOBList.item(index no of the element);
                    n = n.getFirstChild();
                    String lsValue = n.getNodeValue();
                    return n.getNodeValue();
          catch(Exception e)
               throw e;

Similar Messages

  • Org.w3c.dom.Document toString() ?

    hi i have a constructed org.w3c.dom.Document var newDoc...
    in ibm developerworks tutorial there is a line newDoc.toString() but that gives "[#document null]"
    newDoc.getDocumentElement().getNodeValue() gives the xml string in jdk 1.4 but not in jdk 1.3 wih apache xerces 2.6.2
    how to i get the xml in string output? (i do not wish to use sun java web service development platform)
    please email responses to vishalrao at gmail dot com , thanks!

    From what I saw there was no change and the document getNodeValue always returns null in jdk1.4 as well.
    you can use the transform api to serialize xml into any serialized output form, including strings.
    look into http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/Transformer.html

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • In Reply to : How to validate org.jdom.Document object using xsd: dvohra09

    Hi All
    I am creating org.jdom.Document object using constructor Document() and adding children using setRootElement(), setChildren() and addContent() methods. The children are objects of org.jdom.Element. If i want to validate the org.jdom.Document using xsd what i have to do. Thanks in anticipation.

    I tried the below code and it is always giving the
    Parsing fatal error : The markup in the document preceding the root element must be well-formed.
    But it is possible to validate the same Document object as right document after writing it onto xml file using XMLOutputter and parsing it using DOMParser
    Thanks in anticipation
    org.jdom.Document document;
    String documentString=document.toString();
    StringReader stringReader=new
    StringReader(documentString);
    SAXBuilder saxBuilder =new
    SAXBuilder("org.apache.xerces.parsers.SAXParser",true);
    saxBuilder.setFeature("http://xml.org/sax/features/vali
    ation",  true);
    saxBuilder.setFeature("http://apache.org/xml/features/v
    lidation/schema",  true);
    saxBuilder.setFeature("http://apache.org/xml/features/v
    lidation/schema-full-checking", true);
    //Set a error handler with
    setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
    saxBuilder.build(stringReader);

  • Probably Simple XML toString

    I've been trying to convert an xml document to a string, but I'm having a problem converting. I'm reading the XML from a file.
    Document document = builder.parse(new File(filename));
    And I'm sure that works. I can parse the result. But then I try to return what I've read using:
    return (document.toString());
    Every attempt I've made at using toString() has failed; even when I just try to write it out. What's the trick?

    I don't think that is right way of doing it, try it out this way:
    Document document;
    TransformerFactory tFactory =
                    TransformerFactory.newInstance();
                            Transformer transformer = tFactory.newTransformer();
                DOMSource source = new DOMSource(document);
                StringWriter sw=new StringWriter();
                StreamResult result = new StreamResult(sw);
                transformer.transform(source, result);
    String xmlString=sw.toString();Message was edited by:
    java_queen

  • Sending PDF file through PI

    hi all,
    I followed one blog to create PDF file using file adapter and custom adapter module  : http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414700)ID1540235550DB11887853428651970314End?blog=/pub/wlg/14363
    As per this blog ,, my processing sequence in communication channel is: custom adapter module (module created for converting xml to pdf file) -> CallSapAdapter (stores file with pdf extension to an ftp location). I had added audit logs in module and i am able to see them in RWB.
    But file created at ftp location contains only name com.lowagie.text.Document6e42c8a3 & also i am not able to open it as PDF.
    my last few lines of code are:
    document.add(table);
    document.close();
    String xmlpld = document.toString();
    xpld.setText(xmlpld);
    inputModuleData.setPrincipalData(msg);
    return inputModuleData;
    Please help!
    thanks,
    mayank

    hi shabarish,
    As i am trying through Custom modules, need to know one thing,
    PdfWriter.getInstance(document,oos);
    after creating PDF file according to your code, how to set oos stream to inputModuleData, i feel that i am  doing something wrong in converting oos to inputModuleData
    as of now my code is:
    String xmlpld = oos.toString();
    xpld.setText(xmlpld);
    inputModuleData.setPrincipalData(msg);
    return inputModuleData;
    Please help!
    Mayank

  • How to read data from a website based on user inputs through java programmi

    Hi
    I want to get information from a website based on some inputs that I have. The inputs change everytime and based on them, different output is expected. How do I go about with it? Please advice...
    Will data mining help in this? or is it used only for analysis and predictions?

    you can get the webpage you need very simply like this :
    Test.java
    public class Test{
              public static void main(String[] args) {
                   URLClient client = new URLClient();
                            // URL of a webpage
                   String webPage = client.getDocumentAt("http://content-ind.cricinfo.com/slvind/engine/current/match/343730.html?template=desktop;view=main;wrappertype=desktop");
                   System.out.println(webPage);
         }URLClient.java
         import java.net.*;
         import java.io.*;
         public class URLClient {
              protected URLConnection Connection;               
                   public String getDocumentAt(String urlString) {
                             StringBuffer document = new StringBuffer();
                             try {
                                            URL url = new URL(urlString);
                                            URLConnection conn = url.openConnection();
                                            BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                                            String line = null;
                                            while ((line = reader.readLine()) != null)
                                                 document.append(line + "\n");
                                            reader.close();
                                       } catch (MalformedURLException e) {
                                       System.out.println("Unable to connect to URL: " + urlString);
                                       } catch (IOException e) {
                                       System.out.println("IOException when connecting to URL: " + urlString);
                                  return document.toString();
              }

  • LDAP weird error on updating attributes, no error on reading

    I have to modify the email addresses of only some users in the LDAP database, hence I am doing a search for all objects with the specified email address and updating it using the modifyAttribute function......
    When I just read the properties the code works fine, but when I try to modify the attribute it throws me the following error
    javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'strsdistrid=3+strsdistruserid=isdfv01,ou=autodistributionobjects'
    javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'strsdistrid=3+strsdistruserid=isdfv01,ou=autodistributionobjects'
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3013)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2934)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2740)
    at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1440)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDirContext.java:255)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:172)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:161)
    at javax.naming.directory.InitialDirContext.modifyAttributes(InitialDirContext.java:146)
    at fullname.main(fullname.java:77)
    here is the code.....
    while (answer.hasMore()) {
    SearchResult sr = (SearchResult)answer.next();
    sr.setRelative(false);
    System.out.println(">>>" + sr.getName());
    String dn = sr.getName();
    Attributes attrs = sr.getAttributes();
    String givenName = " ";
    String surName = " ";
    try {
    givenName = attrs.get("mail").toString();
    } catch (Exception err) {
    givenName = " ";
    System.out.println(">>> [Email addresses] " + givenName);
    try {
    surName = attrs.get("document").toString();
    } catch (Exception e2) {
    surName = " ";
    System.out.println(">>> [Object name] " + surName);
    ModificationItem mods[] = new ModificationItem[1];
    // Put in mail
    Attribute mod0 = new BasicAttribute( "strsdistremailaddress","[email protected]");
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
    System.out.println("Modifications set");
    ctx.modifyAttributes(sr.getName(),mods);
    All help is appreciated.

    Hi Timbuk,
    Iam also having a similar problem as yours.
    I have added groups into Active Directory, when i try to add users to groups, Iam getting the same exception.
    javax.naming.NameNotFoundException: [LDAP: error code 32 - 00000525: NameErr: DSID-031A0F80, problem 2001 (NO_OBJECT), data 0, best match of:
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3057)
         at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2978)
         at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2785)
         at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1468)
         at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDirContext.java:273)
         at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:190)
         at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:179)
         at javax.naming.directory.InitialDirContext.modifyAttributes(InitialDirContext.java:165)
            at com.loadtesting.main(AddingUser.java:414)
    Please let me know if you got solution for your problem. So that you can help me. Urgent
    Thanks in advance.
    Deebika                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get XMP MetaData as an XML String in a process?

    Hi there,
    I have a process where I would like to export a documents XMP MetaData, manipulate the XMP MetaData and then import the MetaData again to the document.
    I thougt first I will use the service Name "XMPUtilityService" with the Service Operation "Export XMP" to export the XMP MetaData as a document.
    Hoewer I am not sure how to manipulate the output document from the Export XMP service.
    When I print out the document.toString() in a execute Script Service I get the following:
    <document state="active" senderVersion="0" persistent="false" senderPersistent="false" passivated="false" senderPassivated="false" deserialized="false" senderHostId="null" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="3440" contentType="null" length="-1"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGl obalBackendId/><inline><?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="A...</inline><senderPullServantJndiName/><attributes/></document>
    Actually I expected something like this:
    <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-jc006 DEBUG-1.0, 2009 Jun 23 11:07:21-PDT">
       <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
          <rdf:Description rdf:about=""
                xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
             <pdf:Producer>Adobe LiveCycle PDF Generator ES2</pdf:Producer>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmp="http://ns.adobe.com/xap/1.0/">
             <xmp:ModifyDate>2010-04-20T20:43:59+02:00</xmp:ModifyDate>
             <xmp:MetadataDate>2010-04-20T20:43:59+02:00</xmp:MetadataDate>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
             <xmpMM:DocumentID>uuid:0cf2c6c6-2fba-2b39-5fb6-33ad8ccf58aa</xmpMM:DocumentID>
             <xmpMM:InstanceID>uuid:187bc5a2-acb0-2fa9-711d-33ad8ccf58aa</xmpMM:InstanceID>
          </rdf:Description>
       </rdf:RDF>
    </x:xmpmeta>
    <?xpacket end="w"?>
    What do I need to do to get the XMPMeta data as an XML String from a document within a process?
    Thanks in advance!
    Paul

    Hi,
    thanks for the answer.
    I know that I can retrieve the XMPUtilityMetadata object, but this object provides only access to a few information suche as creator, subject, producer, etc.
    However I would like to retrieve the whole XML String of the XMP Metadata.
    How is this possible?
    Thanks.
    Paul

  • Having alot of trouble in file reading in java

    i dont know. but i feel really bad that Java is a very good OOP language and i suck big time (not very bad but got frustrated) in reading and writing files. some of the time i have accomplish my task with the help of forums. anyways first i would like to ask 2 questions and then i will state my problem. say for instance if i have a file with name amount and dollars. how can i read it?
    i know i can use string regex split method in order to split the line but how can i create a method to do some changes in the text file like i have a name, bank account # and amount to deposit in the text file. my question is how can i declare my method to read (Name) first column and price second column and amount to deposit the third colum?
    Secondly if i have a text file and i would like to replace all <<A>> with the name and <<G>> with the age. if i wanted to do without reading a file no problem create a string and then use the replaceAll method ("<<A>>", "Jaan") but for some reason i can't do it when i read a file. yes i am searching on google to get more understanding in reading file. but anyone care to explain wil be great. God bless you my Son.
    import java.io.*;
    import java.util.*;
    class ReadData {
         private Scanner s;
         private static final String EMPTY_STRING = "";
         private String line1;
         private static String lineTerminator = System.getProperty("line.separator");
         public static void main(String[] args) throws IOException {
              ReadData read = new ReadData();
              read.start();
         public ReadData() {
              s = new Scanner(System.in);
         public void start() throws FileNotFoundException, IOException {
              System.out.println("Enter the file name");
              try {
              String name = s.next();
              openFile(name);
              catch (FileNotFoundException e) {
                   e.printStackTrace();
              catch (IOException e) {
                   e.printStackTrace();
         public String openFile(String filename) throws FileNotFoundException, IOException {
              String line;
              String line2;
              StringBuffer document = new StringBuffer(EMPTY_STRING);
              File inFile = new File(filename);
              FileReader fileReader = new FileReader(inFile);
              BufferedReader bufReader = new BufferedReader(fileReader);
              while(true) {
                   line = bufReader.readLine();
                   if(line==null) break;
                   document.append(line + lineTerminator);
                  System.out.print(document.toString());
              return document.toString();
    }

    i dont know. but i feel really bad that Java is a
    very good OOP language and i suck big time (not very
    bad but got frustrated) in reading and writing files.
    some of the time i have accomplish my task with the
    help of forums. anyways first i would like to ask 2
    questions and then i will state my problem. say for
    instance if i have a file with name amount and
    dollars. how can i read it?Just like you'd read any other file. How you interpret what you've read depends on the specific format of the file, which you've provided no information about.
    i know i can use string regex split method in order
    to split the line but how can i create a method to do
    some changes in the text file like i have a name,
    bank account # and amount to deposit in the text
    file. my question is how can i declare my method to
    read (Name) first column and price second column and
    amount to deposit the third colum? What do you mean? You want to read the entire first column, from all lines, then the entire second column, etc.? Unless you know the length of each line ahead of time so you can use RandomAccesFile, you can't do that. If that's not what you mean, then please clarify.
    Secondly if i have a text file and i would like to
    replace all <<A>> with the name and <<G>> with the
    age. if i wanted to do without reading a file no
    problem create a string and then use the replaceAll
    method ("<<A>>", "Jaan") but for some reason i can't
    do it when i read a file.
    Create a tmp file.
    For each line {
      Read a line.
      Do the replacement on the string you read.
      Write the new line out to the temp file
    rename the temp file to the original
    anyone care to explain wil be great. God bless you my
    Son.I'm not your son. Keep your god away from me.

  • XML parsing in UDF

    Hi everyone!
    First, I must say that I don't know anything about java/XML programming(I'm sorry)!
    I'm just looking for some guiding lights for the following;
    In the Message Mapping (IB), I'm trying to do a RFC Lookup to R/3 using a BAPI call.  I followed Michal Krawczyk's "Mapping lookups - RFC API:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    And now I need to parse the XML response and retrieve a value from it!
    I would like to know if the following portion of code is ok and wheere should I put it?
    Code:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    // Create DOM structure
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(content);
    // Lets find my tag
    NodeList list = document.getElementsByTagName("Number");
              Node node = list.item(0);
              if (node != null) {
                   node = node.getFirstChild();
              if (node != null) {
                   tagValue = node.getNodeValue();
    Thanks a lot for your help!

    Thank you for the links!!!
    I've consulted all of them and when I try to run the code, I'm getting the following message:
    unreported exception org.xml.sax.SAXException; must be caught or declared to be thrown document = builder.parse(result.getContent());
    Could you help me fix that issue?
    Here's the code in question
    String m = "<?xml version="+"1.0" "encoding=""UTF-8""?>"
    "<ns0:BAPI_CUSTOMER_FIND""xmlns:ns0=""urn:sap-com:document:sap:rfc:functions>"+"<RESULT_TAB></RESULT_TAB><SELOPT_TAB><item><COMP_CODE>1000</COMP_CODE><TABNAME>KNA1</TABNAME><FIELDNAME>SORTL</FIELDNAME><FIELDVALUE>004258</FIELDVALUE></item></SELOPT_TAB></ns0:BAPI_CUSTOMER_FIND>";
    RfcAccessor accessor = null;
    ByteArrayOutputStream out = null;
    importanttrace = null;
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    factory.setNamespaceAware(false);
    factory.setValidating(false);
    Document document = null;
    try
              builder = factory.newDocumentBuilder();
              } catch (Exception e) {
                   importanttrace.addWarning("Error creating DocumentBuilder -" + e.getMessage());
                   return null;
    try
              //1. Determine a channel (Business system, Communication channel).
              Channel channel = LookupService.getChannel ("BS_FSCM_AR_CLNT100","CC_RFC_TEST");
              //2. Get a RFC accessor for a channel.
              accessor = LookupService.getRfcAccessor(channel);
              //3. Create a xml input stream representing the function module request message.
              InputStream inputStream = new ByteArrayInputStream(document.toString().getBytes());     
              //4. Create xml payload.
              XmlPayload payload = LookupService.getXmlPayload(inputStream);
              //5. Execute lookup.
              Payload result = accessor.call(payload);
              document = builder.parse(result.getContent());
              //InputStream in = result.getContent();
              out = new ByteArrayOutputStream(1024);
              byte [] buffer = new byte[1024];
              for (int read = inputStream.read(buffer); read > 0; read = inputStream.read(buffer)) {
                   out.write(buffer, 0, read);
              content = out.toString();
    Thanks for your help!

  • Creating PDF using ITEXT API's - error

    Hi,
    In my WebDynpro Application I want to generate a PDF (using ITEXT API's) out of the data retrieved from back end system .
    I used this source code.
    Document document = new Document(PageSize.A4);
    document.open();
    PdfPTable table = new PdfPTable(1);
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph("ONE"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("TWO"));      
    table.addCell(cell);
    document.add(table);
    document.close();
    byte[] b = new byte[100 * 1024];
    b =  document.toString().getBytes("UTF-8");
    IWDCachedWebResource pdfRes = WDWebResource.getPublicCachedWebResource(b, WDWebResourceType.PDF, WDScopeType.CLIENTSESSION_SCOPE,      wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),"FileNameHelloText"));
    I have used Window Manager to create a external window with the URL from pdfRes.getUrl() method.
    After execution i get a pop up window with out PDF document.
    Please let me know your thoughts & solutions to the above mentioned problem.
    Thanks
    Senthil

    Hello Folks,
                   Use the following snippet of the code to generate PDF using ITEXT API.
                                       Document document = new Document(PageSize.A4);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         PdfWriter.getInstance(document, bos);
         document.open();
                    PdfPTable table = new PdfPTable(1);
                    PdfPCell cell;
                    cell = new PdfPCell(new Paragraph("ONE"));
                    table.addCell(cell);
                    cell = new PdfPCell(new Paragraph("TWO"));      
                    table.addCell(cell);
                    document.add(table);
                    document.close();
                    byte [] byteContent = bos.toByteArray();
         IWDCachedWebResource cachedResource =
                             WDWebResource.getPublicCachedWebResource(
              byteContent,
              WDWebResourceType.PDF,
              WDScopeType.CLIENTSESSION_SCOPE,
              wdThis
                                          .wdGetAPI()
                                          .getComponent()
                                          .getDeployableObjectPart(),
              "TestPDF");
                  IWDWindow externalWindow =
            wdComponentAPI
                            .getWindowManager()
                            .createExternalWindow(cachedResource.getURL(),                         "PDF Window",true);
                  externalWindow.open();
    Thanks and Regards,
    Gopi

  • How to get a string of an HTML element

    Imagine a normal web page with its tags. I have to get the
    value of a precise element and convert it to a String in order to
    show it in a TextField. Specifically, I have to take a precise cell
    of a table and insert it in a string.
    Does AIR help me with some method that catches specific
    elements of a HTML code or have I to parse the string of the entire
    HTML and try to reach the wanted value?
    In this last case, how do I convert the entire HTML of a page
    into a string?
    Any other ideas are welcome.
    Thanks.

    quote:
    Originally posted by:
    Marco Sgna
    Does AIR help me...
    No, but I don't see that it has to. I presume
    you're writing an AIR app with HTML and JavaScript. If so, you can
    query and modify the HTML's DOM tree with JavaScript. Then, still
    using JavaScript, you pass it off to the AIR side, using the "AIR
    aliases" APIs. So:
    <table><tr><td
    id="foo">bar</td></tr></table>
    <script>var mycontent =
    document.getElementById('foo').innerHTML; // variable equals "bar"
    now</script>
    quote:
    how do I convert the entire HTML of a page into a string?
    document.toString(), perhaps.

  • Take a full webpage screenshot opened in running instance of Internet Exploler

    Hi everyone.
    I'm trying to get a full webpage screenshot opened in running instance of Internet Exploler, but I get an empty image as a result. Here is my code:
    foreach (SHDocVw.InternetExplorer web in shellWindows)
    mshtml.IHTMLDocument2 docs2 =(mshtml.IHTMLDocument2)web.Document;
    mshtml.IHTMLDocument3 docs3 = (mshtml.IHTMLDocument3)web.Document;
    mshtml.IHTMLElement2 body2 = (mshtml.IHTMLElement2)docs2.body;
    mshtml.IHTMLElement2 root2 = (mshtml.IHTMLElement2)docs3.documentElement;
    int width = Math.Max(body2.scrollWidth, root2.scrollWidth);
    int height = Math.Max(root2.scrollHeight, body2.scrollHeight);
    Rectangle docRectangle = new Rectangle(0, 0, width, height);
    web.Width = docRectangle.Width;
    web.Height = docRectangle.Height;
    Rectangle imgRectangle;
    if (imgsize == null) imgRectangle = docRectangle;
    else imgRectangle = new Rectangle() { Location = new Point(0, 0), Size = imgsize.Value };
    Bitmap bitmap = new Bitmap(imgRectangle.Width, imgRectangle.Height);
    IViewObject ivo = web.Document as IViewObject;
    var type = web.Document.ToString();
    using (Graphics g = Graphics.FromImage(bitmap))
    IntPtr hdc = g.GetHdc();
    ivo.Draw(1, -1, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, hdc, ref imgRectangle, ref docRectangle, IntPtr.Zero, 0);
    g.ReleaseHdc(hdc);
    bitmap.Save("D:\\1.bmp");
    bitmap.Dispose();
    Could you please advise me, what I did wrong? 
    Maybe there exist some other way to do it?
    Thanks for help!

    Hi ya_roslav,
    I think a simple method is to get a screenshot( because your IE frame is actived).
    If you could get the screenshot bitmap, then you could delete the pixels out of IE frame based on the IE frame start position and its width and height.
    Regards!
    Xiaoliang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • OutputStreamWriter to String??

    I am trying to read in an XML file (which works correctly) and write the output to a String. I have the following code which works correctly:
    public void characters( char[] ch, int start, int length )
    throws SAXException {
    try {
    OutputStreamWriter outw = new OutputStreamWriter(System.out);
    outw.write( ch, start,length );
    outw.flush();
    } catch (Exception e) {
    e.printStackTrace();
    I'm sure my problem is not difficult, instead of writing the string to the screen ... :
    OutputStreamWriter outw = new OutputStreamWriter(System.out);
    outw.write( ch, start,length ); //writes to screen
    ... I would like to write this data to a string and use it later. I need someone who is familiar with OutputStreamWriter to tell me how to do this.
    Please help, I can't afford to rip any more hair out!!!

    Hello Mike,
    If all you need to do is read an Xml and assign its contents to a string, once you have a document object (instance of class: org.w3c.dom.Document) created, you can extract the string representation of it using its toString method.
    eg: String strXml = document.toString();
    Hope that helps.
    Regards,
    Kunal

Maybe you are looking for

  • Single page view not working.

    Hi, everyone. I have created a book using Blurb's template for InDesign. After I finished the book I exported it as a PDF file and wanted to review it on my notebook and iPad but Acrobat only displays it in two page view (the 'spread' as InDesign ref

  • Postings in FB01 transaction

    Hello friends,i have an urgent requirement to post the AR,AP and G/l account's . Currently there exists a bdc program to perform the above job but the program has been a dependent on the file format  i.e, if i give the file sequence as for ar 01 , 50

  • Focus in JTextArea (JDK1.4)

    hi, I try to tab in a JTextArea when I use JDK 1.4. But new focus traversal policy in JDK 1.4 does not include JTextArea. Anybody has any idea how to do this: the focus should be on the selected line or the first line by default whenever pressing Tab

  • Mac Mini Doesn't Power ON

    While watching a movie, the mac mini suddenly switched OFF. I tried several times to turn it ON and tried different wall outlets but it doesn't turn ON. Anyone knows what is this problem? does the mac mini have a power supply inside? and how to make

  • The on/off button at the top of my iphone stopped working, how can i repair it? iPhone 4S

    the on/off button at the top of my iphone stopped working, how can i repair it? iPhone 4S, iOS 7.0.4