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.

Similar Messages

  • How to edit contents of a cell?

    In Numbers 2013, how does one edit the content of a cell besides typing directly in the cell?
    In all prior versions of Numbers (like Excel), there was an editing area below the toolbar that extended across the screen. That area could be used to edit the contents of the currently selected cell.
    Has this been completely removed from Numbers 2013 or is there a way to make it appear? If not, how does one edit a cell when a lot of text is being entered?

    I may not have the proper terminology, but it always starts out covering the cell, and sometimes other adjacent cells, but can be dragged anywhere on the page.
    Jerry

  • How to hide rows with merged cells?

    I would like to know how to hide rows on numbers with merged cells, could do it normally at excel but I am not being able to do it at Numbers.
    thanks!

    Felipe,
    To hide a row with Merged Cells, Un-Merge first, then Hide. Select the Merged Cells and Table > Unmerge.
    Note that this is only a problem with vertically merged cells when you want to Hide a Row.
    If you want to Hide a Column, you can't have a Horizontal Merge that involves that Column.
    Jerry

  • How to change content of DataGrid cell on mouse over

    I am trying to change content of a datagrid cell when the mouse is over it. Changing the dataProvider does not provide immediate feedback because update is performed by renderer. I am trying to directly update content of a cell onMouseOver and restore it onMouseOut.
    I am thinking of leaving the column empty and insert content onMouseOver, cleanup onMouseOut. Alternative, may be I can populate the column and mask out all but the cell the mouse is over.
    Any suggestion on how this may be done?
    Thanks!

    I would override updateDisplayList, call isItemHighlighted and set the content of the cell accordingly
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • How to edit content in a cell - how can u set a shortcut to do that

    so i have been left clicking to change the content. how do you do that on the keyboard? i found a list of shortcuts under some menu in numbers, but i couldnt set the shortcuts myself
    thanks alot, this will save me soooo much time

    There is a partial solution to this that will allow you to enter the formula editor for any selected cell from the keyboard:
    1. In System Preferences, select the "Keyboard Shortcuts" section of the Keyboard & Mouse" preference.
    2. Click the plus box button below the list to add a shortcut.
    3. In the drop down sheet, from the "Application:" popup that defaults to "All Applications," choose Numbers if it is listed (it probably will not be) or if not, scroll to the end of the list & select "Others..." & navigate to Numbers in the Application folder & choose it. (The basic idea is to create an application-specific keyboard shortcut for Numbers.)
    4. In the "Menu Title:" text box type "Formula Editor" (without the quotes)
    5. Select the "Keyboard Shortcut:" box & press the keys for the desired keyboard shortcut. This can be anything that includes one or more modifier keys (Command, Control, Option, etc.), but to prevent conflicts, choose something not already in use & not something that would be a character you would want to enter in a cell.)
    6. Click the "Add" button, then scroll down in the shortcuts list window to the "Application Keyboard Shortcuts" section, click the triangle to show them, & check that the shortcut is listed, & that not yellow warning triangle appears, signifying a shortcut conflict.
    7. If Numbers is running, quit & relaunch it so that the shortcut will take effect.
    As noted above, this only helps with cells that have, or will have, formulas in them. It works exactly like the menu command Insert>Function>Formula Editor: If the cell does not currently have a formula but some literal value, the formula popup will not include it, & if you then click the "Accept" button, type a return, tab, etc., the literal value will be replaced. If the cell already has a formula, the formula popup will not replace it but instead will move the insertion point to after the last character in the existing formula.
    The same technique will work for adding keyboard shortcuts to any other Numbers menu item.
    Had there been an "Enter cell editor" (or something like that) menu command, presumably this would have allowed a complete solution, but there doesn't even seem to be an official name for doing that -- the documentation refers to it only procedurally, as in 'click again' or the like. Obviously, there is no need for the menu item other than for this, so a complete solution will have to wait for a new version of the app.

  • How to display content with dynamic folder path

    Hi Experts,
    I have a folder with subfolders. This subfolders are named as weeknumbers. What we want is: depending on the weeknumber, the right folder with content is showing automatically. In week 1 we see the content of week 1 , in week 2 we see the content of week 2 etc.
    How to achive this, what is the best way?
    Thanks in advance,
    Joeri

    Hi Joeri,
    I would follow the below procedure...
    1. create a the KM navigation iViews for each of the folders in KM (Week1, Week2 etc).
    2. Create a JSP(PAR) or an HTML to access these iViews (as [Link1], [Link2] etc on a JSP or an HTML)
    3. Create an iView from PAR (if JSP-PAR)
        OR Create a KM Document iView for the HTML Page (Store the HTML Page in KM again)
    I hope this would help you.
    Cheers!!!
    Biroj Patro.

  • How to include content with MyFaces?

    Hi.
    I have what must be a common problem: I wish to include HTML content from a source file in a JSF file. I am using MyFaces, but I think the problem is more general.
    I currently can include static content trivially, with a jsp:include tag:
    <f:subview id="content">
      <f:verbatim>
        <jsp:include page="home.html" />
      </f:verbatim>
    </f:subview>The problem occurs when I want to choose the content file dynamically, based on a value from the backing bean. This fails:
    <f:subview id="content">
      <f:verbatim>
        <jsp:include page="#{backingBean.currentContent}" />
      </f:verbatim>
    </f:subview>I understand why this fails: the JSP EL does not recognize the Faces value. I have tried various ways to circumvent this including trying to use various types of includes, using iframe tags (with and without the htmlTag tag), etc. But all these have failed. I know the HTML content itself needs to be wrapped in verbatim tags, but I can easily place those in the content files if needed.
    What is the right way to include simple HTML source files from Faces? Searching various forums and documentation, I could not find any clear instructions that worked.
    Thanks.
    + Richard

    You could try using <c:import> instead of <jsp:include> (and remove the verbatims, of course). I haven't tried that with simple html though, but I think it should work.
    jimbo

  • How to download contents with specific URL

    assumption: URL "http://www.game.com/login.php?name=joeCruiz&pwd=123456")" will show the logined info about me.
    I try to get the logined info in pure java program with following codes:
    url = new URL("http://www.game.com/login.php?name=joeCruiz&pwd=123456");
    connection = (HttpURLConnection)url.openConnection();
    input = connection.getInputStream();
    dataInput = new BufferedReader(new InputStreamReader(input));
    while ((line = dataInput.readLine()) != null) {
    buffer.append(line);
    But I just get info shown with "http://www.game.com/login.php?".
    Thanks for any comment.
    Joe

    Hi there,
    forgive me my bad english...
    i guess you have to use something like this
    HttpURLConnection conn;
    conn = new HttpURLConnection(new URL("http://www.game.com/login.php?name=joeCruiz&pwd=123456"));
    conn.setRequestProperty("name","joeCruiz");
    conn.setRequestProperty("pwd","123456");
    conn.connect();
    input = conn.getInputStream();
    dataInput = new BufferedReader(new InputStreamReader(input));
    while ((line = dataInput.readLine()) != null) {
       buffer.append(line);
    }All trick is to use setRequestProperty(String, String) instead of pairs in url string.
    Hope this helps.
    With best regards,
    Selivanov Mike.

  • How to come up with a magic number for any table that returns more than 32KB?

    I am in a unique situation where in I am trying to retrieve values from multiple tables and publish them as XML output. The problem is based on the condition a few tables could retrieve data more than 32KB and a few less than 32KB. Less than 32KB is not an issue as XML generation is smooth. The minute it reaches greater than 32KB it generates a run time error. Just wondering if there is any way to ensure that the minute the query's results is greater than 32 kb, it should break say - if the results is 35KB, then I should break that result into 32 KB and 3kb; once done then pass this data to be published as an XML output. This is again not just for one table, but all the tables that are called in the function.
    Is there any way?? I am unable to get any ideas nor have I done anything so complex from production support stand point. Would appreciate if someone can guide me on this.
    The way it is, is as follows:
    I have a table called ctn_pub_cntl
    CREATE TABLE CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id          NUMBER(18)
    ,table_name                  VARCHAR2(50)
    ,last_pub_tms              DATE
    ,queue_name               VARCHAR2(50)
    ,dest_system              VARCHAR2(50)
    ,frequency                  NUMBER(6)
    ,status                      VARCHAR2(8)
    ,record_create_tms          DATE
    ,create_user_id                VARCHAR2(8)
    ,record_update_tms          DATE
    ,update_user_id             VARCHAR2(8)
    ,CONSTRAINT ctn_pub_cntl_id_pk PRIMARY KEY(ctn_pub_cntl_id)
    Data for this is:
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms 
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_SBDVSN'
    ,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.TSZ601.UNP'
    ,'SAP'
    ,15
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms 
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_TRACK_SGMNT_DN'
    ,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.WRKORD.UNP'
    ,'SAP'
    ,30
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms 
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_FXPLA_TRACK_LCTN_DN'
    ,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.YRDPLN.INPUT'
    ,'SAP'
    ,30
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms 
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_FXPLA_TRACK_LCTN2_DN'
    ,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.TSZ601.UNP'
    ,'SAP'
    ,120
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_FXPLA_TRACK_LCTN2_DN'
    ,TO_DATE('04/23/2015 11:50:00PM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.YRDPLN.INPUT'
    ,'SAP'
    ,10
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_FIXED_PLANT_ASSET'
    ,TO_DATE('04/23/2015 11:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.WRKORD.UNP'
    ,'SAP'
    ,10
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_OPRLMT'
    ,TO_DATE('03/26/2015 7:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.WRKORD.UNP'
    ,'SAP'
    ,30
    INSERT INTO CTNAPP.ctn_pub_cntl
    (ctn_pub_cntl_id   
    ,table_name        
    ,last_pub_tms
    ,queue_name 
    ,dest_system       
    ,frequency         
    VALUES
    (CTNAPP_SQNC.nextval
    ,'TRKFCG_OPRLMT_SGMNT_DN'
    ,TO_DATE('03/28/2015 12:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
    ,'UT.TSD.WRKORD.UNP'
    ,'SAP'
    ,30
    COMMIT;
    Once the above data is inserted and committed, then I created a function in a package:
    CREATE OR REPLACE PACKAGE CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH
    IS
    TYPE tNameTyp IS TABLE OF ctn_pub_cntl.table_name%TYPE INDEX BY BINARY_INTEGER;
    g_tName tNameTyp;
    TYPE tClobTyp IS TABLE OF CLOB INDEX BY BINARY_INTEGER;
    g_tClob tClobTyp;
    FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_count OUT NUMBER ) RETURN tClobTyp;
    END CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH;
    --Package body
    CREATE OR REPLACE PACKAGE BODY CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH
    IS
         doc           xmldom.DOMDocument;
         main_node     xmldom.DOMNode;
         root_node     xmldom.DOMNode;
         root_elmt     xmldom.DOMElement;
         child_node    xmldom.DOMNode;
         child_elmt    xmldom.DOMElement;
         leaf_node     xmldom.DOMNode;
         elmt_value    xmldom.DOMText;
         tbl_node      xmldom.DOMNode;
         table_data    XMLDOM.DOMDOCUMENTFRAGMENT;
         l_ctx         DBMS_XMLGEN.CTXHANDLE;
         vStrSqlQuery  VARCHAR2(32767);
         l_clob        tClobTyp;
         l_xmltype     XMLTYPE;
    --Local Procedure to build XML header    
    PROCEDURE BuildCPRHeader IS
      BEGIN
        child_elmt := xmldom.createElement(doc, 'PUBLISH_HEADER');
        child_node  := xmldom.appendChild (root_node, xmldom.makeNode (child_elmt));
        child_elmt := xmldom.createElement (doc, 'SOURCE_APLCTN_ID');
        elmt_value := xmldom.createTextNode (doc, 'CTN');
        leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
        leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
        child_elmt := xmldom.createElement (doc, 'SOURCE_PRGRM_ID');
        elmt_value := xmldom.createTextNode (doc, 'VALUE');
        leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
        leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
        child_elmt := xmldom.createElement (doc, 'SOURCE_CMPNT_ID');
        elmt_value := xmldom.createTextNode (doc, 'VALUE');
        leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
        leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
        child_elmt := xmldom.createElement (doc, 'PUBLISH_TMS');
        elmt_value := xmldom.createTextNode (doc, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS'));
        leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
        leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
    END BuildCPRHeader;
    --Get table data based on table name
    FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_Count OUT NUMBER) RETURN tClobTyp IS
        vTblName      ctn_pub_cntl.table_name%TYPE;
        vLastPubTms   ctn_pub_cntl.last_pub_tms%TYPE;
    BEGIN
                g_vProcedureName:='GetCtnData';   
                g_vTableName:='CTN_PUB_CNTL';
            SELECT table_name,last_pub_tms
            INTO   vTblName, vLastPubTms
            FROM   CTN_PUB_CNTL
            WHERE  ctn_pub_cntl_id=p_nInCtnPubCntlID;
        -- Start the XML Message generation
            doc := xmldom.newDOMDocument;
            main_node := xmldom.makeNode(doc);
            root_elmt := xmldom.createElement(doc, 'PUBLISH');
            root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
          --Append Table Data as Publish Header
            BuildCPRHeader;
          --Append Table Data as Publish Body
           child_elmt := xmldom.createElement(doc, 'PUBLISH_BODY');
           leaf_node  := xmldom.appendChild (root_node, xmldom.makeNode(child_elmt));
           DBMS_SESSION.SET_NLS('NLS_DATE_FORMAT','''YYYY:MM:DD HH24:MI:SS''');
           vStrSqlQuery := 'SELECT * FROM ' || vTblName
                          || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
                        --  ||  ' AND rownum < 16'
          DBMS_OUTPUT.PUT_LINE(vStrSqlQuery);
           l_ctx  := DBMS_XMLGEN.NEWCONTEXT(vStrSqlQuery);
          DBMS_XMLGEN.SETNULLHANDLING(l_ctx, 0);
          DBMS_XMLGEN.SETROWSETTAG(l_ctx, vTblName);
          -- Append Table Data as XML Fragment
          l_clob(1):=DBMS_XMLGEN.GETXML(l_ctx); 
          elmt_value := xmldom.createTextNode (doc, l_clob(1));
         leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
         xmldom.writeToBuffer (doc, l_clob(1));
         l_clob(1):=REPLACE(l_clob(1),'&lt;?xml version=&quot;1.0&quot;?&gt;', NULL);
         l_clob(1):=REPLACE(l_clob(1),'&lt;', '<');
         l_clob(1):=REPLACE(l_clob(1),'&gt;', '>');
         RETURN l_clob;
         DBMS_OUTPUT.put_line('Answer is' ||l_clob(1));
         EXCEPTION
            WHEN NO_DATA_FOUND THEN
            DBMS_OUTPUT.put_line('There is no data with' || SQLERRM);
            g_vProcedureName:='GetCtnData';
            g_vTableName:='CTN_PUB_CNTL';
            g_vErrorMessage:=SQLERRM|| g_vErrorMessage;
            g_nSqlCd:=SQLCODE;
            ctn_log_error('ERROR',g_vErrorMessage,'SELECT',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName);
            WHEN OTHERS THEN
           DBMS_OUTPUT.PUT_LINE('ERROR : ' || SQLERRM);
           ctn_log_error('ERROR',g_vErrorMessage,'OTHERS',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName);
    END GetCtnData;
    PROCEDURE printClob (result IN OUT NOCOPY CLOB) IS
        xmlstr   VARCHAR2 (32767);
        line     VARCHAR2 (2000);
    BEGIN
        xmlstr := DBMS_LOB.SUBSTR (result, 32767);
        LOOP
           EXIT WHEN xmlstr IS NULL;
           line := SUBSTR (xmlstr, 1, INSTR (xmlstr, CHR (10)) - 1);
           DBMS_OUTPUT.put_line (line);
           xmlstr := SUBSTR (xmlstr, INSTR (xmlstr, CHR (10)) + 1);
        END LOOP;
    END printClob;
    END CTN_PUB_CNTL_EXTRACT_PUBLISH;
    If you notice my query:
    vStrSqlQuery := 'SELECT * FROM ' || vTblName
                          || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
                         ||  ' AND rownum < 16'
    The minute I comment
    ||  ' AND rownum < 16' ;
    , it throws an error because this query returns around 600 rows and all of those rows need to be published as XML and the tragedy is that there is a C program in between as well i.e. C will call my packged functions and then will do all the processing. Once this is done will pass the results back to C program. So obviously C does not recognise CLOB and somewhere in the process I have to convert the CLOB to VARCHAR or instead of CLOB I have to use VARCHAR array as a return type. This is my challenge.
    Anyone that can help me to find out the required magic number and also a brief know how, I would appreciate that. Many thanks in advance.

    Not sure I understand which part is failing.
    Is it the C program calling your packaged function? Or does the error occur in the PL/SQL code, in which case you should be able to pinpoint where it's wrong?
    A few comments :
    1) Using DOM to build XML out of relational data? What for? Use SQL/XML functions.
    2) Giving sample data is usually great, but it's not useful here since we can't run your code. We're missing the base tables.
    3) This is wrong :
    vStrSqlQuery := 'SELECT * FROM ' || vTblName                     || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
    A bind variable should be used here for the date.
    4) This is wrong :
    elmt_value := xmldom.createTextNode (doc, l_clob(1));
    createTextNode does not support CLOB so it will fail as soon as the CLOB you're trying to pass exceeds 32k.
    Maybe that's the problem you're referring to?
    5) This is most wrong :
         l_clob(1):=REPLACE(l_clob(1),'&lt;?xml version=&quot;1.0&quot;?&gt;', NULL); 
         l_clob(1):=REPLACE(l_clob(1),'&lt;', '<'); 
         l_clob(1):=REPLACE(l_clob(1),'&gt;', '>'); 
    I understand what you're trying to do but it's not the correct way.
    You're trying to convert a text() node representing XML in escaped form back to XML content.
    The problem is that there are other things to take care of besides just '&lt;' and '&gt;'.
    If you want to insert an XML node into an existing document, treat that as an XML node, not as a string.
    Anyway,
    Anyone that can help me to find out the required magic number
    That would be a bad idea. Fix what needs to be fixed.
    And please clearly state which part is failing : the C program or the PL/SQL code?
    I'd vote for PL/SQL, as pointed out in [4].

  • How to import images with path embedded in XML tag

    I have a website that has blogs with embedded images. I need to design an XML that can be imported in Indesign. I am able to import XML and lay it out in Indesign if I have only text. But I am not able to include or show the intermittent, embedded images in Indesign. Can this be done? -Thanks

    I can drag an image from, for example, the desktop, but if I delete that file on the desktop I won't be able to open that image in iPhoto, even if I've imported it
    That's an indication that you may have your library set up as a referenced library:
    Check the Advanced preferences in iPhoto to see if that checkbox is selected or not.  If it isn't checkec, check it and try importing agan. 
    To make sure all Photo Stream photos are automatically imported into your library set up iPhoto's PS preferences like this:
    You should read this User Tip by Terence Devlin which is the best treatise on how to access photos (for use outside of iPhoto):  How to Access Files in iPhoto
    OT

  • How to append parameter with URL for each record in table control?

    Hi,
    I have one table control which contains 5 columns.
    (tripno, startdate, destination, reason, activities)
    In 5th column, i need to display URL for each record.
    for ex:
    www.abc.com/test?tripno=1
    www.abc.com/test?tripno=2
    www.abc.com/test?tripno=3
    when user clicks a particular hyperlink, it navigates to another page/component thru URL with one key field(tripno) to retrieve related records in next page.
    1) i am not able to assign tripno to each record. when i assign tripno, its taking the last value which i assigned. ie. tripno=3 only.
    How to assign URL to Reference field of LINK_TO_URL element at run time?
    OR
    2) we can do like this.
    Simply assign url to reach record without key field.
    www.abc.com/test
    www.abc.com/test
    www.abc.com/test
    when user clicks a particular link, we can assign corresponding key field to the URL.
    Where should i write this event? Bcoz, LINK_TO_URL doesnot have event.
    how to do?

    Hi MOg.
    Not sure whether I understand you .. but in the 5th column you want to have the reference URL. Is this the activities columen from you example?
    Nevertheless, you need a attribute (String) in your context node which contains the URL. Bind this to the reference filed of linktourl. If you can not extend the structure you can create a sub node (cardinality 1:1)  which contains the refernce attribute.
    Then loop over all elements and concatenate www.abc.com/test?tripno= with the tripno of the current element into the reference field.
    Hope tis helps,
    Sascha.
    Bind the

  • How to insert records with LONG RAW columns from one table to another

    Does anybody know how to use subquery to insert records with columns of LONG RAW datatype from one table to another? Can I add a WHERE clause in the subquery statement? Thanks.

    Insert into ... Select statements are not supported for long or long raw. You will have to either use PL/SQL or convert your long raw to blobs.

  • How to link label with an input field in data table?

    I am curious if there is a nice way to link a label to input field in a data table directly in JSP? Data filling the table are dynamically bounded.
    Sample, simplified code below. Values of "label" property are unique in the collection binded to dataTable.
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:jsp="http://java.sun.com/JSP/Page">
         <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" />
         <f:view>
              <html>
              <body>
              <h:dataTable value="#{screen$monitoring$errorlog$CorrectHopper.dataset}" var="DATA_ROW">
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Name" />
                        </f:facet>
                        <h:outputLabel value="#{DATA_ROW.label}" for="#{DATA_ROW.label}_id" />
                   </h:column>
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Value" />
                        </f:facet>
                        <h:inputText value="#{DATA_ROW.label}" id="#{DATA_ROW.label}_id" />
                   </h:column>
              </h:dataTable>
              </body>
              </html>
         </f:view>
    </jsp:root>
    returns:
    17:39:01,390 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.IllegalArgumentException: #{DATA_ROW.label}_id
    what is related to EL expression in h:inputText's "id" attribute.
    Is there any other way to bind label with dynamically created input field in JSP? Do I really have to bind input field directly to component objects with "binding" and set IDs manually with setId() (what is ugly solution because it moves View related logic to Model layer)?

    I've thought of using EL because I have to somehow
    link a label to an input field dynamically. Somehow? Dynamically? Just use plain text :)Well... just look at my code snippet (notice: we want to join the pairs of labels and text boxes placed in a datatable [or any other repeater-like component rendering properties of objects from a collection]):
    <h:dataTable value="#{screen$monitoring$errorlog$CorrectHopper.dataset}" var="DATA_ROW">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name" />
    </f:facet>
    <h:outputLabel value="#{DATA_ROW.label}" for="#{DATA_ROW.label}_id" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Value" />
    </f:facet>
    <h:inputText value="#{DATA_ROW.label}" id="#{DATA_ROW.label}_id" />
    </h:column>
    </h:dataTable>
    and what is your idea of using plain text as "id" attribute value in this case? :)
    Regards,
    Michal

  • How to use XPath with Namespaces in the xml ?

    Hi all,
    I need to reference a certain Node in a Document using XPath notation.
    The problem is the the XML Document contains Namespaces inside it
    f.e.
    <xn:SubNetwork id="JRANM">
        <xn:VsDataContainer id="1">
           <xn:vsDataType>vsDataAreas</xn:vsDataType>
        </xn:VsDataContainer>
    </xn:SubNetwork >Using DOMXPath (from weblogic.xml.xpath)
      DOMXPath xPath = new DOMXPath("xn:SubNetwork/*");
      Set nodeset = xPath.evaluateAsNodeset(this.xmlRootElement);When I Iterate through the Set I can see it's empty.
    (On the other hand without namespaces everything is fine.)
    So how can I reference a Node that contains a namespace in it ?
    Thanks a lot
    Francesco

    We use the following class to perform XPath Queries on our XmlBean objects.
    Hope this helps,
    Craig
    import java.util.Set;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.apache.xmlbeans.XmlException;
    import org.w3c.dom.Document;
    import weblogic.xml.util.StringInputStream;
    import weblogic.xml.xpath.DOMXPath;
    * Class to encapsulate API specific (i.e. weblogic) XML functions
    public class XmlUtil {
         * Returns a set containing objects of type reflected in the query.<br/>
         * e.g.<br/>
         * /saur:tree/saur:treeNode[@label='My Reports']<br/>
         * Returns a Set of TreeNode objects<br/>
         * Sample Code: <br/>
         * <code>
         * Set set = XmlUtil.executeXPathQuery( myQuery, tree.xmlText());
         * for( Iterator iter = set.iterator(); iter.hasNext();) {
         *     TreeNode node = TreeNode.Factory.parse((Node)iter.next());
         *     // Do whatever...
         * </code>
         * @param query
         * @param xml
         * @return
        public static Set executeXPathSetQuery( String query, String xml) throws XmlException {
            try {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();   
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                StringInputStream in = new StringInputStream(xml);
                Document doc = builder.parse(in);
                DOMXPath xQuery =  new DOMXPath(query);
                return xQuery.evaluateAsNodeset(doc);
            catch(Exception x) {
                throw new XmlException("Error running XPath query", x);
    }

  • Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Numbers does not have rotated text within cells.  You can place a text box over the cell that has rotated text but you cannot rotate text within a cell.

Maybe you are looking for

  • Connection to oracle via php

    hi, I am making a site with a connection to oracle Xe but I am not able to connect me; here script: <?php $user = @$_post['login']; $passwd = @$_post['pass']; $bd = "(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP) (HOST = titanium)(PORT = 1521)) (CONNECT_DA

  • How to set output size for mp4?

    Hello, I'm having a problem with the export of a Captivate video tutorial. The output size is w 1440 x h 900 pixels. It comes out looking fine, but as soon as we put it through any other transcoding process as required by our own workflows, the image

  • In need of customized JTextField

    I need to create a custom textfield, and the formatter won't cut it. I need to have formatting applied real time, with a variable number of characters. The ATM might be a good example, where you enter numbers and the display field fills in from left

  • How far back does apple keep icloud backups - need a month old backup

    trying to retreive a text message conversation from a few months ago but i had to reboot my phone and lost most old messages...  is there a way to get them back?

  • Failing to load processes after installing patch 10.1.2.3

    I have installed patch 10.1.2.3 after Oracle advised that it may resolve some database adapter problems I was getting in 10.1.2.0.2. However after installing the patch, many of the BPEL processes are now failing to load when I bounce the OC4J compone