Add name of file as XML tag

I want to add the name of the document as an XML tag at the top level just below root, is this possible in javascript?

yes it is
function main() {
  var doc, root, xe, t;
  if ( !app.documents.length ) return;
  doc = app.activeDocument;
  root = doc.xmlElements[0];
  t = doc.xmlTags.itemByName ("doc");
  !t.isValid && t = doc.xmlTags.add("doc");
  xe = root.xmlElements.add(t );
  xe.contents = doc.name;
main();
HTH,
Loic
http://www.ozalto.com

Similar Messages

  • Missing songs / won't add or import files / corrupt id3 tags?

    Hey Folks,
    I can't seem to get some songs/files to add or import to itunes...
    My computer crashed while itunes was open. When I rebooted the itunes library was corrupted and all playlists and songs were missing.
    ... no problem...
    I'll just add the itunes folder right... Which is what I did.
    Problem is now a good 20% of the songs are missing. They are on the harddrive in the itunes music folder, but won't import or add to itunes.
    I suspect maybe it has something to do with corrupt ID3 tags?
    Anyone know the answer to this mystery?
    Thx

    I assume adding artwork is a tag-affecting change - but I can't
    add on this track - it just reverts to the black image.
    I take it the tags themselves are hidden. I see no direct
    editing options for them although I read than they can be
    set to different types - and there are utilities available to
    clean, fix, re-set, etc.
    Ok, now I see your edit - this isn't an mp3, it's .aiff.
    Message was edited by: Tom Meade1

  • How to add Multiple XML Tags for a single column for an RDF

    Hi Gurus,
    I have Requirement in the Oracle D2k Report from which we are generating the xml tags.
    My Requirement is in a table i have 2 columns say A and B.
    i am able to generate three xml tags separately using the report builder by clicking on the column name and in the xml setting giving the xml tag.
    eg: table Acount contains 2 columns A and B with respective data
    A B
    QT 1
    QTS 0
    QTR 2
    i am able to general xml tags like this
    <ACount>
    <AStatus>QT</AStatus>
    <HeadCount>1</HeadCount>
    </ACount>
    <ACount>
    <AStatus>QTS</AStatus>
    <HeadCount>0</HeadCount>
    </ACount>
    my requiremnt for the xml tags is
    <ACount>
    <AStatusQT>1</AStatusQT>
    <AStatusQTS>0</AStatusQTS>
    </ACount>
    kindly help me out how to achieve this requirment in the rdf file mulitple xml tags.
    all your input are most valuable to me, thanks in advance
    Edited by: 909577 on Apr 9, 2012 3:10 PM

    I'm sorry for being so dense, but I'm not quite following, although what I've tried makes me think if I can follow you, it will work :)
    To answer your initial questions, you are correct with both your assumptions:
    1) detailType is the parameter that specificies YTD/Weekly, this is a "report defined" parameter that I am using to determine which Row Group to display (either YTD or Weekly)
    2) SchoolDaysActiveWeek is the parameter that is being set to either true or false -- this is a field in the cube that states whether that record is for the current week or not
    So in following your instructions, well that's the problem I'm not quite following :)
    1) When you say Delete the SchoolDaysActiveWeek parameter from the report only, do you mean to mark the parameter as Hidden?  If so, I've done this.
    2) I'm not quite sure where to use the statement you provided me.  You said to put it in the dataset, but I don't know which dataset.  I assume you mean the "main" dataset (as opposed to the hidden dataset that gets generated when you mark a field
    as a parameter).  If this is the case, the only place I could see that would allow you to use such a statement is in the Filter section of the properties.  I tried this, and it did not generate any errors, but it also kept my report groups from displaying
    -- it just showed a blank report, so I think it probably wasn't bringing back any rows to populate them with.
    I also tried going into the Expression section for the SchoolDaysActiveWeek parameter in the second screenshot and placing the statement there.  When I did this and ran the report, I would get the following error:
    The 'SchoolDaysActiveWeek' parameter is missing a value
    So what am I missing!? 
    Also, thanks for taking the time to respond!!

  • [CS3 JS] How to associate text with an XML tag

    Hello,
    I have a script that allows one to create or modify an XML tag after one selects text, a text frame or an existing XML tag. It works fine for making the XML tag but it does not associate the text or text frame to the tag. To do that I have to right click on the selection and use the context menu to Tag Text or Tag Frame.
    I want to make this automatic but cannot see how to script it.
    Thanks for any help

    I figured out the problem (which of course creates other interesting problems).
    In the line:
    var elementRef = rootElement.xmlElements.add (tagRef);
    I forgot to add a reference to the xmlContent. It should read:
    var elementRef = rootElement.xmlElements.add (tagRef, whatToTag);
    However, this script is designed to create a dialog box where one can either create a tag along with attributes or edit an existing one. I'll post it when I am done, but there is one hangup. The script not only changes the name of a selected xml tag but all tags with the same name. How can I get it to change only the selected tag? Below is the boiled down script that duplicates that problem.
    Thanks,
    Tom
    var myDoc = app.activeDocument;
    var selObj = app.selection[0];
    var TagIWantToChange = selObj.markupTag;
    var newTagName = "PleaseWork"; //This line replaces all the coding to create a dialog box where the tag name could be edited.
    TagIWantToChange.name = newTagName;

  • Mapping of XML tags with column

    My xml structure is :
    <PARAMS>
    <ROWSET>
    <ROW NUM="1">
    <SID>man123</SID>
    <PO>
    <PO>OBJ1</PO>
    <PI>
    <PI>PARENTOBJ1 INSTANCE</PI>
    </PI>
    </PO>
    </ROW>
    </params>
    My table structure is :
    CREATE TABLE TEMP(SID VARCHAR2(20),PO POBJECT_T)
    where Object types are:
    CREATE OR REPLACE TYPE PINSTANCE_T AS OBJECT (PI VARCHAR2(255),CO COBJECT_T);
    CREATE OR REPLACE TYPE POBJECT_T AS OBJECT (PO VARCHAR2(255),PI PINSTANCE_T);
    To store this XML directly into table i have to have Column with name "PO" (same as XML tag).I am using this same table to store other XML with same tags . With this limitation its difficult to do so.Is there any way to map XML tag to column with different name????
    Thanks

    Hi,
    thx for your Reply,
    seems to work basicly but i get now in the IDE warnings with:
    "Data binding will not be able to detect changes when using
    square bracket operator. For Array, please use
    ArrayCollection.getItemAt() instead. "
    And how can i access the next item something like this didnt
    work right
    try someniceid.lastResult["some-root"]["someother-root"]
    I had to use single quotes (') to get it to work.
    Any ideas?
    Kind regards,
    Marko

  • Add XML Tag to XML File (Idoc to XML File)

    Hi there.
    Just a question regarding the addition of a tag header in an XML file please?
    Idoc - > XI -> file (XML File)
    We have a need to add something like this below in bold to XML Tag Header in the inbound file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    Any ideas on how this can be managed would be apreciated please?
    Thank you.
    Mick.

    Hi Carlos.
    Thanks for your reply. I like what you are suggesting, however, I have no knowledge of Java and how to implement this Java addition to the mapping interface.
    I would appreciate any hints you may have. The value that I am trying to add to the tag header is exactly as it is below(the value in bold) and it can in fact be fixed, i.e. I am not looking to dynamically determine the values in the additional tag but just add the value as it is below...
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    I would appreciate any input from you on that.
    Thanks in advance Carlos.
    Mick.

  • Puttin the name of the file in one tag of the xml message

    Hi all,
    does anybody kowns how to put the name of the file in one tag of the xml message in the adapter, without using a java mapping to get the file name.
    Thanks.

    H Antonio,
    You can  use ASMA( Adapter Specific Message Attributes) for acccessing the file name, along with Dynamic Configuration. You can follow the following blog for that. If you do not want to use the same file name for the reciever, dont select the File Name check box.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Thanks and Regards,
    Sanjeev.

  • Iterate through XML tags of file (CS5)

    Hello!
    I'd like to iterate through an XML file, but I am not sure how to do this, since the import is mostly done automatically.
    This is how I load and import the file:
    var f = new File('~/Desktop/test.xml');
    app.activeDocument.importXML(f);  
    But how can I now iterate through its tags using JavaScript?

    Hallo,
    Thank you for the resource!
    However, I was not able to implement any of the example because of an error "__processRuleSet is not a function".
    My code is:
    //Setup.jsx
    mainSetup();
    function mainSetup(){
         var myDocument = app.documents.add();
         myDocument.xmlImportPreferences.allowTransform = false;
         myDocument.xmlImportPreferences.ignoreWhitespace = true;
         var myFilePath = '~/Desktop/test.xml';
         myDocument.importXML(File(myFilePath));
         var myBounds = myGetBounds(myDocument, myDocument.pages.item(0));
         myDocument.xmlElements.item(0).placeIntoFrame(myDocument.pages.item(0), myBounds);
         function myGetBounds(myDocument, myPage){
             var myWidth = myDocument.documentPreferences.pageWidth;
             var myHeight = myDocument.documentPreferences.pageHeight;
             var myX1 = myPage.marginPreferences.left;
             var myY1 = myPage.marginPreferences.top;
             var myX2 = myWidth - myPage.marginPreferences.right;
             var myY2 = myHeight - myPage.marginPreferences.bottom;
             return [myY1, myX1, myY2, myX2];
    // Test, Add return character after every XML Element
    mainTest();
    function mainTest(){
         if (app.documents.length != 0){
             var myDocument = app.documents.item(0);
             //This rule set contains a single rule.
             var myRuleSet = new Array (new AddReturns);
             with(myDocument){
                 var elements = xmlElements;
                 __processRuleSet(elements.item(0), myRuleSet);
         else{
             alert("No open document");
             //Adds a return character at the end of every XML element.
             function AddReturns(){
                 this.name = "AddReturns";
                 //XPath will match on every XML element in the XML structure.
                 this.xpath = "//*";
                 // Define the apply function.
                 this.apply = function(myElement, myRuleProcessor){
                     with(myElement){
                         //Add a return character after the end of the XML element
                         //(this means that the return does not become part of the
                         //XML element data, but becomes text data associated with the
                         //parent XML element).
                         insertTextAsContent("\r", XMLElementPosition.afterElement);
                         //To add the return at the end of the element, use:
                         //insertTextAsContent("\r", XMLElementPosition.afterElement);
                 return true;// Succeeded
             } //End of apply function
    Do you have any ideas?
    Kind regards,
    mannyk

  • How can I add text to a field based on XML tagging?

    I'm fairly new to using XML in InDesign layouts, and I'm currently facing an issue getting a bunch of content from database records formatted in a print document (text that flows over dozens of pages). I've figured out how to create an InDesign template, but I need to be able to add text between some of the XML elements in two different scenarios:
    1. Add text or line breaks before or after an XML element that always appears in the document. For example: Adding "Description:" before the XML-tagged description content, or adding a return after the last element in a list.
    2. Add text before or after an XML element only if it appears in the document. For example: If there's a second phone number, tagged "Phone2" in the XML, then I want " or " to appear before it in the layout. Otherwise there's just one phone number and it continues on to the next piece of content.
    I have tried inserting this text into the InDesign template, but keeping them means having to also keep parts of the template that aren't used on every import--so I have a bunch of "or Phone2" bits of text to find and replace afterward. That's OK, but I'd like a more elegant solution that doesn't leave potential mistakes in my layout.
    In my preliminary research so far, it looks like an XSLT or scripting might be able to handle this, but I don't know where to start. Can someone tell me if what I'm looking for is possible and suggest the best way to do it? I'm going to have to trial-and-error a solution for this myself.
    I am using ID CS6 on a Mac. Thanks in advance for your help.

    Thanks for your reply. The line that you mention is added at the top of the message, and includes the original sender's email. I would like my name to appear, next to each line I add in the text of the original mail.
    For example:
    Assuming my name is Joe Smith, what I would like to have as the final reply is described below.
    The lines that start with "[Joe Smith]" are my replies, to the original items in the original mail.
    On 21 Feb 2013, at 09:03, Jon Doe wrote:
    We need an effort estimation for thenew feature
    [Joe Smith] It will be about 2 days
    and additional resources needed
    [Joe Smith] 2 new icons

  • How to get the XML TAG name itself instead of TAG value

    Hi All,
    I have a question here
    I want to retrieve the XML tag from a XML file instead of its value.
    Example:
    <item>Colgate</item>
    Now I want to retrieve "item" as output from XPath expression, I dont want its value as "colgate"
    How to do that...?
    Thanks
    -Praveen

    You can do this with an axes XPatch expression:
    child::node()/name()
    For more info see: http://www.w3schools.com/xpath/xpath_axes.asp
    HTH,
    Bas

  • Add xml Tags in Indesign CS4 by Apple/Java script

    Hi,
    All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following add xml tags in my xml indesign cs4 files.
    I have IDML (ETMV2) xml Indesign CS4 files. But i have lots of powermath equation without xml tags. So i want how i can insert xml tags.
    My probleam like this =>
    <no open xml tags>[&x^{2}+y_{3}&]<no close xml tags>
    I want like this (But i do manualy)
    <inlineequation><inlinemediaobject><textobject role="xpressmath">[&x^{2}+y_{3}&</textobject></inlinemediaobject></inlineequation>
    Can anyone write/suggest me how i can add xml Tags. By Apple/Java Script
    Any insight is appreciated!
    snegig

    Hi,
    John Hawkinson thank you so much your suggestion.
    I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
    I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
    Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
    I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
    Thank you John again i am new in this industry please guide.
    snegig

  • IDOC to File, variable substitution on outbound message XML tag attributes

    My scenario is IDOC to FILE using XSL mappings.The target format is 2 XML tags (header, line) with the data stored in the attributes of each tag.
    EG. <header attr1=one attr2=two attr3=three><line attr1=one attr2=two /></header>
    The name of the file is dictated by an outbound attribute value in the header tag.
    Can I get access to it the attribute in the target message in the CC_FILE using variable substution. ?
    Currently I am not using content conversion as the XSL produces the file format needed, so I would pefer not to change the outbound message format/structure as this is going to an external party. I would prefer not to change the outbound format as this would need content conversion to strip the unwanted/information/processing node that is used for this purpose (file naming).
    The name is a calculation of fields in the IDOC and is not explicit dictated (business logic is applied in the mapping to get the file name), so I would prefer to use the attribute of the resulting XML to keep the "business logic" in the XSL..
    Things that cannot be changed.... 1. Must use XSL.for mapping. 2. Format cannot be changed of the outbound message. 3. Would prefer not to involved content conversion to keep formatting/node structure in the XSL mapping.
    I have seen some reference to this being possible on the forums but nothing solid from what Ive read.
    Something like var1 = payload:/Header/@attr1 in variable sub to get at the attribute
    Any comments ?
    Thanks in advance.
    One final piece of info. its on a PI 7.1 system.

    I think its best explained by my other thread Link:PI 7.1 Access to Dynamic Configuration through Java Class .
    Thanks for the link I have already implemented based on that link but the one crucial difference is that it is implemented using a static method with no reference to the actual object (payload) for Dynamic configuration. It seems that without the 7.0 API which isnt available in 7.1 by default XSL with java extentions is limited to static methods. If you could read the other thread it certainly is possible I'm mistaken.

  • Parse an xml file using cm tag

    I have question about Content Management and weblogic portal 9.2
    In VCR directory, I will have xml file with bellow structure
    Test Repository
    --->Test
    ----Test.xml
    Test.xml File will be like
    <main_content>
         <content>
              <Subject>Subject</Subject>
              <grade><p>This is grade Data</p></grade>
              <mark><p>This is mark Data</p><mark>
    <content>
    <main_content>
    I have used below code to retrieve the above
    <cm:getNode path="/Test Repository/Test/Test.xml" id="headernode" />
    <cm:getProperty id="node" name="_content" />
    Above code will show all the content on Jsp. i,e Subject This is grade Data This is mark Data
    But I only want to retrieve the data of <grade> tag then how can I do this? Please help
    How <cm> tag will help me here ?
    Please provide sample code if have. Your help is highly appreciated.
    Edited by: user11311969 on Sep 10, 2009 2:52 AM
    Edited by: user11311969 on Sep 10, 2009 2:53 AM

    Hi
    Thanks a lot for your swipt reply.
    I try this also But error is same.
    <x:parse var="output" xml="${xml_data}" />
    javax.servlet.ServletException: Unrecognized object supplied as 'xml' attribute to <parse>
    at weblogic.servlet.jsp.PageContextImpl.handlePageException(PageContextImpl.java:409)
    at jsp_servlet._portlets._news.__news._jspService(__news.java:
    <%=xml_data%> returning me a output just as name of file and not content --- > test.xml
    After putting isMultiple="false" i am getting output as ----> test.xml
    resultId defination
    The name of the script variable to store the value of the property in. If this is not specified, the value of the property will be printed in the JSP instead. The value of the property is returned as a collection by default, unless the isMultiple attribute is set to false.
    I think this approch is simple if we can solve this. Is there ant other way same as using tag in jsp itself to retrieve required XML tags. Please reply.. Also i am using Jsp/Html Portlet and not Page Flow Portlet
    Edited by: user11311969 on Sep 11, 2009 1:42 AM
    Edited by: user11311969 on Sep 11, 2009 1:44 AM
    Edited by: user11311969 on Sep 11, 2009 1:44 AM
    Edited by: user11311969 on Sep 11, 2009 1:44 AM

  • Parse XML file, read a tag with whitespaces value.

    Hi all,
    I've got a problem with reading a spaced value record from xml file using sys.xmltype.
    My xml file contains the following:
    <?xml version = '1.0'?>;
    <ROWSET>
    <ROW num="1">
    <FIRSTNAME>Nik</FIRSTNAME>
    <LASTNAME> </LASTNAME>
    <AGE>30</AGE>
    </ROW>
    </ROWSET>
    As you see last name contains four spaces!
    Now when I'm trying to read value from LASTNAME record I'm getting a NULL value, but I want it to return me those 4 spaces as they are.
    Here is a short code description of what I'm doing:
    declare
         xml sys.xmltype;
    str1 varchar2(100);
    str2 varchar2(100);
    begin
         xml := sys.xmltype.createxml(fileContentClob); -- I copy the file content into the fileContentClob variable.
         If xml.existsnode('//ROW['1']/LASTNAME') > 0 Then -- This condition evaluates as true
    str1 := xml.extract('//ROW['1']/LASTNAME/text()'); -- str1 gets NULL value :(, I want spaces as they are in the file.
    str2 := xml.extract('//ROW[' || 1 || ']/LASTNAME').getstringval; -- str2 gets <LASTNAME/> null tag :(.
         End If;     
    end;
    Seems like when it createxml from the fileContentClob it ignores the spaces and find LASTNAME as a null field.
    Do you have any suggestions on how can I fix that, so I can read whitespaces as they are in the file?
    I generate the file also using a xml toolpackage from oracle:
    declare
    strSqlStmt Varchar2(300);
    varCtxHdl dbms_xmlquery.ctxhandle;
    varClob Clob;
    begin
    strSqlStmt := 'SELECT FIRSTNAME,LASTNAME,AGE FROM USERS WHERE ROWNUM =1';
    varCtxHdl := dbms_xmlquery.newcontext(strSqlStmt);
    varClob := dbms_xmlquery.getxml(varCtxHdl);
    dbms_xmlquery.closecontext(varCtxHdl);
    End;

    Even if the STORE AS CLOB clause is used to store the data and preserve whitespace for the XML, the actual extraction of data seems to be removing whitespace...
    SQL> ed
    Wrote file afiedt.buf
      1* create table t (xml xmltype) xmltype xml store as clob
    SQL> /
    Table created.
    SQL> ed
    Wrote file afiedt.buf
      1  insert into t (xml)
      2  values (q'[<?xml version = '1.0'?>
      3  <ROWSET>
      4  <ROW num="1">
      5  <FIRSTNAME>Nik</FIRSTNAME>
      6  <LASTNAME>    </LASTNAME>
      7  <AGE>30</AGE>
      8  </ROW>
      9* </ROWSET>]')
    SQL> /
    1 row created.
    SQL> select * from t;
    XML
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <FIRSTNAME>Nik</FIRSTNAME>
    <LASTNAME>    </LASTNAME>
    <AGE>30</AGE>
    </ROW>
    </ROWSET>
    SQL> set null NULL
    SQL> select x.rnum, x.firstname, x.lastname, x.age
      2  from t
      3      ,xmltable('/ROWSET/ROW'
      4                PASSING t.xml
      5                COLUMNS rnum      NUMBER       PATH '/ROW/@num'
      6                       ,firstname VARCHAR2(10) PATH '/ROW/FIRSTNAME'
      7                       ,lastname  VARCHAR2(10) PATH '/ROW/LASTNAME'
      8                       ,age       NUMBER       PATH '/ROW/AGE'
      9               ) x
    10  /
          RNUM FIRSTNAME  LASTNAME          AGE
             1 Nik        NULL               30
    SQL>

  • Conversion of XML tags in receiver file adapter

    Hi All,
    I am sending one xml file to receiver file adapter.
    But in case of receiver side I need to change the tags in XML structure,
    eg:
    if source aml file  has tag <NAME> then in receiver case I need to convert it to <FNAME>.
    How will I achieve it?

    Hi
    I also have the similar query
    The output message we get from XI has following format
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns1:name xmlns:ns1="urn:xiworkshop:changetag">
      </ns1:name>
    I want an xml with following format
    <?xml version="1.0" encoding="UTF-8" ?>
    <name>
      </name>
    I need to write the file with with this structure and format using file adapter.
    Can I do so in File adapter or mapping is required for the same?
    Any suggestion would be highly appreciated(with points obviously )
    Regards
    Vanita thareja

Maybe you are looking for

  • Regarding Selection Screen

    Hi All, I have a requirment that: I need to refresh my selection screen at every time i selected back button. Following fields are maintained in selection screen. PARAMETERS     pc_chgno TYPE ZTB1 OBLIGATORY MEMORY ID zbc_change_number. PARAMETERS   

  • XSLT Tag issue

    Hi All, I am using following in my XSLT mapping but XML parser is not recognizing the  < tag: <xsl:text disable-output-escaping="yes"><![CDATA[< K K >]]></xsl:text> I have even tired the < but still it throw the XML is not well formatted error. Pleas

  • Weblogic 8.1 SP2 ORA-01000 caused by Weblogic's pending XA recovery process.

    Hi, we are migrating our application from Weblogic 6.1 SP5 to Weblogic 8.1 SP2 and we are facing the nasty ORA-01000 problem. After tracking it for some days we happened to find "what" was causing it. After issuing the following select on an Oracle i

  • Why is my ipod always on????

    I look near battery xtrength bar on top and I see the play sign and go to ipod and it is on...I hit pause or go to artists or etc to turn off ipod....15 minutes later same thing, ipod on again...can I just turn off ipod under settings so this will st

  • Sub-contracting Quality Rejection issue in QA32.

    Dear sir. when i am returning material to vendor in QA32 , i am getting the bellow error .( it is sub-contracting return process , scrap quantity is also there.). 1 KG Incorrect posting back to vendor, error message: Goods movement not possible with