[JS-CS4] Associated XML element...

Hi,
I'm going crazy with this.
I have a table built with XML import and I need to get the XML element associated with a cell.
I use this code:
cell.associatedXMLElement
but it always returns "null".
Obviously that cell has a content in XML structure...
Any idea why?
Thanks.

Here's my script:
var my_doc = app.activeDocument;
var my_table = my_doc.pages.firstItem().textFrames.firstItem().tables.firstItem();
my_table.columns.firstitem().select();
var my_selection = doc.selection;
for(var c = 0; c < my_selection.length; c++){
     if(my_selection[c].associatedXMLElement.xmlAttributes.itemByName("type").value != "house"){
          my_selection[c].appliedCellStyle = doc.cellStyles.itemByName("column");
          my_selection[c].clearCellStyleOverrides(true);
This will run once the table is placed through XML import
I need to check the "type" XML attribute value for every XML cell, that's why I'm performing that if statement.
Basically if a cell's XML element has a "type" attribute with "house" value the script will not apply the "column" style.
The problem is that
my_selection[c].associatedXMLElement
always return null.
The XML data structure is:
<List><Category><Table><Cell/><Cell/>....</Table></Category></List>
So I have a simple table inside a textFrame.
I know what I'm doing could sound weird, but I experienced it's the most quick way to handle a big table within ID.
Here's the background story
Thanks again.

Similar Messages

  • [AS][CS4] How to get XML element of grep find result?

    Hi,
    Does anyone know how to get the xml element of a grep find result?
    I have multiple text frames, each containing multiple paragraphs. Each paragraph can contain one or more different xml tagged pieces of text.
    Using a simple search function I can locate the text I need, but how do I retreive the xml element applied to that piece of text.
    Using the "associated XML element" property, it doesn't work.
    set find what of find grep preferences to "€( )*(\\d)*"
    tell active document
              set myResult to find grep
              set myItem to item 1 of myResult
              set myElement to associated XML element of myItem
              -- The last line throws an error
    end tell
    The find result will return a collection of text objects.
    Thanks
    John

    Well I found this post that answered my question
    http://forums.ni.com/t5/LabVIEW/how-to-get-records​et-from-database/m-p/1471374?requireLogin=False

  • 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());

  • Set xml element for table

    Hi guys,
    I am new to indesign scripting using applescript.
    my code is shown in below, my problem is can't set xml element for table
    tell application "Adobe InDesign CS6"
            tell active document
                set rootele to associated XML element of story 1
                if rootele = nothing then
                    set rootele to XML element 1
                end if
                tell story 1
                    select text 1
                    set markup tag of selection to "table" -----------------> this is my problem please help me.
                              end tell
            end tell
        end tell
    this code is right or not. please help me.

    The metadata about the table mappings are also stored in the compiled XML Schema document. If you lookup the schema document located at /sys/schemas/.... , you will see that the element with SQLInline=false will have a xdb:defaultTable attribute which provides the name of the table used to store the element.
    - Ravi

  • 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;

  • [JS-CS4] - How to read the XML Element and its Attributes

    Dear All,
      I have the doubt regarding: reading the xmlElement and its attributes.
    Here I droping the xml script
    //============= Start ======================//
    var myDoc = app.activeDocument;
    var Fpath = File("../Projects/Entity_map.xml");
      if (Fpath.exists)
       Fpath.open("r");
       var Cont= Fpath.read();
      var roots = new XML(Cont);
      var myEveryName = new Array();
      var myEveryContent = new Array();
      var myEveryAttributes = new Array();
      traverse(roots);
    //$.writeln(myEveryName);
    //$.writeln(myEveryContent);
    $.writeln(myEveryAttributes.length);
    for(var i=0; i<myEveryAttributes.length; i++)
      $.writeln(myEveryAttributes[i]);
    function traverse(tree) {
        myEveryName.push(tree.name());
    myEveryContent.push(tree.text());
      myEveryAttributes.push(tree.getAttribute);
    // you get the contents by using .text() insted of .name()
        if(tree.elements().length() > 0) {
            for(var i=0; i<tree.elements().length(); i++) {
                traverse(tree.elements()[i]);
    //============== End =====================//
    and the XML Structure is
    //===============XML =====================//
    <?xml version="1.0" encoding="UTF-8"?>< Entity_Convertion>
    < Entitys char="Ç" GID="173"/></ 
    Entity_Convertion>
    //===============End ====================//
    Here I'm getting the XML Elements and its contents, but not xmlAttributes.
    Please any one can help me, then I will appreciate...
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear All,
      I have the doubt regarding: reading the xmlElement and its attributes.
    Here I droping the xml script
    //============= Start ======================//
    var myDoc = app.activeDocument;
    var Fpath = File("../Projects/Entity_map.xml");
      if (Fpath.exists)
       Fpath.open("r");
       var Cont= Fpath.read();
      var roots = new XML(Cont);
      var myEveryName = new Array();
      var myEveryContent = new Array();
      var myEveryAttributes = new Array();
      traverse(roots);
    //$.writeln(myEveryName);
    //$.writeln(myEveryContent);
    $.writeln(myEveryAttributes.length);
    for(var i=0; i<myEveryAttributes.length; i++)
      $.writeln(myEveryAttributes[i]);
    function traverse(tree) {
        myEveryName.push(tree.name());
    myEveryContent.push(tree.text());
      myEveryAttributes.push(tree.getAttribute);
    // you get the contents by using .text() insted of .name()
        if(tree.elements().length() > 0) {
            for(var i=0; i<tree.elements().length(); i++) {
                traverse(tree.elements()[i]);
    //============== End =====================//
    and the XML Structure is
    //===============XML =====================//
    <?xml version="1.0" encoding="UTF-8"?>< Entity_Convertion>
    < Entitys char="Ç" GID="173"/></ 
    Entity_Convertion>
    //===============End ====================//
    Here I'm getting the XML Elements and its contents, but not xmlAttributes.
    Please any one can help me, then I will appreciate...
    Thanks & Regards
    T.R.Harihara SudhaN

  • Adding text to parentStory destroys XML element / JavaScript, InD CS4

    Dear scripters,
    I'm currently stuck with this problem:
    - I'm writing text to text frames on a layout page
    - while writing some characters/strings are XML tagged (I'm creating an element)
    - I can do this only once, because adding more text after I have created an XML element destroys the link to the element
    Here's my sample:
    var MyBox = app.activeDocument.textFrames.add();
    MyBox.geometricBounds = ["0pt","0pt", "200pt", "200pt"];
    //Fill some content into the text frame
    MyBox.parentStory.contents = "bla";
    //create a xml element for some of the text
    app.activeDocument.xmlElements.item(0).xmlElements.add("test1", MyBox.parentStory.characters.itemByRange(1, 2));
    //so far so good...
    //now some calculating
    var result = "456";
    //add result to the text frame
    //doing this destroys the link to the existing xml element
    MyBox.parentStory.contents += result;
    //doing this creates a new xml element with the wrong characters selected and linked
    app.activeDocument.xmlElements.item(0).xmlElements.add("test2" , MyBox.parentStory.characters.itemByRange(4, 2));
    Can someone please help on?
    Best regards,
    TYPO

    Hello Harbs,
    thank you, it almost works now; the xml element brackets are not destroyed anymore.
    The only problem I have now is that the second element becomes a  child of the first one.
    How can I force each element to  be "independent"?
    Here's the code:
    var MyBox = app.activeDocument.textFrames.add();
    MyBox.geometricBounds = ["0pt","0pt", "200pt", "200pt"];
    var MyContent = "bla";
    MyBox.parentStory.insertionPoints[-1].contents = MyContent;
    MyBox.parentStory.characters.itemByRange(-1, -MyContent.length).select();
    app.activeDocument.xmlElements.item(0).xmlElements.add("test1" ,app.activeDocument.selection[0]);
    MyContent = "456";
    MyBox.parentStory.insertionPoints[-1].contents = MyContent;
    MyBox.parentStory.characters.itemByRange(-1, -MyContent.length).select();
    app.activeDocument.xmlElements.item(0).xmlElements.add("test2" ,app.activeDocument.selection[0]);
    Best regards,
    TYPO

  • Create XML Element Tag BasedOn Found Character Style

    Hi,
    Good Day!
    Basically I want to search only for character styles that contains "ntb-", that is why it is hard coded in my searchString variable.
    Although I was able to create XML tag based on selected character style, but it will always add/insert at the end of the parent XML element.
    Can anyone could help me how insert/add that element at the insertion point where the text is found?
    Thanks,
    --elmer
    var myDoc = app.documents[0];
    myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;
    myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
    var charStyles = myDoc.allCharacterStyles;
    var foundStyles = Array();
    var searchString = String();
        searchString = 'ntb-';
    var tempName = String();
    var tempName1 = String();
    for(var i = 1; charStyles.length > i; i++){
       tempName = charStyles[i].name;
       tempName1 = tempName.toLowerCase();
       if(tempName1.indexOf (searchString.toLowerCase()) != -1){
           foundStyles.push (tempName);
    var myDialog = app.dialogs.add({name: "Convert Footnote Character Styles to XML Tags",canCancel:true});
    with (myDialog) {
        with (dialogColumns.add().borderPanels.add()) {
            with (dialogColumns.add()) {
                staticTexts.add({staticLabel: "Character style to search : "});        }
            with (dialogColumns.add()) {
                selCharStyle = dropdowns.add({stringList: foundStyles, selectedIndex: 0, minWidth: 175});
    var dialogShown = myDialog.show();
    while (dialogShown) {
        if (selCharStyle.selectedIndex == 0) {
            alert("Must have at least a character style to search!");
            dialogShown = myDialog.show();
            continue;
        } else {
            insertXMLTags(selCharStyle.stringList[selCharStyle.selectedIndex], selCharStyle.selectedIndex, "0");
            break;
    myDialog.destroy();
    alert("Finished!");
    exit();
    function insertXMLTags(cStyle, cStyleIndex, ip) {
        var myFinds = searchStyle(cStyle, cStyleIndex);
        for (i=myFinds.length - 1; i>=0; i--) {
            var myIP = myFinds[i].texts.item(0).insertionPoints.item(0);
            var myParentXML = myIP.associatedXMLElements[0];
            var myChiidXML = myParentXML.xmlElements.add ( cStyle );
            myChiidXML.contents =  myFinds[i].contents;
            //set the selection
            app.selection = myFinds[i].texts.item(0);
            //remove the selected text
            myFinds[i].texts.item(0).remove();
            Utility Functions         
    function searchStyle(cStyle, cStyleIndex){
        var myFinds;
        // if script version is for Indesign CS2
        if (app.scriptPreferences.version < 5){                                 
            app.findPreferences = NothingEnum.nothing;
            app.changePreferences = NothingEnum.nothing;
            myFinds = myDoc.search(undefined, undefined, undefined, undefined,
            {appliedParagraphStyle: pStyle, appliedCharacterStyle: cStyle});
        // else, for CS3 and CS4
        }else{                                 
            //Clear any existing find/change settings
            app.findTextPreferences = NothingEnum.nothing;
            app.changeTextPreferences = NothingEnum.nothing;
            // set character or paragraph style to search
            if (cStyleIndex != 0){ 
                app.findTextPreferences.appliedCharacterStyle = cStyle;
            //Set the find options.
            app.findChangeTextOptions.caseSensitive = false;
            app.findChangeTextOptions.includeFootnotes = true;
            app.findChangeTextOptions.includeHiddenLayers = false;
            app.findChangeTextOptions.includeLockedLayersForFind = false;
            app.findChangeTextOptions.includeLockedStoriesForFind = false;
            app.findChangeTextOptions.includeMasterPages = false;
            app.findChangeTextOptions.wholeWord = false;                             
            myFinds = myDoc.findText();
        return myFinds;

    Here is a way you can find any field.
    Download the current template.
    Open it in word and go to the line that you are interested in.
    The blanket PO# will be a field. Right click on it and go to properties. You will see the xml element there.
    Hope this answers your question,
    Sandeep Gandhi

  • Selecting the content of XML element CS3(JS)

    Hi
    I am trying to select the whole content of XML Element.
    I am trying like this
    app.activeDocument.xmlElements[i].select();
    But it is not working.
    Regards
    Suresh

    A few hints:
    Perhaps your variable
    i i
    is not defined. If that's the case, give up trying to write code for this complicated job! XML is not the easiest part of ID to begin with. Starting with uninitialized variables and flagging that as an error (and complaining about that in a forum) is a beginners' blunder.
    If I run your script line with i set to 0, the first element of my XML structure is selected. I can see with my own eyes it works, because I have the XML Structure pane in ID open. If I click on the 2nd element there and run your script line, the top (= 0th) element is selected. Perhaps you didn't open the XML Structure view so you did not see it worked after all. Or perhaps you expected something
    i else
    to be selected -- the text content, maybe -- so you tag it as "error". That's a misinterpretation of what the XmlElement object is. Understandable, but still not an error. You can have lots of XmlElements without any text or other object associated. If it was your intention to select whatever the xml element contains, try working with the property 'xmlContent'. From its description I gather that sort-of does this alternative interpretation, i.e., you can select the
    i text
    which is pointed to by the element. Untried. But do read on.
    If I run your script with i = 1, I
    i do
    get an error, and it's perfectly valid too! "Object is invalid" -- well, of course it is. There is no other XML element at that level. An app.document.xmlelements entry always points to the
    i root
    of the XML, and you can only have one. Perhaps you expected #1 to be the next sub-element. Well, not so in the ID implementation -- as usual for almost all XML based structures, it's a tree. The "next" element is xmlElements[0].xmlElements[0], which you can check by changing your line to
    >app.activeDocument.xmlElements[0].xmlElements[0].select();
    and verifying the 2nd element from the top is selected in the XML Structure view.

  • Namespace in xml element

    I have an xml file tagged with namespaces:
    for example, ce:section, ce:para
    i just trying to collect the 'ce:floats' xml nodes by using the following code:
    //Defining the Namespace in the array of arrays of 2 strings
    Dim NmSpArr(,) As String = {{"sb", "http://www.elsevier.com/xml/common/struct-bib/dtd"}, {"cl", "http://xml.cengage-learning.com/cendoc-core"}, {"ce", "http://www.elsevier.com/xml/common/dtd"}, {"aid", "http://ns.adobe.com/AdobeInDesign/4.0/"}, {"aid5", "http://ns.adobe.com/AdobeInDesign/5.0/"}, {"xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"}, {"xmlns:mml", "http://www.w3.org/1998/Math/MathML"}, {"xmlns:xlink", "http://www.w3.org/1999/xlink"}}
    //Trying to collect the 'ce:floats'
    Dim obj As InDesign.Objects = IndDoc.XMLElements(1).EvaluateXPathExpression("//ce:floats", NmSpArr)
    ID CS4
    Vb.net
    Above code always returning 0 as count. It seems there is problem with the xml namespaces definition.
    Any help would be greately appreciated.
    Regards,
    Suresh

    Suresh:
    Is there anyone know any alternative methods to collect the xml nodes with namespaces?
    Again, I wrote:
    But it shouldn't be too much work to just traverse the tree.
    Here's an example in JavaScript. It should be easy to translate it into VB. Of course all you need is the traverse() function -- the rest is just examples and test cases:
    (function() {
      var
        x = app.activeDocument.xmlElements[0],
        star, all, floats, cefloats, anyfloats;
        function traverse(t, p) {
            var r = [], i;
            if (p(t)) {
                r = r.concat(t);
            for (i=0; i<t.xmlElements.length; i++) {
                r = r.concat (traverse(t.xmlElements[i], p));
            return r;
        function dumplist(l) {
            var i,
                rv = [];
            rv.push("has "+l.length+" elements:");
            for (i=0; i<l.length; i++) {
                rv.push("  "+i+"\t"+l[i].toSpecifier()+
                    "\t"+l[i].markupTag.name);
            return rv.join("\n");
      star = x.evaluateXPathExpression("*");
      all = traverse(x,
          function() { return true; }
      floats = traverse(x,
           function(n) { return n.markupTag.name==="float"; }
      cefloats = traverse(x,
          function(n) { return n.markupTag.name==="ce:float"; }
      anyfloats = traverse(x,
          function(n) { return n.markupTag.name.match(/float$/); }
      $.writeln("star: "+dumplist(star));
      $.writeln("all "+dumplist(all));
      $.writeln("floats "+dumplist(floats));
      $.writeln("cefloats "+dumplist(cefloats));
      $.writeln("anyfloats "+dumplist(anyfloats));
    So, if you run this on a document with an XML schema like this:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Root>
      <ce:float>A</ce:float>
      <ce:float>B</ce:float>
      <float>AC</float>
      <float>Ad</float>
      <ce:float>Af</ce:float>
      <div>
        <ce:float>Ai</ce:float>
        <float>Ag</float>
      </div>
    </Root>
    It gives you this output:
    star: has 3 elements:
      0     /document[@id=1]/XML-element[@id=2]/XML-element[@id=5]     float
      1     /document[@id=1]/XML-element[@id=2]/XML-element[@id=6]     float
      2     /document[@id=1]/XML-element[@id=2]/XML-element[@id=11]     div
    all has 9 elements:
      0     /document[@id=1]/XML-element[0]     Root
      1     /document[@id=1]/XML-element[0]/XML-element[0]     ce:float
      2     /document[@id=1]/XML-element[0]/XML-element[1]     ce:float
      3     /document[@id=1]/XML-element[0]/XML-element[2]     float
      4     /document[@id=1]/XML-element[0]/XML-element[3]     float
      5     /document[@id=1]/XML-element[0]/XML-element[4]     ce:float
      6     /document[@id=1]/XML-element[0]/XML-element[5]     div
      7     /document[@id=1]/XML-element[0]/XML-element[5]/XML-element[0]     ce:float
      8     /document[@id=1]/XML-element[0]/XML-element[5]/XML-element[1]     float
    floats has 3 elements:
      0     /document[@id=1]/XML-element[0]/XML-element[2]     float
      1     /document[@id=1]/XML-element[0]/XML-element[3]     float
      2     /document[@id=1]/XML-element[0]/XML-element[5]/XML-element[1]     float
    cefloats has 4 elements:
      0     /document[@id=1]/XML-element[0]/XML-element[0]     ce:float
      1     /document[@id=1]/XML-element[0]/XML-element[1]     ce:float
      2     /document[@id=1]/XML-element[0]/XML-element[4]     ce:float
      3     /document[@id=1]/XML-element[0]/XML-element[5]/XML-element[0]     ce:float
    anyfloats has 7 elements:
      0     /document[@id=1]/XML-element[0]/XML-element[0]     ce:float
      1     /document[@id=1]/XML-element[0]/XML-element[1]     ce:float
      2     /document[@id=1]/XML-element[0]/XML-element[2]     float
      3     /document[@id=1]/XML-element[0]/XML-element[3]     float
      4     /document[@id=1]/XML-element[0]/XML-element[4]     ce:float
      5     /document[@id=1]/XML-element[0]/XML-element[5]/XML-element[0]     ce:float
      6     /document[@id=1]/XML-element[0]/XML-element[5]/XML-element[1]     float

  • Delete xml element not used in document

    Hi,
    If you have a number of texts tagged with an xml element and then delete the text, the element still exist in the structure.
    You can see the element still connected to a text, by the blue diamond on the element symbol.
    But i want do delete the elements that have no connection to texts, but cant find the right property to look for.
    In Java script CS4.
    Anyone knows?
    /Mikael

    If the (text) element is unplaced, its parentStory will be an XmlStory rather than a Story.
    So try:
    var elements = app.activeDocument.xmlElements[0].xmlElements.everyItem().getElements();
    for (var i = elements.length - 1;i >= 0;i--){
        if(elements[i].parentStory.constructor.name === "XmlStory"){
            elements[i].remove();
    This is untested. If you have tagged graphics frames it will need to be modified to not error on those.
    Jeff

  • XML tag markers moved: Find and Replace causing problem in xml elements

    Hi All,
    I am doing find and replace using GREP. While using the expression like $1, $2 (Found Items) in the change to field it changes the placement of tag marker. If the found item is a part of two of more xml elements, I am getting a serious problem while replacing it. (ie. The xml tag markers are moved.)
    See the screen shot below, then you may get better idea. And help me to overcome this issue.
    This is just an example to show you what i'm trying to say, there are so many cases like this.
    Original text/ Before doing find replace
    After replacing
    Green4ever

    Hi Peter and John,
    but it seems to me that the example is looking for any space that
    follows a semi-colon and has two word characters following it, and
    repalce that with an em space. I think you could do the same using look
    behind and look ahead and not need to replace the found text.
    Yes you are right about the look behind and look ahead. I'd like to show some more examples to show what the actual problem is,
    Original/Before Replacing,
    (Consider there is another case here, instead of em-space some times normal word space will also be there)
    Using the Grep:
    Find What---------> ^(\d+\.(?:\d+)?)~m
    Change To------------->$1\t
    After Replace:
    Did I make any sense? Eventhough this will not make any changes in the layout, my requirement is to insert the tab out-side the tag marker not indise.
    Green4ever

  • Hiding XML elements in the structure view – scripting influence to the structure view?

    Hi
    Is there a way to hide specific XML elements (really the elements and not the attributes) in the structure view?
    I am asking this question to know if it is possible to influence the structure view by scripting.
    Many elements are indeed used as a kind of help for constructions which have nothing to do with the actual contents especially in the case of tables.
    You inflate the the structure view unnecessarily and the author will lose track of the real contents. It would be nice if there was a possibility to hide those help construction elements.
    Thank you for any hints.
    Regards
    Apollo102

    Hello Apollo,
    There is a way to hide elements from the Structure View (one such method is offered by the free AXCM plug-in). What happens when you use AXCM (or other methods to hide elements) is that the elements get wrapped into hidden content. This might make the structure view less complex for your authors, but has a number of disadvantages and dangers.
    1. The structure is normally invalidated, as the helper elements are usually required.
    2. Accidentally deleting hidden content may make the invalidation permanent and render your documents useless.
    It is NOT good practice to hide elements from authors in the structure view. Instead, you should either teach authors about the structure, or let them work in the Author View while adding sufficiently clear formatting to show them the underlying structure. In some cases, it might be better to create an authoring structure which is automatically transformed into the required full structure using an XSLT or other processing step. I have created a couple of such environments and they work fine. It just depends on the difference between the structure required for further processing and the structure that would be optimal for your authors (which in turn depends on the level at which your authors are experienced in working with structured content).
    I hope this helps you solve your problem without having to tweak the structure view.
    Kind regards
    Jang

  • Error While trying to Get XML element(tag) Values

    We are trying to get XML element (TAG) value from the XML pay load.
    Example.
    Getting XML String from a web service and then converting into XML payload.
    ora:parseEscapedXML(bpws:getVariableData('signOn_Out','signOnReturn'))
    From this XML payload we are trying to get an element (Tag) value.
    We are getting following error
    Error in evaluate <from> expression at line "130". The result is empty for the XPath expression : "/client:TririgaProcessResponse/client:User/client:LastName".
    oracle.xml.parser.v2.XMLElement@118dc2a
    {http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.
    - <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    - <part name="summary">
    <summary>
    empty variable/expression result.
    xpath variable/expression expression "/client:TririgaProcessResponse/client:User/client:LastName" is empty at line 130, when attempting reading/copying it.
    Please make sure the variable/expression result "/client:TririgaProcessResponse/client:User/client:LastName" is not empty.
    </summary>
    </part>
    </selectionFailure>
    Here are signOnReturn and XML Payload XSD's
    <schema attributeFormDefault="unqualified"
         elementFormDefault="qualified"
         targetNamespace="http://xmlns.oracle.com/Web1"
         xmlns="http://www.w3.org/2001/XMLSchema">
         <element name="Web1ProcessRequest">
              <complexType>
                   <sequence>
                        <element name="userName" type="string"/>
    <element name="password" type="string"/>
                   </sequence>
              </complexType>
         </element>
         <element name="Web1ProcessResponse">
              <complexType>
                   <sequence>
                        <element name="result" type="string"/>
                   </sequence>
              </complexType>
         </element>
    </schema>
    <?xml version="1.0" encoding="windows-1252" ?>
    <schema attributeFormDefault="unqualified"
         elementFormDefault="qualified"
         targetNamespace="http://xmlns.oracle.com/Web"
         xmlns="http://www.w3.org/2001/XMLSchema">
         <element name="TProcessResponse">
              <complexType>
                   <sequence>
                        <element name="result" type="string"/>
    <element name="User">
    <complexType>
                   <sequence>
                        <element name="Id" type="string"/>
    <element name="CompanyId" type="string"/>
    <element name="SecurityToken" type="string"/>
    <element name="FirstName" type="string"/>
    <element name="LastName" type="string"/>
    </sequence>
    </complexType>
    </element>
                   </sequence>
              </complexType>
         </element>
    </schema>

    I am sure and can see the data in audit trail.
    [2006/12/12 09:17:36]
    Updated variable "signOn_Output"
    - <signOn_Output>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    - <WebMethodsProcessResponse xmlns="http://xmlns.oracle.com/WebMethods">
    <Result xmlns="">
    Success
    </Result>
    - <User xmlns="">
    <Id>
    2694069
    </Id>
    <CompanyId>
    208133
    </CompanyId>
    <SecurityToken>
    1165936654605
    </SecurityToken>
    <FirstName>
    Jagan
    </FirstName>
    <LastName>
    Rao
    </LastName>
    </User>
    </WebMethodsProcessResponse>
    </part>
    </signOn_Output>
    Copy details to clipboard
    [2006/12/12 09:17:36]
    Updated variable "tririga"
    - <tririga>
    - <TririgaProcessResponse xmlns="http://xmlns.oracle.com/WebMethods">
    <Result xmlns="">
    Success
    </Result>
    - <User xmlns="">
    <Id>
    2694069
    </Id>
    <CompanyId>
    208133
    </CompanyId>
    <SecurityToken>
    1165936654605
    </SecurityToken>
    <FirstName>
    Jagan
    </FirstName>
    <LastName>
    Rao
    </LastName>
    </User>
    </TririgaProcessResponse>
    </tririga>
    Copy details to clipboard
    [2006/12/12 09:17:36]
    Updated variable "Variable_2"
    - <Variable_2>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    - <TririgaProcessResponse xmlns="http://xmlns.oracle.com/WebMethods">
    <Result xmlns="">
    Success
    </Result>
    - <User xmlns="">
    <Id>
    2694069
    </Id>
    <CompanyId>
    208133
    </CompanyId>
    <SecurityToken>
    1165936654605
    </SecurityToken>
    <FirstName>
    Jagan
    </FirstName>
    <LastName>
    Rao
    </LastName>
    </User>
    </TririgaProcessResponse>
    </part>
    </Variable_2>
    Copy details to clipboard
    [2006/12/12 09:17:36]
    Error in evaluate <from> expression at line "130". The result is empty for the XPath expression : "/client:TririgaProcessResponse/client:User/client:LastName".
    oracle.xml.parser.v2.XMLElement@1c8768e
    Copy details to clipboard
    [2006/12/12 09:17:36]
    "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.
    - <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    - <part name="summary">
    <summary>
    empty variable/expression result.
    xpath variable/expression expression "/client:TririgaProcessResponse/client:User/client:LastName" is empty at line 130, when attempting reading/copying it.
    Please make sure the variable/expression result "/client:TririgaProcessResponse/client:User/client:LastName" is not empty.
    </summary>
    </part>
    </selectionFailure>
    Copy details to clipboard

  • How to find out the page number of an xml element

    Hi everybody, sorry for my very bad english (french guy! logical). I hope you see what I'm looking for.
    I'm scripting (javascript) an exporting script of every articles from a multi-pages indesign script.
    In fact I could have one or more article in one file, every one of them is on an separate xml element. for each I have to export an xml file named with, first, the page number where appears the xml element, second, the number of exported article.
    I'm success the second purpose, but not the first.
    Someone have an idea ?

    Try this,
    var myDoc=app.activeDocument;
    var root = myDoc.xmlElements[0];
    var docTag = root.evaluateXPathExpression('//doc');
    for(i=0; i<docTag.length; i++)
        var docPos = docTag[i].insertionPoints.lastItem();
        var docFrame = docPos.parentTextFrames[0];
        var docPage;
        try
             docPage = docFrame.parentPage;
    catch(e)
            docPage = docFrame.parent.name;
        alert(docPage.name);
    Vandy

Maybe you are looking for

  • Calculate Days between same date field in multiple records, looping for each record

    Be patient as I am a newbie to Sql Server (using 2008 R2) and SSIS.  I have looked at multiple solutions in this and many other forums before submitting the question. I am looking at records to identify the number of days between two dates.  We revie

  • Multiple substitutions of characters in string

    Hi everybody.... Imagine that in a table column there are rows such as : Xxxxxx YYYYY My purpose is to find a substring in an .xml file which resembles on particular column row.... For example if i have the row value 'Xxxxxx' then i want to search an

  • 1131 in autonomous mode. Not sure the below is even possible

    Hi all,   My boss asked me to try and set up an 1131 with 2 SSID's; serve dhcp for both SSID's from the AP and I cant trunk from f0 because the device the AP will connect to cant accept dot1q.  Does anyone know if this is possible?  If so pointing me

  • Unable to map Collection Objects in BPM11g

    Hi, I am polling DB for triggering an instance in the process it is creating a Feildcollection object under Business Catalog -> types -> FeildCollection. when i am trying to map the object i need to map to another collection object itself. In the pro

  • Implement business delegate as a singleton.

    Anyone have any comments regarding implementing the bussiness delegate as a singleton? I currently have something like this. public class ClientUserManager { public ClientUserManager() { public void deleteUser(Long userid) throws RemoteException, Cre