Possibility of more then one xml input to jet? - code-generation

Can we give more then one xml input to jet(java emitter template)?
If we can, then please give me an example.

You can't do it directly, but there are several techniques you can use to specify multiple XML's as input.
You can name one XML file inside the other or create a third XML file that simply names the two inputs (or however many you have). Say you have an XML file named in the input XML to JET:
<inputs>
<input name="...full file name here..." />
<inputs>
You can load this file in for use in JET like this:
<c:load url="{/inputs/input/#name}" var="root"/>
The load tag reads a file (defaults to XML, but other types can be input.) and makes its contents available via the variable name you specify ("root" in this case). Normally the url attribute expects a String value that is the file name, but since we're using an attribute out of the model we use the curly brackets and xpath notation to indicate the attribute value to use as the file name.
Once you've loaded the file in you can access its contents. For example, if the root element in that XML file was and it had an attribute named company, then you attribute could access that attribute value with the c:get
<c:get select="$root/policies/#company" />
You can load as many files as you want. Just use a different variable name to refer to the root of each parsed file.
You could get a bit more complex and store your multiple files in the same directory using a naming convention. Then you could just specify the one directory path and derive the file names for all of your inputs.

Related

How to create pathfield generically so that it handles all extensions in cq5

When we take a pathfield value in jsp, need to provide harcoded ".html" or ".pdf".
Is there any way to make pathfield generic, hence no need to provide hard coded extensions? So if a user selects .pdf it will display a pdf file and if user selects .html it will open a html file.
Not sure if there is a OOB way to do this. Alternatively, You can create a script/custom jstl tag which take path as input, load resource and find out resource type and generate path with correct extn as output.
Call this script from all your components which generate links.
Another option is you extend com.day.cq.rewriter.pipeline.RequestRewriter and in rewriteLink() function write your logic to set correct extn.

Put File Mask on tFileList Component dynamically

I was wondering if you let me know how I can set file mask for tFilelist component in Talend that it recognize date automatically and it will download only data for desired date?
I have tried some approach and I faced with some errors like "the method add (string) in the type list <String> is not applicable for the arguments (Date)"
There are two ways of doing it.
Create context variable and use this variable in file mask.
Directly use TalendDate.getDate() or any other date function in file mask.
See both of them in component
1st approach,
Create context variable named with dateFilter as string type.
Assign value to context.dateFilter=TalendDate.getDate("yyyy-MM-dd");
Suppose you have file name as "ABC_2015-06-19.txt" then
In tFileList file mask use this variable as follows.
"ABC_"+context.dateFilter+".*"
2nd approach
In tFileList file mask use date function as follows.
"ABC_"+TalendDate.getDate("yyyy-MM-dd")+".*"
these are the two best way, you can make changes in file mask per your file names.

MS Word, DOCX, Open XML - Apply themes by changing XMLs

Need to apply theme from one word document (DOCX) to another via manipulating the XMLs.
The road I'm going through is -
word/themes folder contains at least one theme#.xml and could have the rels folder containg relationship files. I decided not to touch the rels folder and copy all theme#.xmls (as could be more than one) present in word/theme folder. This is working for me.
I have two concerns over it:
1. Do I need to add theme1.xml.rels file present in word\theme_rels as well? It contains mapping to one image in word\media folder. Do I need to add the image mapping too?
2. For few themes such as "Quotable", the theme1.xml contains one reference in 'a:fmtScheme' node to relationship id, probably for DrawingML and shapes.
for ex:
<a:blipFill rotWithShape="1">
<a:blip xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:embed="rId1">
As the "rId1" here refers to styles.xml and maintained in word_rels\document.xml.rels, my concern is the word_rels\document.xml.rels mapping to styles.xml could not be rId1 in the document to which theme is getting applied (for instance this could be rId5 for styles.xml). So, Do I need to change this in theme1.xml while copying to work it properly.
Any help would be greatly appreciated.
If this XML appears in theme1.xml, 'rId1' is a key in theme1.xml.rels, not the document.xml.rels. The relationship ids (rId#) are unique within a 'source' XML document but are not unique within the overall package (.docx file).
Since this one is a <a:blip> element, the relationship will be to an image part, e.g. image1.jpg. I suspect this one is a large-ish quotation mark image that appears in front of a pull-out quote.
If you want it to show up properly, you'll want to make sure those relationships and their target parts are reconstructed in your target package. That would mean "yes", you would want to add the theme1.xml.rels file in the right place, as well as the image file it refers to.

Matching of data files to pages

I have used the assemble/boilerplate-site as a test bed. Following the examples on http://assemble.io/docs/Data.html I have created a page named test.hbs and a data file named test.yml.
The yaml file contains:
title: stuff
when running grunt assemble, a test.html page is assembled into the destination directory. if my test.hbs contains the tag {{title}} the title is not added from the data file, however a tag of {{test.title}} does add the title from the data file.
on the docs page http://assemble.io/docs/options-data.html it states:
When using "external" data files (versus YAML front matter), if name of the data file is the same as the associated template then Assemble will automatically associate the two files.
I also need to use the {{title}} tag in my layout. This works if I use YFM at the top of the page rather than an external data file.
Am I misunderstanding how external data files are associated with a page or am I missing something?
You can use {{page.title}} in your test.hbs and layout.hbs files to access the variable without having to specify the actual page name.

Get the tileset file names for TMXTiledMap

What's the best way to retrieve an array containing the file names of the files used to load a certain CCTMXTiledMap ? I need to get the tileset file names because I want to dispose of them personally from the Cache in a future.
According to the documentation and declaration of CCTMXTiledMap, you'll want to walk the property NSMutableArray* objectGroups. Otherwise, you'll need to maintain your own data structure.
This thread contains robust documentation and examples that should help you.
Open the tmx file, it is an xml file, and search for
it has a tag with a source attribute.
<tileset firstgid="1" name="sewer_tileset" tilewidth="24"
tileheight="24"> <image source="sewer_tileset.png" trans="ff00ff"
width="192" height="217"/> </tileset>
you can parse the xml and just find all tileset->images.
You will need an xml parser if you want to do it on the phone, here is a good tutorial on that :http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project