How to find associated text frame with XML element?

Hello experts, I am new to InDesign CS SDK and have a question.
I am building an Extension to import an XML document into an InDesign template. As the content in XML can be unpredictable, in the Extension, I want to loop through all the XML elements and make sure it has associated text frames, and if it doesn't, I want to create a text frame and set the content to the text frame.
I think I figured out how to create a new text frame in page and set the content in the frame, but I am having difficulty finding an associated text frame for an XML element.
If anyone has a sample code finding a text frame for an XML element, I appriciate it. Or if anyone can tell me what document I need to look, it will be great too.
Thanks,

Here's a code snipet with null checks removed:
UID MyClassName::GetFrameForXMLElement(IIDXMLElement* inXMLElement)
    InterfacePtr< ITextModel > textModel( Utils< IXMLUtils >()->QueryTextModel( inXMLElement ) );
    InterfacePtr< IFrameList > frameList( textModel->QueryFrameList() );
    UID aFrameUID = frameList->GetNthFrameUID( 0 );
    return aFrameUID;

Similar Messages

  • Polulate Text frames with XML content - PLEASE help me.

    Hi guys,
    I'm trying to import some xml data to an indesign file. Here are the steps I'm doing:
    1- create new document
    2- create master page
    3- create empty text fields in the master to be tagged
    4- import tags from xml
    5- import xml
    then it simply don't auto populate the text fields wiith the xml content.
    I've already spent about 10 hours trying to figure out what can be the problem...
    My structure in indesign (BEFORE importing XML):
    businesscards
    Card
    employeeName
    employeePosition
    employeeAddressln1
    employeeAddressln2
    employeePhone
    employeeEmail
    My structure in indesign (AFTER importing XML):
    businesscards
    Card <!-- has dropdown arrow with xml content inside -->
    Card <!-- has dropdown arrow with xml content inside -->
    Card <!-- has dropdown arrow with xml content inside -->
    Card <!-- has dropdown arrow with xml content inside -->
    employeeName
    employeePosition
    employeeAddressln1
    employeeAddressln2
    employeePhone
    employeeEmail
    But it doesn't populate the text frames...
    I've already tried to write text in the text frames and tagged them, so I can see those colored brackets. But it doesn't work and makes a mess in the structure.
    Please, can someone help me, do you know a good step by step tutorial online? What am I doing wrong?
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <businesscards>
    <Card>
    <!-- contents of Suzan Reed -->
    <employeeName>Suzan Reed</employeeName>
    <employeePosition>Director of Marketing</employeePosition>
    <employeeAddressln1>506 SE 72nd Avenue</employeeAddressln1>
    <employeeAddressln2>Portland, Oregon 97215</employeeAddressln2>
    <employeePhone>503-481-5858 direct</employeePhone>
    <employeeEmail>[email protected]</employeeEmail>
    </Card>
    <Card>
    <!-- contents of Gabriel Powell -->
    <employeeName>Gabriel Powell</employeeName>
    <employeePosition>Senior Training Director</employeePosition>
    <employeeAddressln1>25 NW 23rd Place, Suite 6-122</employeeAddressln1>
    <employeeAddressln2>Portland, Oregon 97210</employeeAddressln2>
    <employeePhone>503-515-5404 direct</employeePhone>
    <employeeEmail>[email protected]</employeeEmail>
    </Card>
    <Card>
    <!-- contents of Dale Erwing -->
    <employeeName>Dale Erwing</employeeName>
    <employeePosition>Trainer</employeePosition>
    <employeeAddressln1>5131 Buffalo Ave. #20</employeeAddressln1>
    <employeeAddressln2>Sherman Oaks, CA 91423</employeeAddressln2>
    <employeePhone>310-795-8943 cell</employeePhone>
    <employeeEmail>[email protected]</employeeEmail>
    </Card>
    <Card>
    <!-- contents of Jim Conner -->
    <employeeName>Jim Conner</employeeName>
    <employeePosition>Trainer</employeePosition>
    <employeeAddressln1>25 NW 23rd Place, Suite 6-122</employeeAddressln1>
    <employeeAddressln2>Portland, Oregon 97210</employeeAddressln2>
    <employeePhone>503-515-2376 cell</employeePhone>
    <employeeEmail>[email protected]</employeeEmail>
    </Card>
    </businesscards>
    Thanks in advance

    It worked! thanks ... But...
    But only if I don't apply to the Master when I apply to the master all the other cards have the same content as the first of the XML. :(
    Even when I try to create multiple pages (cards) with no Master page (too time consuming), I can't figure out a way of having the other cards filed with the remaining data of the XML. :(
    I don't want to drag the elements one by one to every single card (they are so many...)
    Is there a way of having the structure organized in a way to have indesign auto populate and auto create pages?
    thanks for any kind of advice.

  • How to determine column inches in a text frame with intersecting frames?

    I am trying to write a script to determine how much text would fit in a text frame before actually having the text. If the frame has no run-around areas intruding on the frame it is the simple depth of the frame. Is there an easy way to determine the area of the frame with the obstructed areas subtracted?

    Maybe you could fill text frame with placeholder text:
    myTextFrame.contents = TextFrameContents.placeholderText;
    Hope that helps.
    tomaxxi
    http://indisnip.wordpress.com/

  • Find a text frame on the page with script label

    hello to all
    I need to create a script to
    find a text frame on the page with script label "xxx"
    and read its contents into a variable.
    The content of the text frame is a number.
    thanks

    Hi Roberto,
    Welcome to the forum,
    This will find the labeled textFrame on the active page.
    var myLabel = "Foo", // change to label
          myPage = app.properties.activeWindow && app.activeWindow.activePage,
          myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
          l = myTextFrames.length,
          myVariable
    while (l--) {
        if (myTextFrames[l].label != myLabel) continue;
        myVariable = myTextFrames[l].contents;
        break; // presuming there's only one "Foo" labeled frame on the page
        // Otherwise you'll nead an array
    alert(myVariable)
    Trevor

  • How can we get the reference of XML element on frame as soon as frame is created in Document?

    Hi,
    When ever we copy any text/table cells from any frame, and paste it directly on page, A new Frame is created and the pasted text is placed inside that frame.
    Now to capture this frame creation, We have two possible solutions:
    1) Attach Observer on Document 'kDocBoss' on IID_IHIERARCHY_DOCUMENT and it will notify on frame creation in update function.
    2) Notification event on new story creation.
    Now, I need to perform some changes in the newly created table, for example:
    a)  Need to delete XML tags from newly created frame
    b)  Need to perform action on table cells if any in the created frame.
    But the problem is, when the event comes, I can access basic properties of frame like it's name, type etc, but it does not give me the
    XML element on frame or tables in frame until the event is com pleat.
    I know it's quite a specif requirement, but I guess many of you might have faced these kind of challenges, while processing the event.
    Does any one has any idea how I can get the reference of XML element on frame as soon as it is created?

    Hi Kapoor,
    please give also others a chance, and excuse that I get up late on vacation ;-)
    Anyway, I'd keep the story creation responder to recognize the copy, then combine it with an observer on the backing xml story to catch the associated XML element which is created there. Something like below:
    UIDRef xmlStoryRef = Utils<IXMLUtils>()->GetBackingStore(doc);
    InterfacePtr<ISubject> subject ( xmlStoryRef,IID_ISUBJECT );
    subject->AttachObserver(observer,IID_IIDXMLELEMENT,observer->GetAttachIID());

  • Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two? also I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own?
    Yes, it is possible. 1 apple ID can be associated with up to 10 devices.
    If each has their own does each id have to buy their own music and apps?
    Yes, all purchases are non-transferable.
    How does find my iphone work with one apple id or two?
    Every device associated with one apple ID through Find my iPhone is tied to that Apple ID; Find my iPhone will work in the same way with up to ten devices associated with one apple ID. You cannot enable Find my iPhone for one device across two apple IDs
    I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?
    If you have authorized a computer with the old apple ID, you can transfer old media purchased through the old to other devices via iTunes. This doesn't mean the media purchases through the old apple ID it transferred to the new account. If you plan to make future purchases and don't wish to share them with others, make your own apple ID.

  • Tcode FV50: How to find long text in FI Document line item Before Saving.

    Hi,
    How to find long text in FI Document line item.
    During Parking of the FI document through Tcode FV50 i m giving the some text in the long text not in the text field.
    I would like to validate the Long Text Before Saving in user exit "U300" under  the  "Sunstitution" .
    Please anybody can be help me out where exactly this long text is going to be stored or in which internal table or memory id.
    Please give me the answer as soon as possible .
    Note:- Read_Text function module is not useful. Because Read_text useful after saving document.

    Hi Amit,
    In application area FINANCIAL ACCOUNTING , go for node LINE ITEM. Here create a step & maintain the prerequisite as per your requirement & in the check you can mention the code or you can direct it to a custom program like ZFI_RGGBR000.
    Here while maintaining the check you will get structures BKPF & BSEG in which you will get the desired field you are looking for.
    Just try to explore in your system how the other validations are maintained.
    After you are done with all your code, you have to run the regeneration program RGUGBR00.
    Here utmost care should be taken while running regeneration program, you should select all the checkboxes in the selection screen except  GENERATE SETS, GEN SUBSTN ROUTNS IN ALL CLNTS  & TRACE PROG. GENERATE CALLS .
    Hope this make your doubt clear.
    Regards
    Abhii

  • How to find the text id for the text in the sales order

    Hi all,
    How to find the text id for the item-text in the sales order?
    There are different Text available in  the sales order under item like Warehouse instruction, CSR instruction...
    I want to know the corresponding Text id for the text ELECTRONIC ORDER COMMENT.
    Table TTXID contains the validation of the Text id.
    Please help me in knowing the way to identify the text-id from the text list..
    Thanks foryour help
    Suresh Kumar

    U can fetch the texts for the items using
    Read_text.
    Example:
        g_f_tdname = xvttp-vbeln.
        g_f_obj = p_obj.
        g_f_langu = 'DE'.
        REFRESH g_t_lines.
        CLEAR g_t_lines.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  id                      = p_var
                  language                = g_f_langu
                  name                    = g_f_tdname
                  object                  = g_f_obj
             TABLES
                  lines                   = g_t_lines
             EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
        IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    The Required fields are,
    Text-id ,language,name,object.
    Let me know if you further require help.
    Regards

  • How to find the text of a viwe

    How to find the text of a view?
    I tried all_views but it only types the partial text. What can be the problem and the possible solutions?
    Naveen

    We also found there was a "COL TEXT A80" in our glogin.sql. I don't know whether we put it there or whether it was installed by default. This resulted in some views which had been defined with longer lines having words chopped in half, which is no good for creating scripts. Therefore when selecting view text I also issue a
    COL TEXT A200 word_wrapped

  • How to Create a text frame?

    Hai
    i'm senthil....
    i'm just now started working with Adobe Indesign plugin's..
    Can anyone tell me how to create a text frame...
    wat r the steps for creating a text frame?
    what are the Interface pointers used for creating a text frame...
    plzz reply me who knows...
    bye.

    See SDKLayoutHelper::CreateTextFrame.
    You can also look at SnpCreateFrame::CreateTextFrame in SnippetRunner.
    Regards,
    Narayan

  • XmlDataProvider .... is gone completely in my Xaml file. Why? How many different ways to deal with xml data source through WPF

    I followed a procedure described in a book.
    1. insert "Inventory.xml" file to a project "WpfXmlDataBinding" .
    2. add the XML data source through the data panel of "blend for 2013", named it "InventoryXmlDataStore" and store it in the current document.
    3. dragged and droppped the nodes from the Data panel onto the artboard.
    Then I checked my Xaml file against the one provided by the book
    Xaml file by the book:
    <Window.Resources>
    <!-- This part is missing in my xaml file --><XmlDataProvider x:Key="InventoryDataSource"
    Source="\Inventory.xml"
    d:IsDataSource="True"/>
    <!-- This part is missing in my xaml file -->
    <DataTemplate x:Key="ProductTemplate">
    <StackPanel>
    <TextBlock Text="{Binding XPath=@ProductID}"/>
    <TextBlock Text="{Binding XPath=Cost}"/>
    <TextBlock Text="{Binding XPath=Description}"/>
    <CheckBox IsChecked="{Binding XPath=HotItem}"/>
    <TextBlock Text="{Binding XPath=Name}"/>
    </StackPanel>
    </DataTemplate>
    </Window.Resources>
    <Grid>
    <ListBox HorizontalAlignment="Left"
    ItemTemplate="{DynamicResource ProductTemplate}"
    ItemsSource="{Binding XPath=/Inventory/Product}"
    Margin="89,65,0,77" Width="200"/>
    </Grid>
    my Xaml file:
    <Window x:Class="WpfXmlDataBinding.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="922" Width="874">
    <Window.Resources>
    <DataTemplate x:Key="ProductTemplate">
    <StackPanel>
    <TextBlock Text="{Binding XPath=@ProductID}"/>
    <TextBlock Text="{Binding XPath=Cost}"/>
    <TextBlock Text="{Binding XPath=Description}"/>
    <CheckBox IsChecked="{Binding XPath=HotItem}"/>
    <TextBlock Text="{Binding XPath=Name}"/>
    </StackPanel>
    </DataTemplate>
    </Window.Resources>
    <Grid DataContext="{Binding Source={StaticResource InventoryXmlDataStore}}">
    <ListBox HorizontalAlignment="Left" Height="370"
    ItemTemplate="{DynamicResource ProductTemplate}"
    ItemsSource="{Binding XPath=/Inventory/Product}"
    Margin="65,55,0,0" VerticalAlignment="Top" Width="270"/>     
        </Grid>
    </Window>
    All looks quite the same except the <XmlDataProvider ....> part under <Window.Resources>, which is gone completely in my Xaml file.
    1, Why?
    2, How many different ways to deal with xml data source through WPF?
    Thanks, guys.
    (ps My "WpfXmlDataBinding" runs without problem through.)

    Never do yourself down Richard.
    Leave that to other people.
    It's quite common for smart developers to think they're not as good as they are.
    I coach a fair bit and it's a surprisingly common feeling.
    And to repeat.
    Never use anything ends .. provider.  They're for trivial demo apps.  Transform xml into objects and use them.  Write it back as xml.  Preferably, use a database.
    You want to read a little mvvm theory first.
    http://en.wikipedia.org/wiki/Model_View_ViewModel
    Whatever you do, don't read Josh Smiths explanation.  I used to recommend it but it confuses the heck out newbies. Leave that until later.
    Laurent Bugnion did a great presentation at mix10.  Unfortunately that doesn't seem to be working on the MS site, but I have a copy.  Download and watch:
    http://1drv.ms/1IYxl3z
    I'm writing an article at the moment which is aimed at beginners.
    http://social.technet.microsoft.com/wiki/contents/articles/30564.wpf-uneventful-mvvm.aspx
    The sample is just a collection of techniques really.
    I have a sample which involves no real data but is intended to illustrate some aspects of how viewmodels "do stuff" and how you use datatemplates to generate UI.
    I can't remember if I recommended it previously to you:
    https://gallery.technet.microsoft.com/WPF-Dialler-simulator-d782db17
    And I have working samples which are aimed at illustrating line of business architecture.  This is an incomplete step by step series but I  think more than enough to chew on once you've done the previous stuff.
    http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
    The write up for step2 is work in progress.
    https://gallery.technet.microsoft.com/WPF-Entity-Framework-MVVM-78cdc204
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • How to select a text frame that has been "Sent to Back"?

    Hi Framers,
    In FM 7.2 (all patches up to date, running on Windows XP Pro), I added a note inside a text frame next to an anchored frame holding an image. I nudged the text frame close to the image but it blocked out a tiny portion of the image. So I selected the text frame and from the Graphics menu clicked Send to Back.  Solved that problem, of course. Now I want to change the wording in the note but can't do it because the entire text frame has been sent to back -- how can I select it to Bring to Front so I can edit its contents???
    This MUST be something totally obvious, right?  Can I plead pre-holiday brain freeze?
    TIA,
    Gay

    galson wrote:
    Hello again, Sheila ;~)
    I selected all and moved my cursor all around the page (around various pages, actually, since Ctrl+A selects the entire chapter), and I see what you mean by the color of the arrow's head changing between black and white. Is it significant that the ONLY time it's black is when I'm outside the frame of the page itself? (That is, in the white, non-editable space around the actual frame borders on the page.) Clicking anywhere, whether inside or outside the active area, deselects everything.
    HOLD THE PRESSES!  Even though I *knew* I hadn't grouped my text frame with anything else, after reading your suggestion, I selected the page frame to make sure I hadn't somehow grouped it with my text frame: I hadn't -- but then, on a hunch, I sent IT (the page frame) to the back -- now I can select the text frame!
    I'm marking your response as answering my question and I'm also going to try to mark Peter's the same way, because each of you in your own way, helped me resolve this problem.
    Thank you both and HAPPY HOLIDAYS!  (Gee, and I didn't get either of you anything... maybe next year  ;~))
    Gratefully,
    Gay
    Hi, Gay:
    The "I-Beam" pointer tool is called the Smart Pointer, because it changes to an I-beam when it's over text, and to the Graphics Pointer tool when over a graphic, or part of a graphic, or when you press Ctrl. It's easy to select the main text frame when you Ctrl+click on its interior text area inadvertently, when you're trying to select an anchored frame edge, or when you use Ctrl+A to select all. It's frustrating to have some of these unintended events happen when you're not expecting them. Always work with View > Borders ON, to display the edges of objects and reduce confusion, and always watch where you click. You can zoom iin to large magnification to see things better.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How to access the Text Frame, when we use scrollable frame,

    Hi Friends,
    How to access the Text Frame, when we use scrollable frame,
    Thank you,
    [ Nav ]

    That's the same question:
    how can I access something (a page item) on a page…
    Answer: you need something unique in that object you can get a handle on.
    Or you use the selection a user of your script is doing and work with that selection…
    A "scrollable frame" is nothing special. What it makes it a "scrollable frame" is the DPS software.
    So you have to look for attached labels on the object, that identify the object for the PDS plug-in "Overlay Creator" as a "scrollable frame". That's possible with the "extractLabel("KeyString")" function. But you need to know the appropriate key-string in advance.
    In another of your thread in the DPS forum, I basically answered the question how to obtain those key-strings.
    When knowing the key-string you could loop through all your page items (you can skip all text frames) in the allPageItems-collection, to identify the "scrollable frame" by extracting the right label.
    If you have more than one "scollable frames" you need a second unique identifier for the particular object.
    That could be nearly any property.
    Keep in mind, there is no "scrollableFrames" collection in the DOM !
    Uwe

  • How can i use text expander with the new Mavericks,

    how can i use text expander with the new Mavericks,

    I regret upgrading to mavericks for the same reason
    ftamez wrote:
    how can i use text expander with the new Mavericks,
    Now I have been searching - and you have to buy an app and it will cost you $34.99 (what a rip off)

  • Use REGEXP_INSTR to find a text string with space(s) in it

    I am trying to use REGEXP_INSTR to find a text string with space(s) in it.
    (This is in a Function.)
    Let's say ParmIn_Look_For has a value of 'black dog'. I want to see if
    ParmIn_Search_This_String has 'black dog' anywhere in it. But it gives an error
    Syntax error on command line.
    If ParmIn_Look_For is just 'black' or 'dog' it works fine.
    Is there some way to put single quotes/double quotes around ParmIn_Look_For so this will
    look for 'black dog' ??
    Also: If I want to use the option of ignoring white space, is the last parm
    'ix' 'i,x' or what ?
    SELECT
    REGEXP_INSTR(ParmIn_Search_This_String,
    '('||ParmIn_Look_For||')+', 1, 1, 0, 'i')
    INTO Position_Found_In_String
    FROM DUAL;
    Thanks, Wayne

    Maybe something like this ?
    test@ORA10G>
    test@ORA10G> with t as (
      2    select 1 as num, 'this sentence has a black dog in it' as str from dual union all
      3    select 2, 'this sentence does not' from dual union all
      4    select 3, 'yet another dog that is black' from dual union all
      5    select 4, 'yet another black dog' from dual union all
      6    select 5, 'black dogs everywhere...' from dual union all
      7    select 6, 'black dog running after me...' from dual union all
      8    select 7, 'i saw a black dog' from dual)
      9  --
    10  select num, str
    11  from t
    12  where regexp_like(str,'black dog');
           NUM STR
             1 this sentence has a black dog in it
             4 yet another black dog
             5 black dogs everywhere...
             6 black dog running after me...
             7 i saw a black dog
    5 rows selected.
    test@ORA10G>
    test@ORA10G>pratz
    Also, 'x' ignores whitespace characters. Link to doc:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm#i1048942
    Message was edited by:
    pratz

Maybe you are looking for