XML Rule + JS example: group elements under new parents

Thanks again to everyone here for helping me get started! I'm now making real progress. In token of my appreciation, here's something that hopefully will eventually help others.
I've worked out how to use the XML Rule facility (together w/ some JS management) to collect groups of XML elements and create new parent elements containing each group.
The sample code here demonstrates several things in both JavaScript and InDesign Script, including:
Use of the XML Rules facility to quickly retrieve data from the XML structure
Use of the following-sibling XPath facility to obtain same-level XML elements
Creating XML tags, parent elements, and moving elements
Multi-dimensional JS array for managing XML elements
By the way, here are a few more things that were not obvious to this noob (I'm sure they are documented; just took time to find them...)
In the InDesign script editor, you can bring up the Object Model Viewer by pressing F1
In the object model viewer, you must click below "Browser" and select the InDesign Object Model before doing a search
At the following link is a list of links to incredibly valuable documents and a huge collection of "Scripting Guide" sample scripts. http://www.adobe.com/products/indesign/indepth.displayTab2.html#Scriptingresources
Using try { xyzzy; } catch (myErr) { alert(myErr); }  ... is your friend
Below is a description of what my sample code actually accomplishes. But first, here are some things I learned about the XML Rules facility. Probably obvious to someone who has used this before but hey, I'm new to this:
You create a set of XML Rules and pass them to the "glue code." Each time the set of rules is run, a single (potentially complex) traversal is made through the XML Structure.
The implication of #1 is that for any given element in the structure, the first rule that matches the element will process it. Thus, the sequence of rule definitions is always important. This both simplifies and sometimes makes more complex how one designs a set of rules.
An example in my case:
I wanted to collect all elements at one level into "groups", with a particular (known) tag as the first element in each group.
It was pretty clear how to find the known tag; use an XPath like "/devices/name" if the tag is "name" underneath "/devices."
But how to collect the intervening tags? In normal XPath/XSLT syntax, this is a bit complicated. But in the XML Rule system, it's actually easy...
Since the first rule will always collect every "name" element, my second rule becomes simply "/devices/name/following-sibling::*" which means "collect all siblings after the 'name' element. Normally, that would include following name elements as well, but it does not do so here since the first rule collects those.
Don't bother trying to rearrange the XML structure from within XML Rule processing. In certain limited situations it can work... but it is just as easy, and quite reliable, to collect the needed info during XML Rule processing, then make the structure changes as a later step.
The MakeXMLGroups(myXPath,myParentTag,myHeadTag) function changes:
Devices
   Name
   Type
   Desc
   Name
   Quantity
   Type
   Desc
   Name
   Desc
To:
Devices
  Device
      Name
      Type
      Desc
  Device
      Name
      Quantity
      Type
      Desc
  Device
       Name
      Desc
In this case, the function call was MakeXMLGroups("/Devices","Device","Name").
(NOTE: I'm on personal travel this week so may not get back to answer questions until next week...)
Here are links to the necessary files:
http://ds.org/files/adobe/MakeXMLGroups.jsx
http://ds.org/files/adobe/grpXMLRulesExampleSetup.jsx
http://ds.org/files/adobe/grpXMLRulesExampleData.xml
Message was edited by: SLTyPete to insert file links

Hi John,
1) I like that the new model adds parameterization. It's cleaner than pulling in parameters from pre-set variables. However, the given example didn't actually make much use of it. The only non-constant parameter multiply-used in the example is the "table" variable. Seems like a lot of work for not a lot of gain, at least in this case?
2) I am cautious that this new template/model condenses the paradigm sooo much, that it is no longer clear where XPath is involved vs straight constant tag names. Yes, Adobe's example is overly-expanded but that's common in code meant to be a demonstration.
3) I also am cautious that the example intermingles direct node creation into the XPath search/processing chain. I've learned to be VERY careful with this. It only can work when the changes made do not interfere with the rule processing. In my model, I simply avoid it completely (by not making node-position or node-add/remove/move changes until after tree parsing is complete.) This will always be a safe model.
Bottom line: while I very much appreciate the parameterization and lintability (is that a word? Sure makes sense to me )... I think I would still define each rule separately rather than bring them all together as an inline array in the rule processing call. To me it seems sooo condensed that the XPath meaning can become lost. (Would someone recognize that //para/section-head is actually an XPath statement that could (in another situation) be //para/* or //para/following-siblings::* ... while some of the other strings are exact-match tag names?)
I realize this is all a matter of style... my preference: clarity for the future reader, particularly when the future reader is me a year later who forgot what all those parameters and embedded methods were all about ...
Blessings,
Pete

Similar Messages

  • Script XMLrule or ??? to group elements under new parent?

    Back after a few weeks on a non-Adobe urgent project plus some recovery ...
    I'm wondering if anyone has XML / XMLrule scripting experience sufficient to give me at least a hint on the following challenge. I have discovered the online scripting tutorials, documents and sample files (huge collection!)... unfortunately I can't find even the beginnings of something addressing what looks to me like a common and highly scriptable challenge.
    My example is below. I can't find code snippets for any of the following:
       - traversing a set of elements to find and select a set of desired elements
       - inserting a selected set (range?) of elements into a new parent
    This is pretty clear when done manually in the user interface, but opaque in the scripting / XMLrules environment.
    Anybody got any hints? Or a book / resource that digs in deep enough?
    Thanks much,
    Pete
    Example of the problem:
    Imagine at some level of a tag structure you have ANY kind of repeating tag sequence. E.g. (in highly abbreviated form)
    <people>
       <name>
       <address>
       <phone>
       <name>
       <address>
       <phone>
       <name>
       <address>
       <phone>
    <projects>
        <name>
        <startdate>
        <enddate>
        <name>
        <startdate>
        <enddate>
    What I want is to group sets of elements underneath a new parent, something like
    (virtually)... GatherElementsUnder(XPath,StartWithElement,NewParentElement)
    ie
    GatherElementsUnder(/people,name,person)
    GatherElementsUnder(/projects,name,project)
    would produce
    <people>
      <person>
         <name>
         <address>
         <phone>
      <person>
         <name>
         <address>
         <phone>
      <person>
         <name>
         <address>
         <phone>
    <projects>
      <project>
          <name>
          <startdate>
          <enddate>
      <project>
          <name>
          <startdate>
          <enddate>

    I've answered this now. Sample script link, plus commentary, is here: http://forums.adobe.com/message/4963977

  • BAPI for finding child WBS elements under a Parent WBS element

    Hi friends,
    I am working on the transaction ZIOS02 transaction. On releasing the Parent or Main WBS element in ZIOS02 transaction I need to copy some data from ZIOS to PRPS based on WBS element.
    I have a Bapi for retrieving all the WBS elements based on Project Definition (BAPI_PROJECT_GETINFO) but i want to know whether is there any BAPI for finding the child WBS elements when we give a Parent WBS elemnts as Input to BAPI.
    Could any one please help me in the query ASAP.

    Hi friends,
    I have got the answer for finding the child WBS elements.
    In Function module BAPI_Project_get_info.
    Use parameter subtree = 'X' and give the WBS element name in tables section under I_wbs_element. You will get all the child WBS elements which are under Main WBS element.
    Thanks
    Satish Raju

  • [CS3, JS] XML Rules: Get geoBounds of img Element in Same Branch

    Hi,
    given the following xml structure:
    <root>
    <entry>
         <img href=""></img>
         <title></title >
         <subtitle></subtitle>
    </entry>
    <entry>
         <img href=""></img>
         <annotation></annotation>
         <title></title >
         <subtitle></subtitle>
    </entry>
    </root>
    If an annotation tag exists inside an entry, it is transferred into an inlineFrame. The position of this inlineFrame depends on the geometricBounds of the image of this entry. To get the geometricBounds of the img, I tried to climb up the tree (from <annotation> to <entry>) and walk down again (inside the same branch) into the <img>.
    Now my question: Is there another (easier) way to get the right xmlElement (<img> inside same <entry> as <annotation>) as with my »for if construction« in the following sample code?
    this.xpath = "/root/entry/annotation";
    this.apply = function(myElement, myRuleProcessor){
    with(myElement){
         var the_anchored_frame = placeIntoInlineFrame([20,7.5]);
         var frameBounds = the_anchored_frame.geometricBounds;
         var theParentElements = myElement.parent.xmlElements;
         for (i=0; i < theParentElements.length; i++) {
              if ( theParentElements[i].markupTag.name == "img" ) {
                   var theIMGBounds = theParentElements[i].xmlContent.geometricBounds;
                   break;
    Thanks
    Tobias

    I'm a beginner with XML Rules and scripting, but for what it's worth I would go about it by defining a "global" variable. (In case I'm using the wrong terminology, I mean a variable for the entire script rather than one that is limited to a particular function).
    For example, before any functions are called, you might add:
    var myImageBounds = new Array;
    var myRuleSet = new Array (new ProcessEntry,
    new ProcessTitle,
    new ProcessImg,
    new ProcessAnnotation,
    new ProcessSubtitle);
    with(myDocument){
    var elements = xmlElements;
    __processRuleSet(elements.item(0), myRuleSet);
    ...then inside the <img>-processing function get the required info, possibly something like this (using Olav Kvern's very helpful "myGetBounds" function from the standard sample scripts):
    function ProcessImg(){
    this.name = "ProcessImg";
    this.xpath = "/root/entry/img";
    this.apply = function(myElement, myRuleProcessor){
    with(myElement){
    var myBounds = myGetBounds(myDocument, myDocument.pages.item(-1));
    myBounds = [myBounds[0]+100, myBounds[1]+100, myBounds[2], myBounds[3]];
    var myRectangle = placeIntoFrame(myPage, myBounds);
    myRectangle.fit(FitOptions.frameToContent);
    myImageBounds = myRectangle.geometricBounds;
    return true;
    ...then inside the <annotation>-processing function use the info you just got:
    function ProcessAnnotation(){
    this.name = "ProcessAnnotation";
    this.xpath = "/root/entry/annotation";
    this.apply = function(myElement, myRuleProcessor){
    with(myElement){
    var the_anchored_frame = placeIntoInlineFrame([20,7.5]);
    the_anchored_frame.geometricBounds = myImageBounds;
    return true;
    That's how I would avoid climbing up and down trees, anyway. But I'm a beginner really, so I may have misunderstood your question.
    Jeremy

  • Ordering of xml group elements

    Hi
    I have a Document object created over the xml file, initially having same type of group elements with differen type of information in the predefined order. later if any time i modify it to add new group of same type by default i am able to add it to next sibiling, instead i want to maintain the order.
    i am having order number as part of group elemnt attribute order.
    e.g
    i have initial xml document like below
    <product order ="2">
    <name/>
    <price/>
    </product>
    <product order ="4">
    <name/>
    <price/>
    </product>
    now if the use want to add the anotherelemtn like
    <product order ="3">
    <name/>
    <price/>
    </product>
    it should go into proper sequence.
    How to do this
    expected will be
    <product order ="2">
    <name/>
    <price/>
    </product>
    <product order ="3">
    <name/>
    <price/>
    </product>
    <product order ="4">
    <name/>
    <price/>
    </product>

    Use the element's append() method if you want to add a child element as the last child, otherwise use its insertBefore() method.

  • How to shift content with in cell in xml rules table

    Hi all scripters,
    I've created a table using xml rules with 3 nos of cells where first cell contain some data and so on but in next row first cell may of may not contain any data so in that row second cell data shifted to first cell and thired row data shifted to second cell which is very anxious for me since second cell data in each row should be in second cell only.
    For Instance-: Required output
    Title
    PageNo
    Subject
    Title
    46
    The Subject
    50
    Another Subject
    54
    Subject
    Title
    60
    Another Subject
    64
    The subject
    The out put I am getting by script-:
    Title
    PageNo
    Subject
    Title
    46
    The Subject
    50
    Another Subject
    54
    Subject
    Title
    60
    Another Subject
    64
    The subject
    myRuleSet = new Array ( new ProcessSec,
               new ProcessPara,
               new ProcessSecHead,
               new ProcessArt,
               new ProcessPG,
    with(myDocument){
        var elements = xmlElements;
         __processRuleSet(elements.item(0), myRuleSet);
    function ProcessSecHead(myXPath){
        this.name = "ProcessSecHead";
        this.xpath = myXPath;
        this.apply = function(myElement, myRuleProcessor){
       with(myElement){
                __skipChildren(myRuleProcessor);
                  var myNewElement = myContainerElement.xmlElements.item(-1).xmlElements.add(app.documents.item(0).xmlTags.item("Cell"));
         myElement.move(LocationOptions.atBeginning, myContainerElement.xmlElements.item(-1).xmlElements.item(-1));
        return true;
    function ProcessPara(){
        this.name = "ProcessPara";
        this.xpath = "//para";
        this.apply = function(myElement, myRuleProcessor){
                var myNewElement = myContainerElement.xmlElements.add(app.documents.item(0).xmlTags.item("Row"));
            return true;
    function ProcessArt(){
        this.name = "ProcessArt";
        this.xpath = "//para/aug";
        this.apply = function(myElement, myRuleProcessor){
            with(myElement){
                __processChildren(myRuleProcessor);
                var myNewElement = myContainerElement.xmlElements.item(-1).xmlElements.add(app.documents.item(0).xmlTags.item("Cell"));
                myElement.move(LocationOptions.atBeginning, myNewElement);  
            return true;
    function ProcessPG(myXPath){
        this.name = "ProcessPG";
        this.xpath = myXPath;
        this.apply = function(myElement, myRuleProcessor){
            with(myElement){
                __skipChildren(myRuleProcessor);
                var myNewElement = myContainerElement.xmlElements.item(-1).xmlElements.add(app.documents.item(0).xmlTags.item("Cell"));
                myElement.move(LocationOptions.atBeginning, myNewElement);
            return true;
    Any would be greatly appreciated
    Mac

    Wow, sorry for the delay.
    This paradigm is difficult enough to deal with, but Adobe's example code really does not encourage you to handle this reasonably at all.
    I've basically rewritten the entire process, and I've introduced a new paradigm for creating rules that I think is a lot more readable and flexible and allows for parametrization. Anyhow, here you go. Any questions?
    /*jslint undef: true, newcap: true, nomen: false, regexp: true,
            bitwise: true, onevar: true, indent: 4, white: false */
    /*global File, LocationOptions, PageSideOptions,
      UserInteractionLevels,
      __processChildren, __processRuleSet, alert, app */
    #include "glue code.jsx";
    // handy debugging function; e.g.: $.writeln(dumplist(x.xmlElements));
    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");
    // Initialize a tags object to map strings to tags.
    function initTags(doc, tagnames) {
        var i, t, tags = {};
        for (i=0; i<tagnames.length; i++) {
            try {
                t = doc.xmlTags.add(tagnames[i]);
            } catch (e0) {}
            tags[tagnames[i]] = doc.xmlTags.itemByName(tagnames[i]);
         return tags;
    // Handy subtree functions
    function firstChildTag(node, tag) {
        var i, e = node.xmlElements;
        for (i=0; i<e.length; i++) {
            if (e[i].markupTag === tag) {
                return e[i];
        return node;
    function lastChildTag(node, tag) {
        var i, e = node.xmlElements;
        for (i=e.length-1; i>=0; i--) {
            if (e[i].markupTag === tag) {
                return e[i];
        return node;
    //// XML rule functions
    // Adobe's sample for how to define these is HORRIBLE.
    // Let's fix several of these problems.
    // First, a handy object to make clearer the return values
    // of XML rules:
    var XMLmm = { stopProcessing: true, continueProcessing: false};
    // Adobe suggest defining rules constructors like this:
    //   function RuleName() {
    //       this.name = "RuleNameAsString";
    //       this.xpath = "ValidXPathSpecifier";
    //       this.apply = function (element, ruleSet, ruleProcessor){
    //       //Do something here.
    //       //Return true to stop further processing of the XML element
    //       return true;
    //       }; // end of Apply function
    // And then creating a ruleset like this:
    //   var myRuleSet = new Array (new RuleName, new anotherRuleName);
    // That syntax is ugly and, and is especially bad if
    // you need to parametrize the rule parameters, which is the only
    // reasonable approach to writing reasonable rules. Such as:
    //   function addNode(xpath, parent, tag) {
    //       this.name = "addNode";
    //       this.xpath = xpath;
    //       this.apply = function (element, ruleProcessor) {
    //           parent.xmlElements.add(tag);
    //           return XMLmm.stopProcessing;
    // and then creating a ruleset like:
    //   rule = new Array (new addNode("//p", someTag));
    // So instead we introduce a makeRule function, that
    // allows us to leave behind all the crud. So then we can write:
    // addNode = makeRule("addNode",
    // function(element, ruleProcessor, parent, tag) {
    //     parent.xmlElements.add(tag);
    //     return XMLmm.stopProcessing;
    // and use:
    // rule = [ addNode("//p", someTag ];
    function makeRule(name, f) {
        return function(xpath) {
            var
                //xpath=arguments[0],
                   // "arguments" isn't a real array, but we can use
                   // Array.prototype.slice on it instead...
                   args=Array.prototype.slice.apply(arguments, [1]);
            return {
                name: name,
                xpath: xpath,
                apply: function(element, ruleProcessor) {
                        // Slice is necessary to make a copy so we don't
                        // affect future calls.
                    var moreargs = args.slice(0);
                    moreargs.splice(0, 0, element, ruleProcessor);
                    return f.apply(f,moreargs);
    // Create a new node at parent. Doesn't do
    // anything with the XPath context node.
    var addNode = makeRule("addNode",
    function(element, ruleProcessor, parent, tag) {
        parent.xmlElements.add(tag);
        return XMLmm.stopProcessing;
    // Create a cell for a table, adding a node to
    // the last node of the last node of the
    // table. Duplicate the context
    // node as a child of that cell.
    var makeCell = makeRule("makeCell",
    function(element, rp, table, outertag, innertag) {
        var
            cell = table.xmlElements[-1].xmlElements.add(outertag),
            copy = element.duplicate();          
        copy.markupTag = innertag;
        copy.move(LocationOptions.AT_BEGINNING, cell);
        return XMLmm.stopProcessing;
    // Apply from() to the context node to get
    // a source node. Copy that source node
    // to be the first child of the context node.
    var copyFromToChild = makeRule("copyFromToChild",
    function(element, ruleProcessor, from) {
        var copy = from(element).duplicate();       
        copy.move(LocationOptions.BEFORE,
          element.xmlElements[0]);   
        // __skipChildren(ruleProcessor);
        return XMLmm.continueProcessing;
    // We don't actually use this, but it was useful
    // in debugging. Essentially "rename" a node.
    // Set the tag of the context node to the
    // specified tag.
    var setTag = makeRule("setTag",
    function(element, ruleProcessor, newtag) {
        element.markupTag = newtag;
        return XMLmm.stopProcessing;
    // Apply from() to the context node to get
    // a source node. Apply to() to the
    // context node to get a destination node.
    // Move the source node in the specified
    // location (how) to the destination node.
    var moveFromTo = makeRule("moveFromTo",
    function (element, ruleProcessor, from, how, to) {
        __processChildren(ruleProcessor);
        var src = from(element);
        src.move(how, to(element));
        return XMLmm.continueProcessing;
    // end rule functions
    // It's just not worth rewriting some of Adobe's ugly functions...
    // but at least fix it up so it JSLints.
    function myGetBounds(myDocument, myPage){
        var
            myPageWidth = myDocument.documentPreferences.pageWidth,
            myPageHeight = myDocument.documentPreferences.pageHeight,
            myX1, myX2, myY1, myY2;
        if(myPage.side === PageSideOptions.leftHand){
            myX2 = myPage.marginPreferences.left;
            myX1 = myPage.marginPreferences.right;
        else{
            myX1 = myPage.marginPreferences.left;
            myX2 = myPage.marginPreferences.right;
        myY1 = myPage.marginPreferences.top;
        myX2 = myPageWidth - myX2;
        myY2 = myPageHeight - myPage.marginPreferences.bottom;
        return [myY1, myX1, myY2, myX2];
    function myGetScriptPath() {
        try {
            return app.activeScript;
        catch(myError){
            return new File(myError.fileName);
    // OK, the actual program.
    function main() {
        var
            doc = app.activeDocument,
            page = doc.pages[0],
            root = doc.xmlElements[0],
            //inputFile = new File(myGetScriptPath().path+ "/mac.xml"),
            inputFile = File.openDialog(),
            tags = {},
            p, table;
        if (app.documents.length<1) {
           alert ("Open a document and run the Script");
           return false;
         // Let's not use a seperate variable for each tag. Instead,
         // we'll keep an Object that maps strings to tags.
        tags = initTags(doc,
                             ["table", "para", "article",
                              "section", "section-head", "tr", "td", "p"]);
        doc.xmlImportPreferences.allowTransform = false;
        doc.xmlImportPreferences.ignoreWhitespace = true;
        app.scriptPreferences.userInteractionLevel =
              UserInteractionLevels.NEVER_INTERACT;
        doc.importXML(inputFile);
        app.scriptPreferences.userInteractionLevel =
              UserInteractionLevels.INTERACT_WITH_ALL;
        // For each <para>, copy the parent's <section-head> inside.
        // Next, move each <article> node to the end of the <para>,
        // placing it after the <page> node.
        __processRuleSet(root, [
            copyFromToChild(
                "//para",
                function(n) {
                        return firstChildTag(n.parent,tags["section-head"]);
            moveFromTo(
                "//para",
                function(n) { return firstChildTag(n, tags.article); },
                LocationOptions.AT_END,
                // This is more general than we need to be; we're moving
                // to "the end", but the end of WHAT? It need not be the
                // <para>, it could be some other node.
                function(n) { return n; })
        // Add a <p> node to hold the table we're about to create.  It's
         // not super-clear from the documentation, but
         // convertElementToTable creates a text node of the table in the
         // XLM structure. In order to then place that into a frame, there
         // has to be an enclosing XML node to do so. We choose <p> for
         // lack of a better tag.
        p = root.xmlElements.add(tags.p);
        table = p.xmlElements.add(tags.table);
        // For each para node, add a <tr> to the table.  For each
        // <section-head>, <page>, or <article>, add a <td> to the last
        // <tr> of the table
        __processRuleSet(root, [
            addNode("//para", table, tags.tr),
            makeCell("//para/section-head", table, tags.td, tags.p),
            makeCell("//para/page", table, tags.td, tags.p),
            makeCell("//para/article", table, tags.td, tags.p)
         // Make it a table and GO!
        table.convertElementToTable(tags.tr, tags.td);
        p.placeIntoFrame(page, myGetBounds(doc, page));
    main();
    I also tried to format this to 72 columns so that it doesn't scroll on the forums. Let's see if that works...Nope, not quite. Oh well. Close enough.

  • Access image placed by xml-rules

    Hi, I have to modify an image (width/height) which is placed by xml-rules.
    XML:
    >
    >  
    >
    JavaScript:
    > function SymbolRule() {
    >   this.name = "Symbol";
    >   this.xpath = "//sometag/Symbol[@typ='new']";
    >   this.apply = function (element, ruleProcessor) {
    >   with (element) {
    >     applyObjectStyle("somestyle");
    >  }
    How can I now access this image to modify its properties?
    I've read http://www.adobeforums.com/webx/.59b7295a/2 but I don't understand *where* to place the code to access the image. Is it possible to do it in my XML-Rule SymbolRule()? Or is it "to early" because the image is no yet placed in the document?

    I have the exact same issue!
    My problem occurs after I unthread the document. After unthreading, the elements parent changes to XmlStory and I can't locate the parent page/spread.
    It's an anchored textframe within a table cell. So parent path is like so:
    obj (textframe) -> Character -> Cell -> Table -> XmlStory -> Document
    In InDesign I can see that the object is on the page and visible.
    I would like to get to the page.
    Any help would be greatly appreciated.
    Thanks
    Ruvan

  • How to limit row number per group without change new page in crystal report

    Hi All Expert,
    Is there any way to limit row number per group without change new page in crystal report 2008. The reason i do that is due to customer using printer EPSON LQ 300 (dot matrix) always will print in landscape if detech my layout in landscape. Because they need the record always print in 1 page (Letter size) for 2 groups and each group must show 5 records. Example:
    But, in CR2008, if you set the row per group from group section expert, definitely it will change to new page, but I do not want it change to new page. Any Idea?
    In one page (Letter size):
    Group Name: Customer-ABC
    NO  INVOICE  AMOUNT
    1)   INV001     USD100
    2)   INV002     USD100
    3)   INV003     USD100
    4)   INV004     USD100
    5)   INV005     USD100
    Group Name: Customer-ABC
    NO  INVOICE  AMOUNT
    6)   INV006     USD100
    7)   INV007     USD100
    8)   INV008     USD100
    9)   INV009     USD100
    10)  INV010     USD100

    Hi Angie.....
    I guess it is not possible.
    Because if you have one common group for all the 10 records then in one page it will show 10 records under one group.
    I mean i think it is not possible but m not completely sure......
    Lets wait for expert advise....
    Regards,
    Rahul

  • Script to extract grouped elements

    I have some design files where sketches have been created by designer and grouped together. Is there a way to extract all grouped elements discretely and save as JPG/PNG?

    To ungroup all objects this forum topic All Group to Ungroup Script could help.
    Regarding the rest of the workflow, I believe iterating through all objects, copying and pasting into a new document and then calling exportFile() would be the way. This forum topic (Re: Batch Export as PNG) offers an example script ExportDocsAsPNG24.jsx which could be useful.
    Happy coding.

  • PLSQL XML parser modified examples

    Attachments: "1|type=application/octet-stream|desc=my personal domsample|file=domsample.sql|";"2|t
    pe=text/xml|desc=garment xml file|file=Garment.xml|";"3|type=text/xml|desc=garment xml file|file=G
    rment.xml|";"4|type=text/xml|desc=an xml file example|22661|file=Garment.xml|"
    PLSQL XML parser modified examples
    Hello Fine Folks at Oracle xml team
    Here i am again from Copenhagen Denmark.
    To day i would like to question/discuss the following things
    ItFs all about the PL/SQL XML parser which i have installed on
    my OracleServer 8i Enterprice
    Question 1
    If i want to modify DOMSAMPLE.sql or write my own program, i now
    have very few choices
    Where to look for intelligent answers to my questions.
    1. My only source here is the package body for XMLPARSER which i
    have installed under
    the user SCOTT/TIGER. I made a dump of all that code to the
    printer
    So thats my xml
    manual together with the domsample.sql
    QUESTION . Where do i find programmers reference etc. etc. etc.
    Question 2
    2. Many of the *.xml examples here on my platform have a design
    where elements have no attributes;
    But still they are "placeholders" for elemt values.
    Here is the DomSample source part iFam referring to
    -- get all elements
    nl := xmlparser.getElementsByTagName(doc, '*');
    len1 := xmlparser.getLength(nl);
    -- loop through elements
    for j in 0..len1-1 loop
    n := xmlparser.item(nl, j);
    e := xmlparser.makeElement(n);
    dbms_output.put_line(xmlparser.getTagName(e)

    Joergen Hoeyer (guest) wrote:
    : PLSQL XML parser modified examples
    : Hello Fine Folks at Oracle xml team
    : Here i am again from Copenhagen Denmark.
    : To day i would like to question/discuss the following things
    : ItFs all about the PL/SQL XML parser which i have installed on
    : my OracleServer 8i Enterprice
    : Question 1
    : If i want to modify DOMSAMPLE.sql or write my own program, i
    now
    : have very few choices
    : Where to look for intelligent answers to my questions.
    : 1. My only source here is the package body for XMLPARSER which
    i
    : have installed under
    : the user SCOTT/TIGER. I made a dump of all that code to the
    : printer
    : So thats my xml
    : manual together with the domsample.sql
    : QUESTION . Where do i find programmers reference etc. etc. etc.
    : Question 2
    : 2. Many of the *.xml examples here on my platform have a
    design
    : where elements have no attributes;
    : But still they are "placeholders" for elemt values.
    : Here is the DomSample source part iFam referring to
    : -- get all elements
    : nl := xmlparser.getElementsByTagName(doc, '*');
    : len1 := xmlparser.getLength(nl);
    : -- loop through elements
    : for j in 0..len1-1 loop
    : n := xmlparser.item(nl, j);
    : e := xmlparser.makeElement(n);
    : dbms_output.put_line(xmlparser.getTagName(e)

  • Dynamically rename the root node of XML based on the child elements

    Hi Gurus,
    Is there any way to rename the root node of the resultant XML after a mapping based on the child elements.
    For ex:
    consider the following resultant XML after mapping
    <result>
    <element1> </element1>
    <result>
    if the element1 is <type> then the output should be
    <category>
    <type> </type>
    </category>
    elseif the element1 is <character> then the output should be
    <property>
    <character> </character>
    </property>
    Let me know how to do this, either in XSLT or in Graphical mapping.
    Thanks,
    Prabu

    Hi, Prabu:
    In this case, I am suggest you have Src and Tar Message.
    I am suggesting you create another type of message using key / value pair as I suggested, e.g. called Mid Message.
    My solution for you is to have two message mappings:
    1. Src -> Mid
    2. Mid -> Tar.
    In first mapping, you have no control of the structure, but you can map it to Mid structure:
    e.g.
      if Type node Exist, then map 'Type' to Key, as Key/Value can be creatd under a parent node with 0:1 Occurrence.
      saying item.
       in this case, a new item created.
    If you think of this way, any xml file can be represted in this way:
       <Employee>
          <Fname>David</Fname>
          <Lname>Miller</Lname>
       </Employee>  
       <Employee>
          <Fname>Steve</Fname>
          <Lname>Mai</Lname>
       </Employee>   
    Can be interpretd as this way:
       <Employee>
          <Element>
             <key>Fname</Key>
             <value>David</Value>
          </Element>
          <Element>
             <key>Lname</Key>
             <value>Miller</Value>
          </Element>
       </Employee>  
       <Employee>
          <Element>
             <key>Fname</Key>
             <value>Steve</Value>
          </Element>
          <Element>
             <key>Lname</Key>
             <value>Mai</Value>
          </Element>
       </Employee> 
    Now you should understand what I mean.
    In your case target structure have to desgined as following way:
    You need to put Category and Property together with their sub-structure in parallel, make occurence to 0:1
    In your second mapping, you can check the key value is "Type" or "Character", based on which one is true,
    you create corresponding structure: either Categary or Property.
    Regards
    Liang
    Edited by: Liang Ji on Oct 22, 2010 8:31 PM
    Edited by: Liang Ji on Oct 22, 2010 8:35 PM

  • Vectors shapes dissapear or group elements are mooved to another coordinates

    A month ago, I experiment some bugs on fireworks. There are shapes, that dissapear, or group elements thah disappear and when you try to select his layer, the shape appears in another coordiantes, and it's impossible to select. Mask boxes change you height by 1px and it's impossible to modify. The rounded shapes are deformed, like someone move the paths to the right.
    I have a lot of desings mades with fireworks, and many files become corrupt, with this case of bugs that I've mentioned at the beginning.
    A friend that also have fireworks has proved the same file, and it is perfect, but if I open the file, happens all this thing that explain on top.
    What is happening?@

    1.) forget "Vector" if you're talking about (modern) Java Code. You most likely want to use a implementation of List instead (usually ArrayList or LinkedList), Vector is a legacy class and should usually not be used in new code.
    2.) You could keep everything in XML all the time, for this you would use the DOM tree of your document. In my opinion that's usually too much hassle, as you'd have to convert each data access.
    3.) Do you mean to use the list to store the objects or the properties of the objects?
    4.) A standalone application is no reason not to use a database. HSQLDB provides almost everything you need from a database without having to install anything. Of course a XML file might still be the better idea, but you should think about it.
    Good Luck

  • Repeating a group element on each page of a report.

    I have a report where I need to repeat a group element on each page. The element is from the first group in the data. It is in the center group. Currently, the values from this group only print when the group changes. Everything I try does not work. Does anyone have any ideas. I am attaching a sample of the data. Along with the rtf document. I am using the BI Publisher plug in in Word to create the template.
    Data
    <?xml version="1.0" encoding="UTF-8"?>
    <POLLEDTICKETRPT>
    <USERCD>klockhar</USERCD><POLLDATE>03/24/2009</POLLDATE>
    <LIST_CENTER>
    <CENTER>
    <CENTER_CD>0039</CENTER_CD>
    <CENTER_NAME>CROSS PLAINS QUARRY</CENTER_NAME>
    <LIST_TRANSDATE>
    <TRANSDATE>
    <TRANS_DATE>03/11/2009</TRANS_DATE>
    <LIST_CUSTOMER>
    <CUSTOMER>
    <CUSTOMER_NBR>33221477</CUSTOMER_NBR>
    <CUST_NAME>TDOT DISTRICT 32-GALLATIN</CUST_NAME>
    <LIST_JOB>
    <JOB>
    <JOB_CUST>33221477</JOB_CUST>
    <JOB_CUST_NAME>TDOT DISTRICT 32-GALLATIN</JOB_CUST_NAME>
    <RGI_JOB_NBR>2008</RGI_JOB_NBR>
    <QUOTE_ID>0</QUOTE_ID>
    <LIST_COSTCODE>
    <COSTCODE>
    <COSTCODING/>
    <COST_CNTR/>
    <COST_ACCT/>
    <PROJECT_NBR/>
    <PROJECT_TASK/>
    <LIST_TICKET>
    <TICKET>
    <TICKET_NBR>5000021</TICKET_NBR>
    <ORIGIN_CD>TSCC</ORIGIN_CD>
    <REFERENCE_NBR>254510</REFERENCE_NBR>
    <VOID_IND>N</VOID_IND>
    <STATE_CD>TN</STATE_CD>
    <MEASURE_SYSTEM>S</MEASURE_SYSTEM>
    <LOCATION>THANK YOU</LOCATION>
    <PO_NBR>POS-254510-C</PO_NBR>
    <TAX_CODE>4</TAX_CODE>
    <PRODUCT_CD>000003</PRODUCT_CD>
    <HAUL_ZONE_CD/>
    <INVENTORY_STATUS>PR</INVENTORY_STATUS>
    <HAULER_NBR/>
    <RGI_TRANSPORT_CD>FU96</RGI_TRANSPORT_CD>
    <HAUL_RATE> .00</HAUL_RATE>
    <MAT_RATE> 8.50</MAT_RATE>
    <NET_TONS> -7.96</NET_TONS>
    <MAT_SALES_AMT> -67.66</MAT_SALES_AMT>
    <HAUL_AMT>0</HAUL_AMT>
    <TAX_AMT>0</TAX_AMT>
    <SEV_TAX_AMT>0</SEV_TAX_AMT>
    <SEV_TAX_IND>N</SEV_TAX_IND>
    <VALID_NET_TONS> -7.96</VALID_NET_TONS>
    <VALID_SALES_AMT> -67.66</VALID_SALES_AMT>
    <VALID_HAUL_AMT> .00</VALID_HAUL_AMT>
    <VALID_TAX_AMT> .00</VALID_TAX_AMT>
    <VALID_SEV_TAX_AMT> .00</VALID_SEV_TAX_AMT>
    <CASH_TONS> .00</CASH_TONS>
    <CASH_SALES_AMT> .00</CASH_SALES_AMT>
    <CASH_TAX_AMT> .00</CASH_TAX_AMT>
    <CASH_SEVTAX_AMT> .00</CASH_SEVTAX_AMT>
    <CASH_HAUL_AMT> .00</CASH_HAUL_AMT>
    <TRADE_TONS> -7.96</TRADE_TONS>
    <TRADE_SALES_AMT> -67.66</TRADE_SALES_AMT>
    <TRADE_TAX_AMT> .00</TRADE_TAX_AMT>
    <TRADE_SEVTAX_AMT> .00</TRADE_SEVTAX_AMT>
    <TRADE_HAUL_AMT> .00</TRADE_HAUL_AMT>
    <INTRA_TONS> .00</INTRA_TONS>
    <INTRA_SALES_AMT> .00</INTRA_SALES_AMT>
    <INTRA_TAX_AMT> .00</INTRA_TAX_AMT>
    <INTRA_SEVTAX_AMT> .00</INTRA_SEVTAX_AMT>
    <INTRA_HAUL_AMT> .00</INTRA_HAUL_AMT>
    <INTER_TONS> .00</INTER_TONS>
    <INTER_SALES_AMT> .00</INTER_SALES_AMT>
    <INTER_TAX_AMT> .00</INTER_TAX_AMT>
    <INTER_SEVTAX_AMT> .00</INTER_SEVTAX_AMT>
    <INTER_HAUL_AMT> .00</INTER_HAUL_AMT>
    <CASH_PR_TONS> .00</CASH_PR_TONS>
    <CASH_NP_TONS> .00</CASH_NP_TONS>
    <CASH_MI_TONS> .00</CASH_MI_TONS>
    <TRADE_PR_TONS> -7.96</TRADE_PR_TONS>
    <TRADE_NP_TONS> .00</TRADE_NP_TONS>
    <TRADE_MI_TONS> .00</TRADE_MI_TONS>
    <INTER_PR_TONS> .00</INTER_PR_TONS>
    <INTER_NP_TONS> .00</INTER_NP_TONS>
    <INTER_MI_TONS> .00</INTER_MI_TONS>
    <INTRA_PR_TONS> .00</INTRA_PR_TONS>
    <INTRA_NP_TONS> .00</INTRA_NP_TONS>
    <INTRA_MI_TONS> .00</INTRA_MI_TONS>
    </TICKET>
    </LIST_TICKET>
    </COSTCODE>
    </LIST_COSTCODE>
    </JOB>
    </LIST_JOB>
    </CUSTOMER>
    </LIST_CUSTOMER>
    </TRANSDATE>
    RTF Template
    DISPLAY CENTER
    S M
    FOR EACH CENTER
    SET CENTER
    CENTER: CENTER_CD CENTER_NAME
    FOR EACH TRANSDATE
    TRANSACTION DATE: TRANS_DATE
    FOR EACH CUSTOMER
    FOR EACH JOB
    Customer: JOB_CUST JOB_CUST_NAME
    Job: RGI_JOB_NBR Quote Id: QUOTE_ID
    FCC
    group COSTCODE by COSTCODING
    Cost Center: COST_CNTR Cost Acct: COST_ACCT Project: PROJECT_NBR Task: PROJECT_TASK
    Ticket Nbr     ORGCD     OrigTck     V     ST     Location     Po Nbr     Tax Cd     Prod Code     ZN     Hauler      Truck     Haul Rate     UnitPrice     Tons     SalesAmount
    F TCK#M     CODE     OTCK#     V     ST     LOCATION     PO_NBR      TC     PROD     HZ     HAULER     TRUCK     0.00     0.00     0.00 *      0.00 E

    Post Author: Guy
    CA Forum: General
    Hi,
    You should add a first level of grouping in your subreport on a fake formula field with a constant value.  Put your header and footer information in this group header and footer.  In the group option make sure to check the "repeat group header on each page option".
    This group will act as a page header + footer within your subreport.
    good luck!
    Guy

  • Org.xml.sax.SAXParseException: Document root element is missing.

    Hi,
    I am trying to get the portal login id from a weblogic server based application from iplaet portal server.
    I get this follwoing error
    org.xml.sax.SAXParseException: Document root element is missing.
    at com.sun.xml.parser.Parser.fatal(Parser.java:2817)
    at com.sun.xml.parser.Parser.fatal(Parser.java:2805)
    at com.sun.xml.parser.Parser.parseInternal(Parser.java:493)
    at com.sun.xml.parser.Parser.parse(Parser.java:284)
    at com.sun.xml.tree.XmlDocument.createXmlDocument(XmlDocument.java:226)
    at com.iplanet.portalserver.util.XMLParser.<init>(XMLParser.java:70)
    at com.iplanet.portalserver.naming.share.NamingResponseParser.<init>(NamingResponseParser.java:33)
    at com.iplanet.portalserver.naming.share.NamingResponse.parseXML(NamingResponse.java:74)
    at com.iplanet.portalserver.naming.WebtopNaming.updateNamingTable(WebtopNaming.java:174)
    at com.iplanet.portalserver.naming.WebtopNaming.getNamingProfile(WebtopNaming.java:155)
    at com.iplanet.portalserver.naming.WebtopNaming.getServiceURL(WebtopNaming.java:57)
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:534)
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:520)
    at com.iplanet.portalserver.session.Session.getSession(Session.java:414)
    at jsp_servlet.__eatonPortalLogin._jspService(__eatonPortalLogin.java:155)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:462)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5517)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3156)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2506)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)
    <May 19, 2004 9:01:12 AM EDT> <Error> <HTTP> <101017> <[ServletContext(id=4873279,name=ematrix,context-path=/ematrix)] Root cause of ServletException
    com.iplanet.portalserver.session.SessionException
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:539)
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:520)
    at com.iplanet.portalserver.session.Session.getSession(Session.java:414)
    at jsp_servlet.__eatonPortalLogin._jspService(__eatonPortalLogin.java:155)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:462)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5517)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3156)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2506)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)
    Any help/pointers will be appreciated.
    Ashish

    Just for anyone else who hits this problem: I encountered the same issue with an XML document that XMLSpy claims is quite well formed. I opened the document in a hex editor, and there at the from was a three-byte byte order marker - the marker that I believe the UTF-8 standard says is optional. I removed these three bytes, and the file was parsed correctly.
    In this case, the XML file was created using a Microsft DOM (save).
    My solution is to make the java parser - as I use it - a tad more robust: Open the file and create an input stream - a pushback input stream. Read the first three bytes; if they are NOT a BOM, then push those bytes back. Now - in any case - give the stream to the parser to read.
    try {
    // Open file for reading.
    f = new File(path);
    FileInputStream fis = new FileInputStream(f);
    PushbackInputStream pis = new PushbackInputStream(fis);
    byte[] buf = new byte[3];
    pis.read(buf, 0, 3);
    if (! (buf[0] == 0x00EF) && (buf[1] == 0x00BB) && (buf[2] == 0x00BF) ) {
         pis.unread(buf, 0, 3);
    builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    doc = builder.parse(pis);
    catch (Exception x) {
         x.printStackTrace();
    }

  • Display grouping elements r repective page footers in hyp:IR STUDIO

    Hi All ,
    I am facing a problem with Hyperion IR Studio at the time of display grouping elements in receptive page footers.
    eg: say I have a group 'A' and its corresponding elements are like A1,A2,A3....
    If query(from dashboard) for report related to Group 'A'..My report shows the data related to all its elements(A1,A2,...).I need to show these grouping elements in the page footer on their corresponding pages, for example, my report has generated with first 4 pages related to Grouping element 'A1' and next two pages(5th,6th) for grouping element 'A2'..here I need to show 'A1' in the page footer on first 4 pages and 'A2' on 5th & 6th pages and like-wise.
    Is there any possibility that we can show grouping elements in their receptive page footers...
    Hyperion :-
    Version : IR reporting studio 11.1.1.3
    Thanks in Advance,
    Srini

    hey, I just realised, that you have the same problem as me, though mine is a studio xps1340 with a 9500M.
    Did you make any progress in configuring your xorg.conf or anything else? Please say yes...

Maybe you are looking for

  • Multiple users for Pages?

    if you have several user profiles on a computer, can the downloaded pages be used for everyone or do you need to buy multiple versions?

  • Sharing folders in 10.8.3 to windows and macs PROBLEMS

    I'm tryng to share folders from an 10.8.3 imac to users in my LAN (using bot mac and windows) I'm having this problem: 1) Mac users can access the share using afp:// but when they create new folders the permission are: drwxr-xr-x so no other can writ

  • Program with database

    When I buildserver,I got some error messages: error C2065:'EXEC' :undeclared identifier error C2146:syntax error:missing ';' before identifier 'SQL' error C2065:'SQL' :undeclared identifier error C2146:syntax error:missing ';' before identifier 'inse

  • How to play videos on lockscreen of iphone 5s?

    Well i have been using iphone 5s from the very first week it was launched. I am a techy and I played alot with android devices but this time i switched to iphone.  This is a very unfortunate to say that iphone is missing such a common feature. when I

  • Control grid intensity graph

    Hi, I want to control the grid of an intensity graph to be exactly spaced by "1"... How to do? See attached example in LV8.5. Start with default values and you get grid lines with spacing of 1. Now change "size" to 15 and run again. Gridlines are now