Matching JS XML object with Indd XML elements

Hello Scripters,
I need help ...
I have some XML from a file read into a Javascript XML object.
The object has the name "myXml", and contains:
    <book id="bk101">
        <author>Gambardella, Matthew</author>
        <title>XML Developer's Guide</title>
        <genre>Computer</genre>
        <imagecontainer href="C:\33415677.JPG"></imagecontainer>
        <price>44.95</price>
        <publish_date>2000-10-01</publish_date>
        <description><test>Sublevel</test>An in-depth look at creating applications with XML.</description>
    </book>
    ... and several other books
I also have some XML in Indesign, wich in my JS is known as "myTplXmlRoot".
myTplXmlRoot is defined as myTplXmlRoot = mySelection.associatedXMLElement;
What would be the best approach for matching elements of the same name in the two xml structures, and where there is a match* replace the Indesign content**, with that from the object "myXml"?
*) Match if same name, dont worry about place in hirachy
**) content might be an image

I've figured out the solution to my problem. For anyone
interested, see me code below (the xml element names are different,
but the concept is the same).

Similar Messages

  • XML gateway with multiple XML structures??

    Hi,
    I have a requirement to import data using XML gateway with different XML structures. Third party system sometimes will not provide certain tags itself if there is no data for the tag like contacts in below sample xmls. In that case we need to ignore those tags (CONTACTS in below sample). As per my understanding, we must have tag in XML though it may not have any value.
    We have 2 XMLs
    XML1 for supplier with contacts
    <SUPPLIER>
    <NAMES>
    <NAME1>XYZ </NAME1>
    <NAME2>ABC</NAME2>
    </NAMES>
    <SITE>
    <SITE1>XYZ </SITE1>
    <SITE2>ABC</SITE2>
    </SITE>
    <CONTACT>
    <CONTACT1>XYZ </CONTACT1>
    <CONTACT2>ABC</CONTACT2>
    </CONTACT>
    </SUPPLIER>
    XML2 for supplier without contacts
    XML1
    <SUPPLIER>
    <NAMES>
    <NAME1>XYZ1 </NAME1>
    <NAME2>ABC1</NAME2>
    </NAMES>
    <SITE>
    <SITE1>XYZ1 </SITE1>
    <SITE2>ABC1</SITE2>
    </SITE>
    </SUPPLIER>
    Can we upload data in both these xmls using only one generic dtd and xgm using XML gateway which will skip any missing tag.
    Thanks
    Rishi

    Hi, you can FOR XML PATH for a finer degree of control over your XML.  Use the @ symbol to create attributes.  Here's a simple example:
    DECLARE @t TABLE ( rowId INT IDENTITY PRIMARY KEY, [address] VARCHAR(50), city VARCHAR(30), floor INT, suite INT, doorType VARCHAR(20) )
    INSERT INTO @t VALUES
    ( '123 Fake St', 'Springfield', 10, 512, 'Metal' )
    SELECT
    [address] AS "Address",
    city AS City,
    [floor] AS "Location/@Floor",
    suite AS "Location/@Suite",
    doorType AS "Location/@DoorType"
    FROM @t
    FOR XML PATH ('Company'), ROOT ('Companies'), ELEMENTS;

  • How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    That feature is only in PS. Elements as you buy it has only limited support for smart objects. If you use File>Place to add something to your image it will come in as a smart object (within the limits to which PSE understands smart layers). However, if you know someone who can write an action for you in PS you can install it in PSE, or you could look into something like elements+ from simplephotoshop.com.

  • Create an XML object with AS3

    I want to create a basic XML object in AS3, but don't know
    how to do this.
    I first tried creating a string that represented my XML
    elements and their values, but then I don't know how to convert
    this string into an XML object.
    Secondly, I believe there are other ways of creating XML
    objects in AS without doing anything with strings.
    Can somebody please recommend to me a way to do this?
    An XML example to create with AS3 is:

    I've figured out the solution to my problem. For anyone
    interested, see me code below (the xml element names are different,
    but the concept is the same).

  • Creating XML object with namespaces

    I'm trying to create the following XML
    <xs:schema id='MySchema' xmlns:xs='
    http://www.w3.org/2001/XMLSchema'
    xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
    <xs:element name='MySchema' msdata:IsDataSet='true'
    msdata:UseCurrentLocale='true'/>
    </xs:schema>
    Following the documentation it appears that the following
    code should do the trick
    private const xs:Namespace = new Namespace("
    http://www.w3.org/2001/XMLSchema");
    private const msdata:Namespace = new
    Namespace("urn:schemas-microsoft-com:xml-msdata");
    var testXml:XML = <schema></schema>;
    testXml.addNamespace(xs);
    testXml.addNamespace(msdata);
    testXml.@id = "MySchema";
    testXml.xs::element.@name = "MySchema";
    testXml.element.@msdata::IsDataSet = true;
    testXml.element.@msdata::UseCurrentLocale = true;
    However, this results in the following XML
    <schema id="PERSONDETAILS">
    <element name="PERSONDETAILS" xmlns="
    http://www.w3.org/2001/XMLSchema"/>
    <element IsDataSet="true" UseCurrentLocale="true"
    xmlns="urn:schemas-microsoft-com:xml-msdata"/>
    </schema>
    Can anyone tell me what I'm doing wrong? Thanks

    Got it, this seems to work...
    var testXml:XML = <xs:schema xmlns:xs='
    http://www.w3.org/2001/XMLSchema'
    xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'></xs:schema>;
    testXml.@id = "MySchema";
    testXml.xs::element.@name = "MySchema";
    testXml.element.@msdata::IsDataSet = true;
    testXml.element.@msdata::UseCurrentLocale = true;

  • Having a xml output with custom xml tags

    Hi All,
    I have a requirement where we need to generate an xml output with a custom set of tags as given below.
    <templates>
    <list>
    <List_no></list_no>
    <List_name> </List_name>
    </List>
    </templates>
    I am not sure how to get the list part as tags within tags.
    I am able to get the output if the tag level is just one level like ,
    <templates>
    <List_no></list_no>
    <List_name> </List_name>
    </List>
    </templates>
    Does anybody know how I could get the multi-level tags. Any help would be much appreciated. Thank you all.
    -Vin

    Hi, you can FOR XML PATH for a finer degree of control over your XML.  Use the @ symbol to create attributes.  Here's a simple example:
    DECLARE @t TABLE ( rowId INT IDENTITY PRIMARY KEY, [address] VARCHAR(50), city VARCHAR(30), floor INT, suite INT, doorType VARCHAR(20) )
    INSERT INTO @t VALUES
    ( '123 Fake St', 'Springfield', 10, 512, 'Metal' )
    SELECT
    [address] AS "Address",
    city AS City,
    [floor] AS "Location/@Floor",
    suite AS "Location/@Suite",
    doorType AS "Location/@DoorType"
    FROM @t
    FOR XML PATH ('Company'), ROOT ('Companies'), ELEMENTS;

  • Transporting objects with embedded XML

    Hi all,
    I am using XFire (http://xfire.codehaus.org/) for exposing my web services. I ran across an issue while transporting an object that contains an XML document embedded in it.
    As an example, here is the domain model:
    public class Book {
         Integer id; 
         String name;
         XMLStreamReader document;
        //Setters and getters follow...
    public class BookService {
         Book  getBook( Integer id) {
            //Construct a Book instance and return it...
    }When I call BookService, I get an exception saying "could not write xml". I guess this has got to do with the fact that I am using XMLStreamReader, the same implementation that XFire uses to convert objects.
    I tired information provided on this link: http://xfire.codehaus.org/Message+Binding but now I get something like "There must be a method name element."
    Any ideas how I get this running? Any help would be appreciated.
    Thanks a lot.

    Hi all,
    I am using XFire (http://xfire.codehaus.org/) for exposing my web services. I ran across an issue while transporting an object that contains an XML document embedded in it.
    As an example, here is the domain model:
    public class Book {
         Integer id; 
         String name;
         XMLStreamReader document;
        //Setters and getters follow...
    public class BookService {
         Book  getBook( Integer id) {
            //Construct a Book instance and return it...
    }When I call BookService, I get an exception saying "could not write xml". I guess this has got to do with the fact that I am using XMLStreamReader, the same implementation that XFire uses to convert objects.
    I tired information provided on this link: http://xfire.codehaus.org/Message+Binding but now I get something like "There must be a method name element."
    Any ideas how I get this running? Any help would be appreciated.
    Thanks a lot.

  • Read XML response with multiple root elements

    Hi ,
    I am trying to achieve the below scenario but unable to do so.Please help urgently.
    I am getting a response from a service which has multiple root elements.these root elements can change at runtime..I need to read the different root elements and extract data from its sub elements.
    Regards...
    Hoping for an anwser..

    i assume on runtime the service just returns 1 rootnode, but this rootnode can change
    you could use a switch after the invoke
    if $response/myroot1
    assign $response/myroot to myroot1_var
    if $response/myroot2
    assign $response/myroot to myroot2_var
    etc
    so you check what's in the root node before you assign to you temp variable
    or if you have logic which is specific based on this root nod you can just implement all these branches in the switch and execute logic in there based on the selected rootnode
    several implementations are possible

  • Disable SafeHTML in OWA on Exchange 2010? XML attachment with non-XML extension content gets stripped

    Is it possible to disable SafeHTML in Outlook Web App on Exchange 2010?
    We have users that receive messages with attachments that are generated by a 3rd party.
    They are XML files saved with a XLS extension.
    When opening via Outlook, Excel prompts that the content does not match the content type and asks the user if they want to open the file anyway, when opened the file does contain the data.
    When opening the file via OWA, the contents are stripped out and replaced with the text: This attachment was removed because it contains data that could pose a security risk.
    The problem is that some users exclusively use OWA and they need to be able to open these attachments.
    Thank You.

    Hi,
    You can disable the OWA SafeHTML filtering by changing changing the
    BypassOwaHTMLAttachmentFiltering option to true, for more details, please refer to the following article.
    All HTML content in attachment files of messages is run through an HTML filter when you open or save the attachment by using Outlook Web Access (OWA)
    http://support.microsoft.com/kb/958881
    Best regards,
    Belinda Ma
    TechNet Community Support

  • How to count number of xml nodes , with JSTL XML api?

    I am trying to count the number of nodes in the parsed xml by doing this:
    <x:out select="count($doc/Items/Item)"/>
    There are about 50 item nodes in the source xml, but I get the output as 0
    Is this syntax correct?
    I searched every where but couldn't find the xpath syntax to be used inside jstl xml tags, I was assuming that it's the same as the syntax used in xslt

    Thank you for your reply, sorry I wasnt very clear with my question.
    I want to count the number of nodes inside the jsp file , not inside the xslt file.
    My xml file is something like this for example:
    <?xml version="1.0" encoding="UTF-8"?>
    <DocumentRootNode>
    <Products>
    <Item>1</Item>
    <Item>2</Item>
    <Item>3</Item>
    <Products>
    </DocumentRootNode>
    I want the count of number of Item nodes , in the JSP file.
    I'm doing something like this in the JSP but it gives 0 instead of 3:
    <c:import url="source.xml" var="xml" charEncoding="UTF-8"/>
    <x:parse doc="${xml}" var="xml_doc"/>
    <x:out select="count($xml_doc/Products/Item)"/>
    null

  • Xml bean with other Xml Bean

    Is there a way to make two set's of generated java classes from the same schema
    to work together?
    I generated two sets of java classes using scomp. one set with xsdConfig and the
    other without.
    I got two sets of java classes that are mapped to the same schema.
    when I am trying to pass the same string of the first Document class as an argument
    and to the second Document parser I am getting a class cast exception on the second
    one.
    // example
    RootDoc1 doc1 = RootDoc1.Factory.parse("a valid xml string");
    RootDoc2 doc2 = RootDoc2.Factory.parse("same xml string here"); <= couse a class
    cast exception because it returns a RoodDoc1 type.

    why nobody helping me
    pls help me
    i am stucked with type mapping error?

  • SSIS 2008 R2 : XML issue with ?xml version="1.0" encoding="iso-8859-1"?

    hi Friends,
    Please help me in below error , I am using XML data source with below encoding
    <?xml version="1.0" encoding="iso-8859-1"?>
    While generating xsd, i am getting below error. 
    '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.
    the xml is parsing correctly as i am using XML spy to check the xml.
    Any help is appritiated.
    Thanks in advance,
    Pari

    I think XMLSpy does something to swallow the null char.
    I'd inspect this file in a professional editor to determine whether (likely) a hex 0x00 is in the file.
    Arthur
    MyBlog
    Twitter

  • Selecting XML Children with Namespaces

    I am trying to select child nodes of an XML element that have
    a different namespace from the parent, but xml.child(name) returns
    an empty list.
    In the attached code, londonList contains a single XML
    element and parisList is empty. I can't figure out how to find the
    paris child, and have tried adding the prefix to findParis (so it
    is "ff:b") as well as turning findParis into an XML object with the
    name "b" and adding the ff namespace to it, then passing that to
    child. Neither of those have worked.
    Any help is appreciated.

    Unfortunately in my real scenario I don't know what the
    element will be called. It could be in <foo> or <bar>
    etc, so I need to be able to use a variable (in which the element
    name is set beforehand). With "::" I can't use a variable, so
    textXML.ns::findParis looks for a "findParis" element and not "b".
    That's why I'm trying to use testXML.child(findParis) because
    I can use a variable. I just can't figure out how to make it
    incorporate the namespace as well.

  • How can i filter an xml object on an attribute?

    I want address an xml object with .(@ attributeNameHere == "textToSearchForHere") and have it return the node it’s associated with. 
    This is the text from the adobe help site and it’s similar to my actual code.  I’m querying this xml object: staticVar.employee.(@id=="347").  FlashBuilder 4.7 is returning an error “No such variable: @id”. when I look in debugger.
    This example is found in Adobe's help site: Adobe Flash Platform * Traversing XML structures
    The help site says
    The following expressions are all valid:
    x.employee.(lastName == "McGee")—This is the secondemployeenode.
    x.employee.(lastName == "McGee").firstName—This is thefirstNameproperty of the secondemployeenode.
    x.employee.(lastName == "McGee").@id—This is the value of theidattribute of the secondemployeenode.
    x.employee.(@id == 347)—The firstemployeenode.
    public var staticVar:XML = 
    <employeeList>
          <employee id="347">
               <lastName>Zmed</lastName>
               <firstName>Sue</firstName>
               <position>Data analyst</position>
          </employee>
          <employee id="348">
               <lastName>McGee</lastName>
               <firstName>Chuck</firstName>
               <position>Jr. data analyst</position>
          </employee>
    </employeeList>;
    I’m expecting this: staticVar.employee.(@id=="347") will return the following node:
    <employee nu="347">
    <lastName>Zmed</lastName>
    <firstName>Sue</firstName>
    <position>Data analyst</position>
    </employee>
    If this is the wrong, then what is the correct way to access the xml node based on an attribute?  How can i get that node 347 in this example to be found and returned?  I've opened a ticket with the adobe help team and we're on the 8th day and they have not been helpful at all.

    If you are using e4x as the result format for your service
    you can do the following
    //a XMLList of all day information
    var result:Object = event.result.day;
    //consits all information for month zero
    var month0:XMLList = result.(@month == 0);
    //consists of booking info for day 28 of month 0
    var day28Month0:XMLList = month0.(@day == 28);
    //this also can be done
    //contains booking info for all months for day 28
    var day28AllMonths:XMLList = result.(@day == 28);
    Using this technique you should be able to gather info about
    all user selected dates and build the smaller (filtered) list.
    HTH

  • First time with Oracle XML database

    Hi!
    I'm a beginner with XML and with Oracle XML database so i need same help. I've read the documentation (example for XML Oracle).
    What do i need to write XML files from an oracle database and the other way to read XML files into the database?
    Or does anyone know how i can get information about this?
    Thank's for help!
    With best regards
    Nicole

    Nicole,
    One quick way to get xml out of the database is to use the dbms_xmlgen.getXML package.
    i.e. in sqlplus
    set long 4000
    select dbms_xmlgen.getxml('select * from emp') from dual;
    or
    set long 4000
    select dbms_xmlgen.getxml('select column_name from owner.tablename') from dual;
    HTH

Maybe you are looking for

  • How to create a group that is visible in workspace

    I would like to assign a task to group "Test".  However, I get an "invalid principal exception" when I do so through the assign task process.  My group "Test" is set up with "workspace user".  I have added "user 1" to the group.  User1 has the "works

  • Where is sort by release date in itunes store?

    Taking this feature away makes it VERY difficult to find what you're looking for in the store now.  For example, if you search for GLEE, and filter media by type 'music' there are hundreds of songs.  I can't figure out how they are sorted (if at all.

  • Displaying a HashSet in alphabetical order

    I neded to display a HashSet in alphabetical order,but only display those words beginning with 'a','h','m' - both lower and upper case. Can someone give me a clue?

  • Error in webdynpro component

    Hi All , I am getting this error when I am running the application from portal end . Can anyone please help me out Error Summary While processing the current request, an exception occured which could not be handled by the application or the framework

  • Cannot order book form Canada

    in iphoto11 I go to buy book and I cannot ship to Canada. The only options are US. I have ordered many times before to canada what is the issue ?