Retrieving AttributeSet from PlainDocument

In looking at the composition of javax.swing.text.Element and the Document and AttributeSet interfaces - it appears as if I should be able to retrieve an AttributeSet that was assigned to a particular location when a string is inserted into a Document.
However, the code snippet I tried does not return the AttributeSet I sent into the document with insertString. I tried this with both a PlainDocument (usint a JEditorPane) and a DefaultStyledDocument (using JTextPane).
Is my understanding incorrect? If I do an insertString against a document - supplying an AttributeSet (contents different from items on other side) - shouldn't I be able to get the AttributeSet back by retrieving the element at that offset?
Code snippet attached,
jgr
Document doc = jEditorPane.getDocument();
String tag = "TAG";
SimpleAttributeSet attrs = new SimpleAttributeSet();
attrs.addAttribute(tag,"a test tag");
int insertLocation = 0;
doc.insertString(insertLocation, "ABCD", attrs);
int index = doc.getDefaultRootElement().getElementIndex(insertLocation);
Element element = doc.getDefaultRootElement().getElement(index);
AttributeSet eAttrs = element.getAttributes();
// I thought this would display "a test tag" - but it doesn't.
// it returns null.
System.out.println(" entry contents=" + eAttrs.getAttribute(tag));

AttributeSet eAttrs = element.getAttributes();I think this set should be a Java runtime implementation of one of four predefined attribute sets
which are, by definition, immutable.

Similar Messages

  • How to retrieve elements from 3 different xml file in one url

    Hi all,
    Could anyone please let me how can we retrieve elements from 3 different xml file in one url?
    i just can only do it with one file only, any help would very appreciate.
    Thank in advance
    Jim

    Hi Philip
    Thanks for replying me.
    I tried on that way, In my mdx query i am using one slice attribute (i.e [Customer].[Gender].allmembers) in rows so getting error "The  Hierarchy already appears in Axis1".
    SELECT
    {[Measures].[Internet Sales Amount] } ON 0,
    NON EMPTY
    {[Customer].[Gender].allmembers } ON 1 -- Used
    FROM
    [Adventure Works]
    WHERE
    [Customer].[Gender].&[M]
    ,[Product].[Size Range].[(All)]
    ,[Customer].[Country].[All Customers]
    [Customer].[Gender].[All Customers]
    ,[Product].[Size Range].&[XL]
    ,[Customer].[Country].[All Customers]
    [Customer].[Gender].[All Customers]
    ,[Product].[Size Range].[(All)]
    ,[Customer].[Country].&[Australia]
    Can you provide alternate ways to get resolved.
    Thanks in advance

  • Retrieve values from a HTML table !!!

    Hi.
    How can i retrieve values from a HTML table using javascript ?
    I´m trying to use the command "document.getElementsByTagName" without success.
    Thanks in advance.
    Eduardo

    Hi, Deepu.
    I´m still with trouble in retrieving the value in HTML.
    In debug the C_CELL_ID seems to be correctly updated but
    when using the command "document.getElementById" the value is always "null".
    I implemented in the method DATA_CELL the code :
      if i_x = 3 and i_y = 2.
      C_CELL_ID             = 'zs'.
      C_CELL_CONTENT = 10. 
      endif.
    And in HTML :
    var ztest = document.getElementById('zs');
    alert(ztest);
    Could you help me please.
    Many regards
    Eduardo S.
    Message was edited by: Eduardo   Silberberg

  • Retrieving values from Database in Excel Task Pane App

    So far,
    I created a website with a database on Azure, I then published my App to Azure. My problem is that I'm not sure how I retrieve values from the database (in SQL: SELECT * FROM EXAMPLE_TABLE WHERE date = str). If someone could provide me with sample code,
    that would be amazing! :D
    It would also be very helpful if anyone knew a method to automatically update the database using information from a xml stream on another website, once a day.
    Thank you!

    Hi,
    >> My problem is that I'm not sure how I retrieve values from the database
    You can use jquery ajax call to call your webserivce or REST API, which will query the database and return a json result.
    Sample:
    Apps for Office: Create a web service using the ASP.NET Web API
    >> It would also be very helpful if anyone knew a method to automatically update the database using information from a xml stream on another website
    For the database sync-up question, I suggest you posting them on the forums like SQL Server Forum.
    Thanks for your understanding.
    Best Regards
    Lan
    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.

  • Retrieving values from a table

    Hi all,
    I need to retrieve values from CSKS-KOSTL for values containing the pattern entered by the user. For example, if the user enters 1, need to retrieve all the KOSTL values starting with 1. But when i write a SELECT statement mentioning where kostl in '1', it is ignoring all the values like (0000001, 00001034, 0012334, and others). Only values starting with 1 is only retrieved as this is a character field and due to conversion routine, zeroes are prefixed while storing in the database.
    Could any one let me know how to retrieve the values from the database in this situation?

    If you want to use IN operator in your where clause then you should define a range variable(R_KOSTL) which refers to CSKS=KOSTL and populate the range as below
    R_KOSTL-SIGN = 'I'.
    R_KOSTL-OPTION = 'CP'.
    R_KOSTL-LOW = '1*'.
    APPEND R_KOSTL.
    and then write your select statement as .... WHERE kostl IN r_kostl.
    The approach suggested by Amit should also work fine.
    Thanks
    Kiran

  • Error while trying to retrieve data from BW BEx query

    The following error is coming while trying to retrieve data from BW BEx query (on ODS) when the Characters are more than 50.
    In BEx report there is a limitation but is it also a limitation in Webi report.
    Is there any other solution for this scenario where it is possible to retrieve more than 50 Characters?
    A database error occured. The database error text is: The MDX query SELECT  { [Measures].[3OD1RJNV2ZXI7XOC4CY9VXLZI], [Measures].[3P71KBWTVNGY9JTZP9FTP6RZ4], [Measures].[3OEAEUW2WTYJRE2TOD6IOFJF4] }  ON COLUMNS , NON EMPTY CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( [ZHOST_ID2].[LEVEL01].MEMBERS, [ZHOST_ID3].[LEVEL01].MEMBERS ), [ZHOST_ID1].[LEVEL01].MEMBERS ), [ZREVENDDT__0CALDAY].[LEVEL01].MEMBERS ) ........................................................ failed to execute with the error Invalid MDX command with UNSUPPORTED: > 50 CHARACT.. (WIS 10901)

    Hi,
    That warning / error message will be coming from the MDX interface on the BW server.  It does not originate from BOBJ.
    This question would be better asked to support component BW-BEX-OT-MDX
    Similar discussion can be found using search: Limitation of Number of Objects used in Webi with SAP BW Universe as Source
    Regards,
    Henry

  • Query Report:To Retrieve Data from A/R Invoice and A/P Invoice

    Hii Experts,
          I am a new Sap B1 Trainee.I am facing a problem when retrieving data from A/R Invoice and A/P Invoice in order to track
    Expenditure and Revenue according to a Bussiness partner,
    I am using union to retrieve the information,but it is saying a error that  Error Converting Varchar to Numeric and also
    i would like to know how can i show the total final payment by reflecting Downpayments in A/R Invoice and A/P Invoice
    With Regards
    Cherry.

    Hii.
    My Sap B1 version is 8.8.1 and patch level is 20. Actully i need a scenario where i can able to show both Expenditure and Revenue of a particular bussiness partner and profit/loss in a single query report.
    I need some tips regarding this,When i am doing union i am getting conversion error converting varchar to numeric when i take
    Sum(Line Total) from OINV and Sum(line total) OPCH group by docdate and docentry and BP .
    and another scenario is how to deduct A/P downpayment or A/R downpayment from A/P invoices and A/R invoice to get the final Revenue and Expenditure ..
    Thanks & Regards
    Cherry

  • Unable to retrieve tables from this connection

    I have been using Dreamweaver for over 5 years. I have been
    using an Access database and ASP the entire time. I am using a
    Windows 2000 server for the database and web site. I have used
    every verson of Dreamweaver since Ultra Dev. When I bought verson 8
    and upgraded to 8.0.2, I began getting the following message when I
    try to edit or create a recordset.
    "Unable to retrieve tables from this connection, click on the
    'Define...' button to test this connection."
    I don't know what to do. Is this a widespread problem? Is it
    a Windows problem? Is it a Dreamweaver problem? Is it a network
    problem?
    Please HELP!

    Did you ever get an answer for this ?
    I am having the same issue but using XP professional.

  • Webi report: Issue Cannot retrieve dimensions from Cube

    Hello Experts,  We're facing an issue with a partical set of Webi reports in Quality environment. The reports are BW reports based on OLAP BICS connectivity on top of Bex queries.y  Below is the scenario and the issue:  1. The backed Bex queries have been trasported to Quality BW system and they're running fine when run from RSRT or Bex analyzer. 2.The Webi reports along with the BICS connections have been migrated to the Quality box and the BICS connections have been editied so that they point to the Quality BOX bex queries and they're testing and responding to the connection successfully. 3. The Webi reports pointed to the Dev Box in the Dev BOBJ system are working fine, but when the same reports for which the connections were repointed in Quality as above, are giving the error "Cannot Retrieve Dimensions from Cube".  Steps taken: a. Deleted the reports and the BICS connection from Quality environment and remigrated the reports,connecitons and changed the connecitons but still the issue persists. b.Tried finding the root cause and got the following issue in the Bex query in Quality: There are filters put in the Bex query . All other filters are working fine except 0CALMONTH. We tried putting all sorts of variables on 0CALMONTH, but the moment a variable is put on 0CALMONTH, this issue occurs. But when we tried removing the variable from 0CALMONTH in filters and restricted it to a single value, the Report works fine.  However the same is not an issue in the Dev Box and all queries with similar variables are working fine.  So we're thinking this might be an issue on the BW backend and the cube might have to be transported again to the Quality Box.  ANy quick suggestions or inputs on this would be greatly appreciated.  Thanks and regards, Abhishek

    Hi Abhishek,
    I am facing same issue.Have you resolve this issue?
    Regards,
    Rajesh

  • How to retrieve photos from water-damaged iPhone

    Last week (Wednesday), I my iPhone got wet while I was out of the country.  I immediately put it in a grocery bag of rice (no ziplocks or tupperware available), and put it on top of the refrigerator.  I left it there until the end of my trip on Saturday.  When I got home, I put it on the charger and left it until the local AT&T store opened on Monday.  They weren't able to help me, but suggested I go to the phone repair place across the street where, for $25, he opened it up and dried it out.  It did not come back on for him, but he suggested that I take it home and put it on my charger and see if it will come back on. 
    Just to be clear, I am not all that worried about salvaging the phone.  I'm pretty sure it is irretrievably damaged due to the length of time it was in the water and the fact that it was ON and I checked to see if it worked after 24 hours (that's how long they told me to keep it in rice).  I have insurance and can replace the phone.  Everything else was backed up.  What I DO need, is to retrieve the work-related photos that are on the phone that did not get backed up while I was on my trip.  I do not use the cloud, so 3 days worth of photos are on my phone (luckily I backed up before I left the country). I did some surfing and found some steps that say they can sometimes retrieve data from a wet/dead phone, so I tried to turn it on one more time, and was ecstatic to see the little Apple symbol appear followed by the "unlock" screen, but then the phone died again. 
    This gave me hope, so I ran back down to the repair shop and he could repeatedly get it to come on, but it shows the battery is dead and it will not stay on long enough to retrieve the data.  He swapped the battery and got it to come on long enough to start the back up but it got about 1/2 way through before it shut itself off again.  The battery in it is the original and it is dead.  He suggested I plug it in and keep trying to get it to come on long enough to dowload the pictures.  I have it plugged in, but it doesn't appear to be charging at all.  Is there something more I can do?  I've seen other posts that suggest keeping it in the rice for over a week.  I've even seen software that says it can retrieve data even from a dead phone ("Wondershare Dr. Fone").  Is there anything I can do to get those pictures?
    Thanks!

    Search the internet.  This is way beyond the scope of this forum.
    Best of luck.
    GDG

  • How to retrieve data from a dimension that is not directly joined to a fact

    Hi,
    In my case I have 2 dimensions and one fact. I need to runa report collecting data from all the three tables.
    I need to do the following.
    DIMA DIMB FACT1
    FACT1 is joined with DIMA
    DIMA is joined with DIMB
    FACT1 is not Joined with DIMB.
    My report should still retrieve information from DIMB by connecting FACT1 with DIMA and retrieve corresponding data from DIMB.
    Please suggest how can I do this .
    I am using 10.1.3 version of OBIEE
    You help will be much appreciated.

    Hi,
    I think your data model is snow-flake schema,we can get the data from snow-flake schema also.Pull the columns from both fact and DIMB into criteria.It will display the result.
    mark if helpful/correct...
    thanks,
    prassu

  • How to retrieve data from a CGI to SAP?

    Hi guys,
    I'm looking for a way to retrieve information from a CGI page into SAP. This CGI generates a XML with the response from the parameters I use on the URL.
    I can xsl transform the result into ABAP variables, but first I need to know how to get that information.
    As anyone come across this or knows how to do it?
    Thanks in advance,
    Ricardo

    Hi,
    In your case, Include prog is part of FM, no need to treat it as an Entity.
    Now, Your Answer -
    In SCRIPT - IN Page Window -->
         PERFORM GET_MVAT_TIN IN PROGRAM Z_SCRIPT_PERFORMS_ABAPDB3
         USING &VBDKR-KUNRE&
         CHANGING &STCD1&
         CHANGING &STCD2&
         ENDPERFORM
         IF &STCD1& <> ' '
         <B>MVAT Number :</> &STCD1&
         ENDIF
    Then go to SE38 --> Creat prog with type - Subroutine pool
    In that Write FORM statement for this PERFORM.
    FORM get_mvat_tin TABLES inttab STRUCTURE itcsy
                             outtab STRUCTURE itcsy.
      DATA : v_kunre TYPE kna1-kunnr,
             v_stcd1 TYPE kna1-stcd1,
             v_stcd2 TYPE kna1-stcd2.
      LOOP AT outtab.
        CLEAR outtab-value.
        MODIFY outtab.
      ENDLOOP.
      READ TABLE inttab INDEX 1.
      v_kunre = inttab-value.
      IF v_kunre CA sy-abcde.
      ELSE.
        UNPACK v_kunre TO v_kunre.
      ENDIF.
       " Here You can take your Funcion module ***************************
      SELECT SINGLE stcd1 stcd2 FROM kna1 INTO (v_stcd1, v_stcd2)
                                         WHERE kunnr = v_kunre.
      IF sy-subrc = 0.
        READ TABLE outtab INDEX 1.
        WRITE v_stcd1 TO outtab-value.
        MODIFY outtab INDEX 1.
        READ TABLE outtab INDEX 2.
        WRITE v_stcd2 TO outtab-value.
        MODIFY outtab INDEX 2.
      ENDIF.
    ENDFORM.                                

  • How to retrieve comments from one OfficeTask activity and use them in another OfficeTask activity for Multi level Approval sequential Workflow

    I'm designing a sequential site workflow using Visual Studio 2010 for Project Server 2010. In my case, I have following 6 stages in the workflow:
    1. InitialProposal Stage
    2. Approval Stage1 -- Needs approval from Approver Project Security Group Members1
    3. Rejection Stage
    4. Approval Stage2 -- Needs approval from Approver Project Security Group Members 2
    5. Execution Stage
    6. Completed Stage
    Requirement is workflow should move to Approval stage2 from Approval stage1  if approved by all members of Approver Project Security Group1and it should move to Rejection Stage even if a single member rejects it.
    Workflow should move from Approval Stage2 to Execution Stage if approved by all members of Approver Project Security Group2 and it should move back to Approval Stage1 on rejection by a single member of the group.
    I'm using inbuilt PSWApproval content type and OfficeTask activity for creating approval task for the group members at both stages.
    On task rejected in Approval stage2, task will be assigned again to Approval Stage1 and I want to show comments given by members of Approver Project Security Group2 to the members of Approver Project Security Group1 with this assigned task
    but I'm not able to retrieve comments from officeTask activity.
    My question is where exactly these comments are saved? how can we retrieve them and use them in another officetask activity? If this is not possible then what is the possible solution for meeting above mentioned business requirement?

    Hi Paul,
    Thanks for your suggestion.
    By comments field I'm assuming OfficeTask.Comments field. Problem is, this field is always null. I tried accessing this field in CheckExitCondition activity as well as in OnTaskCompleted but in both the cases, it was null only(I wrote comments while approving
    the task).
    I used a code activity within OnTaskCompleted activity and following code for accessing Comments and Description fields:
    public string officeComments;
            public string officeDescription;
            private void TaskCOmplete(object sender, EventArgs e)
                CodeActivity Sender = (CodeActivity)sender;
                Microsoft.Office.Workflow.Actions.OfficeTask ofctask1 = ((CompositeActivity)Sender.Parent).Parent as Microsoft.Office.Workflow.Actions.OfficeTask;
                officeComments = ofctask1.Comments;
                officeDescription = ofctask1.Description;          
    Please tell me if I'm doing anything wrong here, I'm very new to Workflows. Also, do I need to set any specific property of officeTask for retriving comments?
    Thank you

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • When i updated itunes I lost all my music, I was able to retrieve it from my previous version, but now a artists have all of their songs list under one unknown cd.  How can I seperate these cds with the correct songs included?

    When I updated itunes I lost all of my music, I was able to retrieve it from a previous itunes library, but now some artists have all of their songs listed under one "unknown album."  Is there a way to separate these songs back into the correct albums?  Also, is there a way to make songs that have a featured guest just show up with the rest of the album instead of making a whole new spot for it?  Thanks!

    " When I did this, my library showed all the music I have "purchased" from itunes but did not have the music that I downloaded a long time ago through itunes from my old CDs."
    Correct.
    " How can I get that music to show up in my library now on my new computer?  "
    Copy it from your old computer or your backup copy of your old computer.
    The sync is one way - computer to ipod.

Maybe you are looking for

  • Error: Unable to create socket(While using Mail Adapter in receiver side)

    Hi Experts, I have tried the File to Mail scenario. While component monitoring the Sender communication is working fine but the receiver communication is giving error like Unable to create socket. Please help me to solve this error. Regards, Nutan

  • Buying a movie in iTunes store in more than one language

    1. If a movie is available in multipule language can I buy it and have the two audio track ie..: french and english 2. In the old Apple tv if i buy a movie i could get multiple audio track why cant it be done in the iTunes store?

  • A many-to-many relational problem (SQL and CFM)

    My question: How to get CFM to return a many-to-many relationship in one row using cfloop My table structure: Table A - Books BookID | BookName 1 | Book One Table B - RelatingTable BookID | AuthorID 1 | 60 1 | 61 Table C - Authors AuthorID | AuthorNa

  • Inforecords at plant level

    Hello, My client has presently 2 company codes and 2 pur org assinged to them. Example is - one company cdoe FFI, assinged to pur org FFSO. other company code JMC asinged to pur org J001 recently. One material / vendor combination is maintianed in in

  • Upgraded to Office 2013

    I have the BB Z10 and love it. I upgraded my computer to Office 2013 and like another user with the BB9310  am having problems trying ot get the device to sync. According to the response to that forum post was Office 2013 is not support. This is a pr