Place a 'point' inside xml tags

Hello

I need to insert a point, if a column is empty. But when I use search and replace method removes the tag between the legs. Is it possible to place a point without affecting the xml tags?

Screen Shot 2016-09-09 at 3.03.20 PM.png

app.findGrepPreferences = null;     app.changeGrepPreferences = null;  
app.findGrepPreferences.findWhat="\\t\\t";
app.changeGrepPreferences.changeTo= "\\t.\\t";
app.changeGrep();

Thank you

K

var main = function() {  

  var doc = app.properties.activeDocument,
  found, n, xe;  

  if ( !doc || app.selection.length!=1 || !app.selection[0].properties.parentStory ) return;  

  sel = app.selection[0];
  (sel instanceof TextFrame) && sel = sel.parentStory;

  var xes = sel.associatedXMLElements;
  n = xes.length;

  while ( n-- ) {
  xe = xes[n];
  xe.contents=="" && xe.contents=".";
  }
}  

main();

Tags: InDesign

Similar Questions

  • delete the text that is inside xml tags

    Hello

    I want to delete the text that is in the xml tags

    IE SELECT ' < XXX > Pune < / XXX > < HD ZZZ > < / ZZZ > ' FROM DUAL must return PuneMH

    Thank you

    VIvek

    Published by: Vivek P on October 7, 2008 08:35
    SQL>
    SQL> --
    SQL> with t as (
      2    select 'PuneMH' as x from dual)
      3  --
      4  select x,
      5         regexp_replace(x,'<.*?>') as modx
      6    from t;
    
    X                            MODX
    ---------------------------- ----------
    PuneMH PuneMH
    
    SQL>
    SQL>
    

    isotope

  • Extract the value between the xml tags in the XML inside the BLOB field

    Hello

    I have a table that contains a BLOB column, this XML file to store column that received from an external source. Now for one of my needs. I need to read that value is the specific XML tag and create the entry in the database.

    Column name DataType
    IDNumber
    RecordBLOB OBJECT

    This is the XML code that is stored in the file inside the BLOB field format. XML below, I need go get AMC1234 there is after < itemName > text < / itemName > I thought to use XMLTYPE, but unfortunately my DBA team does not XML database, I now use UTL_RAW. CAST_TO_VARCHAR2 and recovery entire string, but I am not able to read actual result it takes. Can someone help me remove AMC1234.

    <? XML version = "1.0"? >

    <! DOCTYPE importFile SYSTEM "xyz.dtd" >

    -< importFile >

    -< importResult >

    < mode status = "DΘFINIR" > general failure < / status >

    < statusCode > 1 < / statusCode >

    invalid < errorMsg > list and holiday component < / errorMsg >

    -< returnInfo >

    < itemName > PRQ < / itemName >

    < Valeurelement > CBA < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > LMP < / itemName >

    < Valeurelement > CBA < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > KEY < / itemName >

    < Valeurelement > 9999 < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > text < / itemName >

    < Valeurelement > AMC1234, FIXED_ALL, RED < / Valeurelement >

    < / returnInfo >

    < / importResult >

    < / importFile >


    Thank you

    Without

    Without - try something like...

    with t as (select"

    -

    -

    General failure

    1

    component and invalid vacation list

    -

    PRQ

    ABC

    -

    LMP

    ABC

    -

    KEY

    9999

    -

    Text

    AMC1234, FIXED_ALL, RED

    "the double pass."

    )

    Select Replace (regexp_substr (col,'([^<>']) itemName))

    , replace (regexp_substr (col,'([^<>""]) Valeurelement))

    t

    connection of level <=> ');

  • Create text online the content of a xml tag frame?

    Hello! I have a pretty big document created from an XML file, and I would like to convert a series of my XML tags to the anchor text blocks, so I can hang them on the left edge of the lines they appear in.

    My XML file is converted into a

    > root

    > Chapter

    > para

    > id

    1

    > verse

    text

    > id

    > verse

    etc... See extract file here http://1drv.ms/1dX6lYO

    So far, I have the following, which gets me an array containing all the elements ID.

    var myDocument = app.activeDocument;
    var myXMLidElement = myDocument.xmlElements.itemByName("book").xmlElements.itemByName("c").xmlElements.itemByName("p").xmlElements.itemByName("id");
    var myXMLidText= (myXMLidElement.contents);
    var myXMLidLength = myXMLidText.length;
    for (var i = 0; i < myXMLidLength; i++) {  //loop to go through
        //alert (myXMLidText[i]);
        myDocument.select(myXMLidText[0]);  //this gives me an error saying expected data type needs to be array. Can someone explain? Where do I find info on the select command?
        myDocument.selection[0].insertionPoints[0].textFrames.add(myXMLidText[0]); //haven't managed to get to this line yet, but I want it to create an inline text frame at the point of the selected text and set the frame's contents to be my XML Id Text
    

    I guess I want and then delete all the text in my id too, but that's not important.

    Some other random excerpts, I could use?

    myInlineFrame.contents = "myXMLidText";
    

    Guidance on the creation of the inline frames and the logic of loop? I'm an old hand with InDesign, but new to scripting, so be gentle.

    Try this,

    var myDocument = app.activeDocument;
    var root = myDocument.xmlElements[0];
    var myXMLidElement = root.evaluateXPathExpression("//book/c/p/id");
    for (var i = 0; i < myXMLidElement.length; i++)
    {
        myDocument.select(myXMLidElement[i]);
        var myTextframe = myXMLidElement[i].placeIntoInlineFrame(["1p","1p"]);
    }
    
  • Cannot delete the XML tag

    Hi all! Working in InD CS6 in Windows 7.

    I have a XML element in a document that I can't do anything with and who does not appear to be associated with what in the file of the InD. The red line is pointing to it on the Panel Structure in the image below. Note the X through its icon.

    ErrantXMLElement.JPG

    The XML is added to the InD file by mapping tags to styles using the Load... button on the dialog box map tags to Styles and 'import' of another document of the InD.

    When right clicking this item in the Structure of Panel and selecting go to point the current selection goes, but then nothing else happens. Or to delete this in the Panel of Structures . I had a similar problem, a bit a go where I somehow finished with elements in the XML file that were not associated with what anyone in the document. Had those text display in the Structure Panel after the name as shown above, but, even once, go at them will not anywhere. I hadn't studied at the time because I could simply remove it from the structure.

    With this element, however, I can't get rid of it without marking not any frame.

    So, I guess I really questions. It's this thing! How the hell he get there? And is there a better way to remove it rather than not tagging any of the frame and have to re - mark all content.

    EDIT: Just found out that using the trash on the pallet Structure to remove the parent of the problematic element, indeed, removes as problematic. Before him, I was just not marking the parent who has transferred only the problem child (like these word games) for the previous parent.

    Thanks for reading this way-too-long-post.

    All the best,

    Ken

    OK (he said with a blush to cheeks) I get noticed something in common, I didn't before posting.

    Page to which cchimi kindly provided a link described icon as a part empty, and it is attached to an empty block. However, it is not only an empty block.

    What happened in our file, is that the script containing the tag with an anchor marker tag xml that InD apparently do not like much. Type of logic, really.

    Now, I may be cracking, but with a single instance of the element of 'bad' I thought THAT I could see the empty element in the story discovers with the anchor to a few characters on. I selected the anchor and dragged back between the start and end code and icon of the item has changed and he returned 'alive', I was able to handle it. For most other troublesome elements, however, sinpy AND marking a marker of the anchor, the XML tag does NOT display in story mode. The element gets the empty icon when you simply tag the anchor marker, in this case it is an anchor for a rule.

    Hope this might help someone, someday.

    Thanks again for reading.

  • Wandering XML tag

    Hi all! Working in InD CS6 in Windows 7.

    I have a XML element in a document that I can't do anything with and who does not appear to be associated with what in the file of the InD. The red line is pointing to it on the Panel Structure in the image below. Note the X through its icon.

    ErrantXMLElement.JPG

    The XML is added to the InD file by mapping tags to styles using the Load... button on the dialog box map tags to Styles and 'import' of another document of the InD.

    When right clicking this item in the Structure of Panel and selecting go to point the current selection goes, but then nothing else happens. Or to delete this in the Panel of Structures . I had a similar problem, a bit a go where I somehow finished with elements in the XML file that were not associated with what anyone in the document. Had those text display in the Structure Panel after the name as shown above, but, even once, go at them will not anywhere. I hadn't studied at the time because I could simply remove it from the structure.

    With this element, however, I can't get rid of it without marking not any frame. I have a script routine that updates the XML attributes based on the style (s) applied to them. This element, but causes a script script error trying to access to the. Text (1), because there is not, I guess. The script goes through all the XML elements in order to open the Structure and use. Select the item to select an error occurs. But that's ALL!

    So, I guess I really questions. It's this thing! How the hell he get there? And can I do in scripts for "see" it as one element is wandering?

    Thanks for reading this way-too-long-post.

    All the best,

    Ken

    OK (he said with a blush to cheeks) I get noticed something in common, I didn't before posting.

    Page to which cchimi kindly provided a link described icon as a part empty, and it is attached to an empty block. However, it is not only an empty block.

    What happened in our file, is that the script containing the tag with an anchor marker tag xml that InD apparently do not like much. Type of logic, really.

    Now, I may be cracking, but with a single instance of the element of 'bad' I thought THAT I could see the empty element in the story discovers with the anchor to a few characters on. I selected the anchor and dragged back between the start and end code and icon of the item has changed and he returned 'alive', I was able to handle it. For most other troublesome elements, however, sinpy AND marking a marker of the anchor, the XML tag does NOT display in story mode. The element gets the empty icon when you simply tag the anchor marker, in this case it is an anchor for a rule.

    Hope this might help someone, someday.

    Thanks again for reading.

  • 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

    }

  • Assign paragraph styles to xml tags correctly. How?

    Hello


    I want to assign xml tags to paragraph styles in InDesign CS6 on a Mac 10.6.8. The XML itself is organized as follows:


    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >

    < catalog >

    < article id '32434' = >

    "< img href="/bilder/32434.tiff "/ >

    < artikeltextgruppe >

    < artikelmarke > DieselGabana < / artikelmarke >

    < artikelheadline > super Jeans ist < / artikelheadline >

    < artikeltext > Superjeans knallt kidney. < / artikeltext > < number > 70238 < / weight >

    < artikelmaterial > 100% Jeans < / artikelmaterial >

    < artikelgroesse > UK < / artikelgroesse >

    < artikelfarbe > UK < / artikelfarbe >

    < / artikeltextgruppe >

    < / product >

    < / katalog >


    By selecting the option "Assign formats by name to the tags' (translated from the German), I wanted to create the desired look. But if I start all I get is the entire < artikeltextgruppe > textblock assigned to 1 formatstyle. And not to mention that the whole content of < artikeltextgruppe > resembles a single paragraph without any structure (no line breaks) the content is properly structured, because I can highlight the value of e.g. < artikelmarke > separately by doubleclicking the tag in the structure view.


    (a) what can I do to assign formats correctly AND to have correct line breaks?

    "(b) if I drag my node < img href="/bilder/32434.tiff "/ > iin the layout, I get a message posted to search again for the location of the correct reference. And this happens independently on the use of the relative or absolute references (even if I need to use those on) what can I do here?

    Thank you very much

    First of all, I have probably do a search and replace to remove the group element with a text editor ( and elements). They aren't really necessary.

    Secondly, I usually create my styles with the same names as the items themselves. Then, after the XML is imported, I use the command "map tags to styles" in the Structure pane.

    I copied and pasted the single article element to create 4 folders, added a change to an image for each record of the item. Once the paragraph styles have been mapped, your XML looked like this in form of two columns (to get all 4 records on a page)...

    By default, ID creates a single line to a single line in the XML file. So if you want to be on their own line of the elements, the XML must be formatted like this. If you need a different style within a paragraph, you create character styles and edit the items in a group of XML and or paragraph and add the code in the XML file accordingly or post-processing once inside the code.

    I still need to take the XML I gives me and reformat, moves with the tree items, change the links to the images, delete tabs and or spaces where I do not want, tag character styles, etc., to be closer to how I want the original format to be.

    Mike

  • Remove and replace XML tags

    How can I delete a XML tag and replace using script? There is a function for adding tags in the document (activeDocument.xmlTags.add("xml-tag")), but I cannot find a corresponding function to delete it and replace it with another, as you would in the GUI.

    I tried to accomplish this by changing the name of the tag to one I tried using the code below, but it throws the error: "a label with the same name already exists.  Please choose another name. »

    for(var i=0;i<xmlTags.length;i++){
         xmlTags[i].markupTag.name = "existing-xml-tag";
    }
    

    Anyone know of a way around this error or should I use another method entirely?

    OK, it was not so difficult to solve. I was looking in the wrong place that's all. Function remove (replaceWith) is available in the XMLTag class. That means that the followin code removes the tag called "p-news-topic" and replaces it with the existing tag called 'p '.

    myDoc.xmlTags.itemByName("p-new-section").remove("p");
    
  • How can I find and replace the xml tags?

    Hi, I am using xml in my workflow and want to be able to remove some tags if they contained particular text.

    Here is an example of the xml struct...

    < Entry >

    < name > DEFAULT < / name >

    < such > default < / such >

    DEFAULT < address > < / address >

    < / Entry >

    I use this initial structure to define paragraph styles to follow when you import the xml data.

    This leaves DEFAULT in place everywhere where an entry is not any content of this field.

    I want to be able to import my XML and then run a script that deletes tags that include by DEFAULT, - I need to the xml tag to remove not only the text, if I do a normal find and replace will remove only the text not the tags that is causing problems with style. I also want to remove the end of para/return (^ p) that I placed at the end of the line. So it would be the same opening editor mode and removing content, tags + hard back in there, but I want to automate the process...

    So I think that's what I'm looking for in each case

    "< name > DEFAULT < / name > ^ p.

    and I want to replace it with nothing.

    Is this possible in a script (ideally javascript)?

    I have a little knowledge of javascript, but don't know how to search for and target this kind of string in indesign...

    using indesign cs5

    Thank you very much

    Hello

    Script should do it in two steps:

    1 find all occurrences of that is ' > by DEFAULT.<>

    2 delete the whole paragraph which is a found_text container.

    For example, in this way - JS - (a textFrame filled your text must be selected):

    var mStory = app.selection[0].parentStory;
    app.findTextPreferences =  null;
    app.findTextPreferences.findWhat = ">DEFAULT<";
    var myF = mStory.findText();
    var count = myF.length;
    while (count--)
         myF[count].paragraphs[0].remove();
    

    Rgds

  • CS3: Editing of XML tags delete behavior

    Hello world

    I try to import the XML - tag text into InDesign and use tags to map styles to give it the correct formatting automatically. It works perfectly, but it seems to be a problem when I try to remove or mitigate the paragraphs. In a normal document, deleting a paragraph leaves the next paragraph intact. In my document XML-filled, when I delete a paragraph, following paragraph takes the style of the para, I just deleted. I really want to do this!

    Any of you have seen this effect before? Is the problem to do with the way my XML tags are structured? I'm not having luck with the research for this problem, but maybe I don't know the right words...

    The tag level paragraph around the next paragraph remains intact, so if I reapply my mapping tags-for-styles, paragraph misstyled now is corrected (but restylings I made or substitutions are eliminated). However, if I remove the brand throughout the document, it refers to the correct behavior.

    I would really appreciate any advice you may have on what I'm doing wrong here. It's probably a rookie mistake, but I don't see what I'm doing wrong. I use InDesign CS3.

    Thank you very much!

    Lester Hawksby

    Of the operation when you map tags to styles?

    I suspect what could happen is that some of the paragraphs were initially marked by quadruple-click or by mapping styles to tags. One of these involves paragraph returns are included in the tags, so that closing tags occur at the beginning of new paragraphs. Then, when you delete a paragraph, you're left with remnants of old labels of this paragraph (with nothing inside) in the following paragraph. (Check the editor mode to test this.) Now, if you map tags to styles at this stage, a paragraph with residual tags like these can be given the style of a paragraph that was deleted.

    The way to avoid it is to ensure the closing tags occur before paragraph returns - but of course if you get InDesign to "clone" for repeated XML elements, the resulting 'cloning' behavior will be different. Consider the possibility of not to include the content of the white elements only to fix. It will probably take a bit of trial and error to work exactly as you want, but it is by for the course!

    Jeremy

  • What is the easiest way to read a value of XML tag

    Hi all

    Im not at all experienced in the use of the XML parser library.

    How can I retrieve the value of the label?
    I use the matching node get all (see attachment). Get XML gives me:

    ABDELKADER<p class="help"> <p class="help">How can I retrieve the value of the tag (AAAA), without the XML tags directly?</p> <p class="help">Thank you all</p> <p class="reply">You can use the get node text Content.vi of the same range as the other function XML you use.</p> <p class="reply">From a node property uses the "node value".</p>

  • regular expression for the xml tags

    Dear smart people of the labview world.

    I have a question about how to match the names of xml text elements.

    The image that I have some xml, for example:

    Peter

    13

    and I want to match all of the names of elements, that is to say: no, son, grandson, age, regardless of any attribute have these items. There is a regular expression, I can loop, that can do this? (Something like "\<.+\> ". "") It is no good because it matches the entire xml string.) I'd really only two different expressions, one for the match start elements, e.g. and one for the correspondence of the elements, for example.

    Thanks for your help in advance!

    Paul.

    The site Of regular Expressions will be very convenient.

    They have some good tutorials on regexp with a demo of the XML tags:

    Here is a small excerpt:

    The regular expression <\i\c*\s*>matches an opening of the XML without the attributes tag corresponds to a closing tag. <\i\c*(\s+\i\c*\s*=\s*("[^"]*"|'[^']*'))*\s*>corresponds to an opening with a number any attributes. Put all together, <(\i\c*(\s+\i\c*\s*=\s*("[^"]*"|'[^']*'))*| i\c*)\s*="">corresponds to an opening with attributes or a closing tag.  (source)

    If you want advanced XML analysis I suggest JKI XML toolkit.

    Tone

  • the procedure entry point readerconstname xml text could not be located in dynamic link library libxml2.dll

    I found the following message in my laptop computer startup sequence, after I login to my account.

    the procedure entry point readerconstname xml text could not be located in dynamic link library libxml2.dll

    Does anyone know what I did wrong in order to get this particular message.

    THX

    Hi Flavio Ferrando,

    ·         Did you do changes on the computer before the show?

    Follow the suggestions below for a possible solution:

    Step 1: Start in safe mode and check if the problem persists.

    Start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    Step 2: If the problem does not occur in safe mode, you can put your system to boot (in normal mode) to solve the problem.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: After troubleshooting, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

    Hope this information helps.

  • Need help to find and replace grep using Xml tags!

    Hello world

    I have a Textframe with value ($ 00.00) between two xml tags. a tag for "$" and another for a value (00 h 00).

    Now I find these value (00 h 00) and change value (24.10). If I run the script, removing the price tag XML and updated price.

    My expectation is the value of these update without deleting the XML tag.

    Please suggest me where I made the mistake in the code. Please find the code and screenshot for your reference.

    Before running the Script: After running the Script:                                                                                                             

    Screen Shot 2016-09-17 at 5.03.18 pm.pngScreen Shot 2016-09-17 at 5.09.31 pm.png

    Code:

    var flgGREP="[$]\\d+[.]\\d+"
    var Price="$24.10"
    myLine=app.selection[0];
    FindReplaceValue(flgGREP,Price,myLine);
    function FindReplaceValue(findValue,replaceValue,Sapps){
        app.findGrepPreferences = app.changeGrepPreferences = null;  
        app.findGrepPreferences.findWhat = findValue;  
        app.changeGrepPreferences.changeTo = replaceValue;
        Sapps.changeGrep(); 
    }
    

    -yajiv

    This is because the XML (opening and closing of the representations) tag is a special character but a generic.

    So the above grep model fails because you have a text like [TAG] $[TAG] [TAG] 00.00 [TAG] is not picked up by the grep engine.

    However there is not (unless I'm wrong) a metacharacter which could identify the brands of tags. You can do this in text F/R, but of course it is not as smooth as grep.

    Bad news is that these special characters are not saved if you F/R on a labeled content (I mean in the above case).

    Good luck for you is that you seem to know the markupTag that host the price = copy_frame so I'd domething like:

    var root = app.activeDocument.xmlElements[0];
    var copy_frame_tags = root.evaluateXPathExpression (".//copy_frame" );
    var tag;
    
    while ( tag = copy_frame_tags.pop() ) {
         tag.contents=="00.00" && tag.contents="24.10";
    }
    

    HTH

    Loïc

    Ozalto | Productivity-oriented - Loïc Aigon

Maybe you are looking for