How can I replace a range / the text in an XML tag

I want to replace a piece of text in an XML tag in a text frame.

In my input parameters, I have the In-design page number, UID text frame in this page and the name of the XML tag within this block of text

that surrounds my old text.

which interface/function/command can I use who can help me to replace the existing text with the input text?

for example:

[old text] --> [new text]

where [] is the XML tag with the name tag1.

After a few trails and POC, I was able to write the piece of code below.

It detects the start and end position of the marker and based on that we can replace the text inside. It will be useful.

InterfacePtr data (signalMgr, UseDefaultIID());

If (data == nil)

{

break;

}

UIDRef docRef = data-> GetDocument();

InterfacePtr doc (docRef, IID_IDOCUMENT);

IDataBase * db = docRef.GetDataBase ();

Get the spread

InterfacePtr spreadList (doc, UseDefaultIID());

Int32 spreadCount is spreadList-> GetSpreadCount();.

for (int32 spreadIndex = 0; spreadIndex)< spreadcount;="" spreadindex++="">

{

Get the reference to the spread

UIDRef spreadUIDRef (db, spreadList-> GetNthSpreadUID (spreadIndex));

Get the object of dissemination

InterfacePtr spread (spreadUIDRef, UseDefaultIID());

Int32 numberOfPages = spread-> GetNumPages();

for (int32 nPage = 0; nPage)< numberofpages;="" npage++="">

{

UIDList pageItemList (db);

spread-> GetItemsOnPage (nPage, & pageItemList, kFalse, kFalse);

Browse page items and save on the UID of executives.

Int32 pageItemListLength = pageItemList.Length ();

for (int32 j = 0; j)< pageitemlistlength;="" j++="">

{

UIDRef pageItemRef = pageItemList.GetRef (j);

InterfacePtr frame (pageItemRef, UseDefaultIID());

If (frame-> IsTextFrame())

{

Now try to get the position of the Guide to the XML tag

TextIndex 0 = startPos, endPos = 0;

IXMLReferenceData * xmlReferenceData = Utils()-> QueryXMLReferenceData (pageItemRef);

REF XMLReference = xmlReferenceData-> GetReference();

IIDXMLElement * element = REF. Instantiate();

InterfacePtr (REF.). Instantiate());

TagUID UID = element-> GetTagUID();

WideString elementName = element-> GetTagString();

for (int32 i = 0; i < element-=""> GetChildCount(); i ++)

{

ChildRef = element XMLReference-> GetNthChild (i);

InterfacePtr child_element (childRef.Instantiate ());

tagUID = child_element-> GetTagUID();

elementName = child_element-> GetTagString();

Int32 index = 0;

Utils()-> GetElementMarkerPositions (child_element, & startPos and endPos);

startPos += 1; to proceed exclude the starting tag

}

}

}

} / / Browse pages spread

}

Tags: InDesign

Similar Questions

  • How can I copy parts of the text of a pdf file in preview?

    How can I copy parts of the text of a pdf file in preview? For example, the beginning and the end part of a passage - copy not a few sentences in the Middle

    Select the first part of the text you want to copy. Press the command and option together and also select another passage of text. Now, press command + C to copy the two text selections.

    Hypothesis: The PDF did not limit content selection.

  • How can you replace 'Row' in the paging and the text of the error?

    Have developed by their Summit for a while, I just joined this forum today. I use Apex 4.2 and I want to know how to change the references to 'row' in these circumstances:

    (1) the text of pagination i.e. rows 1-30 of...

    (2) error in a table that is, enter a value for name (line 2)

    Call a record row is a little geeky and very well for people of origins RDBMS, but for client applications, especially those used by the public, row is at best a confusing term for them. This is especially true if customers read using the alternative interpretation of the word 'row', in other words an argument.

    Is there a way to replace to say something like ' bills 1-30 of...» "and enter a value for the name (2 products)'?

    Hello

    answer late bit then maybe you have already found a way.

    I checked and found that my solution seems to work for all languages but English... Sorry about that.

    For the English text, it does not seem possible to translate/replace text using the standard method, I wasn't aware of this.

    What you could do, it is to assign a different language to the application and assign some strings translate you this language (so although it is English just set it to Dutch and set the language of the app in Dutch). Text for which no translation is made must remain in English (which seems to be the default).

    I don't think that there is nothing wrong with the definition of the application in another language such as Dutch in Danish... not sure, but since I have not tried this for a complete application. Another localization parameters can be defined separately if necessary so I think this should work if necessary for you.

    See you soon

    Bottom

  • How can I add background to the text in the Image?

    How can I add exact background behind the text on the pictures?

    bg6.jpg

    Announces a form (with the marquee tool, for example) between the image and the text layer and reduce the opacity according to the needs.

  • How can we create ARC of the text as string options in illustrator?

    Hello

    I read illustrator js doc much time but you could not find any function that is responsible for the CRA the text as.

    Warp options in illustrator object-> deformation-> Make with Warp Envolop.

    Any body can help me, how can we have achieved that.

    Thank you

    Sana Ullah

    Hi Sana, distortion of the envelope is not scriptable.

  • How can I get rid of the text box in InDesign CS4?

    For some reason, I can't get rid of the surrounding area of my text, how can I get rid of this? The text is also a link so...

    Thanks in advance...

    Open hyperlink Panel, double-click your hyperlink under URL field. Set your appearance of hyperlink´s the form of Rectangle Invisible...

  • How can I get rid of the text over an image

    I have an image that has a generic text that I wish to erase or hide sort.

    If the text is not on a separate layer, use a combination of choice, clone and healing tools.  Please post a screenshot for a more specific suggestion.

  • How can I get rid of the text in my bookmarks bar? I want the favicons only, but I can't find the option to change in FF4.

    In the previous version of FF, I have close to 50 bookmarks visible with just the favicons, but now I only have 15. Without a doubt a step back, if there is no way to change it.

    You can do this with the Add on roomy Bookmarks Toolbar - https://addons.mozilla.org/firefox/addon/roomy-bookmarks-toolbar/

  • How can I replace or modify the colors in this image, to preserve transparency (resulting in different colors, where the colors meet)?

    Screen Shot 2015-12-13 at 9.14.44 AM.png

    It is a series of using channels to make choices and requires that each color you want to select a slightly different way to select colors. for example, to select, I illustrate how to get red of this image:

    I just realized that you don't have turn off the layers.

    Cmd/Ctrl-clicking on the icon of the Green chain to get this catalog it will be reversed of what you want, but don't worry about this now.

    CTRL/cmd-shift click on the blue channel:

    At this point, press ctrl/cmd-shift-i to invert the selection. Ctrl/cmd-alt/opt-SHIFT-click the icon of the red chanel will:

    You now have a selection of just the Red areas. Make new layer and who fill it with the color you want. Do this for all the other colors you want to isolate. you have to play to see what combinations of selections will work with each.

  • How can I replace my old ID with a new one.

    Yesterday I did and upgrade to 9.2 when finished my old ID pop up with my old email address, try to change but cannot do, how can I replace it with the new.  Sorry I don't have and Ipad 3gen.

    You will need to disconnect from the former Apple ID and then sign in with a new one.

  • content alert text without any XML tag

    Hi all

    For the XML workflow.

    Need of a content alert or select the content of the text without any xml tag.

    Please help for my XML application.

    Concerning

    Siraj

    Try this,

    var myDoc = app.activeDocument;
    var myPages = myDoc.pages;
    for(i=0; i
    

    Vandy

  • How can we replace the display of a keon?

    I am a representative of the Mozilla's Rwanda.

    I gave one of the 3 keons, I got from Remo to a member of my community to work on applications, and the screen is broken on his watch. How can I replace the screen?

    AZ charadi
    Mozilla Rwanda Rep
    https://mozillians.org/en-US/u/AZ/ | https://reps.Mozilla.org/u/AZ/

    AzAnitah said

    I am a representative of the Mozilla's Rwanda.

    I gave one of the 3 keons, I got from Remo to a member of my community to work on applications, and the screen is broken on his watch. How can I replace the screen?

    AZ charadi
    Mozilla Rwanda Rep
    https://mozillians.org/en-US/u/AZ/ | https://reps.Mozilla.org/u/AZ/

    Hi Liz Az,.
    I think it will be better if consult you with the Center nearest mobile maintenance any hardware problem.

  • I am trying to replace my iphone 6 s model n °: A1688, FCC ID: BCG-E2946A, IC: 579C-E2946A. but I can get the serial number because its doesn't turn only not on how can I replace it?

    I am trying to replace my iphone 6 s model n °: A1688, FCC ID: BCG-E2946A, IC: 579C-E2946A. but I can get the serial number because its doesn't turn only not on how can I replace it?

    Take it to your local Apple store. They will find it for you.

  • HOW CAN I REPLACE EXPIRED INK CARTRIDGE IN THE PRINTER ALL IN ONE HP OFFICEJET PRO L7780?

    HOW CAN I REPLACE EXPIRED INK CARTRIDGE IN THE PRINTER ALL IN ONE HP OFFICEJET PRO L7780?

    I DO NOT PRINT A LOT AND I HAVE TWO PRINTERS. THE EXPIRATION DATE ON THE CARTRIDGE, THE PRINTER DOSE NOT LET ME PRINT. I KNOW THAT THERE IS WAY TO OVERRIDE THIS PROBLEM, BECAUSE ON MY PREVIOUS PRINTER THEY REPLACES THE KEY.

    The error message itself will remain but will continue to print. This message will remain until the cartridge is replaced. Substitution is the printer printing always regardless of the error message on the display screen.

  • How can I replace the Playlists tab on bottom of Apple's music with the Connect tab?

    How can I replace the Playlists tab on bottom of Apple's music with the Connect tab?

    Found my own answer online.  It's in the Restrictions under settings.

Maybe you are looking for