Write xml to file
Hi
I am trying to update an SVG file stored on the client. I am using kxml XmlWriter, but can not figure out how to write to file. Any help would be much appreciated.
Hi,
Do you mean that you would like to write output to an external file somewhere on flask disk or perhaps even inside the directory where the MIDlet is located?? To be able to do so you will need manufacturere specific APIs extended on FileConnection (=JSR, don't know the number right now...). The default MIDP I/O libary does not support direct action on a file.
However, such a FileConnection method invocation requires an import statement that is manufacturere specifc...
To keep your MIDlet CLDC MIDP compliant you can try using RMS with which you can write data that will be stored in a 'database' within the 'res' directory inside your MIDlet suite. If you're new to RMS, please check the web for tutorials, etc etc.
Cheers for now,
Jasper
Similar Messages
-
How to write XML into file using JSP
Hello,
I am parsing a XML file, then updating some of it content and trying to write back the updated file into the same location as an xml document but its not happening correctly....it gets written like this.
&_lt;db_name&_gt;dataext&_lt;/db_name&_gt;
Here is my code......somebody please advise
<%@ page contentType="text/html"%>
<%@ page import="java.io.*,
java.util.*,
org.jdom.*,
org.jdom.input.SAXBuilder,
org.jdom.output.*" %>
<%
String xml_file = "webapps/root/web-inf/admin.xml";
SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
Document l_doc = builder.build(new File(xml_file));
Element root = l_doc.getRootElement();
List admin = root.getChildren("db");
Iterator loop = admin.iterator();
while ( loop.hasNext()) {
Element ele = (Element)loop.next();
String state = ele.getChild("state").getText();
String name = ele.getChild("db_name").getText();
String ip = ele.getChild("db_ip").getText();
if(state.equals("Florida")) {
ele.getChild("db_ip").setText("209.11.111.1");
XMLOutputter l_format = new XMLOutputter();
String ls_result = l_format.outputString(l_doc);
root.setText(ls_result);
ls_result = l_format.outputString(l_doc);
%>
<html><head><title></title></head>
<body>
<%
try {
FileOutputStream ostream = new FileOutputStream("c:\\admin.xml");
ObjectOutputStream p = new ObjectOutputStream(ostream);
p.writeObject(ls_result);
p.flush();
ostream.close();
catch(Exception e) {
out.println(e.toString());
%>
</body>
</html>thanks amgandhi.....
I found a solution for it, courtesy of this site:
http://www.topxml.com/tutorials/main.asp?id=jdom&page=15
<-********************************************************->
import org.jdom.output.XMLOutputter;
import org.jdom.*;
import java.io.*;
import java.util.*;
// Write a program that creates document with a
// single root element. Add a comment to the
// root element, and assign the document's XML to
// a local string. Finally, write the String to
// System.out, and write the document to a text file.
// For bonus points, allow the user to specify the
// file name on the command line.
public class ws3
public static void main(String[] args)
String filename = "default.xml";
if(args.length > 0) filename = args[0];
Element root = new Element("simple");
Document doc = new Document(root);
Comment cmt = new Comment("A bare document!");
root.addContent(cmt);
XMLOutputter outputter = new XMLOutputter(" ",
true);
String xml = outputter.outputString(doc);
System.out.println(xml);
writeToFile(filename, doc);
private static void writeToFile(String fname,
Document doc)
try {
FileOutputStream out =
new FileOutputStream(fname);
XMLOutputter serializer =
new XMLOutputter(" ", true);
serializer.output(doc, out);
out.flush();
out.close();
catch (IOException e) {
System.err.println(e);
} -
Write XML to file - character set problem
I have a package that generates XML from relational data using SQLX. I want to write the resulting XML to the unix file system. I can do this with the following code :
DECLARE
v_xml xmltype;
doc dbms_xmldom.DOMDocument;
BEGIN
v_xml := create_my_xml; -- returns an XMLType value
doc := dbms_xmldom.newDOMDocument(v_xml);
dbms_xmldom.writeToFILE(doc, '/mydirectory/myfile.xml');
END;
This creates the file but characters such å,ä and ö are getting 'corrupted' and the resultant xml is invalid.(I've checked the xml within SQL*Plus and the characters are OK)
I assume the character set of the unix operating system doesn't support these characters. How can I overcome this ?Hi,
Do you mean that you would like to write output to an external file somewhere on flask disk or perhaps even inside the directory where the MIDlet is located?? To be able to do so you will need manufacturere specific APIs extended on FileConnection (=JSR, don't know the number right now...). The default MIDP I/O libary does not support direct action on a file.
However, such a FileConnection method invocation requires an import statement that is manufacturere specifc...
To keep your MIDlet CLDC MIDP compliant you can try using RMS with which you can write data that will be stored in a 'database' within the 'res' directory inside your MIDlet suite. If you're new to RMS, please check the web for tutorials, etc etc.
Cheers for now,
Jasper -
Unparsing a DOM tree and write XML to file
Hi,
I have created a DOM tree from scratch and would like to unparse the DOM tree and write the XML to a file, but how do I do that?
Does anybody got code examples that do this?
All help are very appreciated!
/DanielThank you very much for the hint! Unfortunaly I still got problem to get it work though.
I made a little piece of test code to try it but during the execution of the "Transformer.transform(source,result)" method I gets an "org.w3c.dom.DOMException".
Does anybody see what that problem might be cause of by exmining the code below?
I also would like to know how to specify the location where I would like to print out the XML file.
Here is my little piece of test code:
try{
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFadctory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
doc.appendChild(doc.createElement("topLevel"));
Element elm = doc.getDocumentElement();
elm = (Element)elm.appendChild(doc.createElement("PersonData"));
elm = (Element)elm.appendChild(doc.createElement("Name"));
elm.setAttribute("Firstname","D");
elm.setAttribute("Lastname", "D");
DOMResult result = new DOMResult(doc);
DOMSource source = new DOMSource(doc);
TransformerFactory transformerFactory = TansformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(source,result);
}catch(ParserConfigurationException e) {
}catch(IOException e) {
}catch(TransformerException te) { -
How to write a Xml installation file to build web installer using IzPack.
Hai everyone,
I have got a problem in building a web installer using IzPack.I am getting this exception,when I am compiling my install.xml using a compile tool provided by IzPack soft.Eventhough I have not mentioned "packsinfo.xml" in my Xml installation file.
Fatal error :
null\packsinfo.xml (The system cannot find the path specified)
java.io.FileNotFoundException: null\packsinfo.xml (The system cannot find the path specified)
What went wrong??
It is very very urgent. Could anyone tell me how to write a Xml installation file for building web installer,please??
any help will be highly appreciated....
Thank you very much in advanceHi,
that is not really a java related question. Have you tried to find some IzPack support forum? I've never heard about it, so I can't help. -
How to write a Xml installation file to build a web installer using IzPack.
Hi Everybody,
I am using IzPack 3.11.0 version.I'd like to create a web installer using IzPack.IzPack soft has provided one p.d.f. In
which they has explained how to create a standard installer using xml installation file,however ,they have not explained
how to create a web installer using xml installation file.
Could anyone help me how to create a web installer using xml installation file,please?? It is very very urgent.
Any help will be highly appreciated.Thank you very much in advance.Hi,
that is not really a java related question. Have you tried to find some IzPack support forum? I've never heard about it, so I can't help. -
OESB File Adapter (Read .xml file to Write .xml)
Hi All,
The fileRead adapter of reading xml format file not writing the content to another xml file.
In detail, I have a xml file of type (myschema.xsd) to pick using read operation will transform to output directory as xml format (pls find attachment as myschema1.xsd) is not writing the content in out xml file rather writing an empty elements. The same thing working with CSV to CSV.
Has anybody come across the same? Also found out the same issue with BPEL file adapter as well.
Any light on this will very much appreciated
myschema.xsd
+<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org" targetNamespace="http://www.example.org/readFile" xmlns:ns1="http://www.example.org/readFile" elementFormDefault="qualified">
<xsd:element name="Opportulity">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customer" type="ns1:Customer" />
<xsd:element name="Account" type="ns1:Account" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="Customer">
<xsd:sequence>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Account">
<xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>+
myschema1.xsd
+<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org" targetNamespace="http://www.example.org/writeFile" xmlns:ns1="http://www.example.org/writeFile" elementFormDefault="qualified">
<xsd:element name="Customer">
<xsd:complexType>
<xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>+
Regards
Venkata Madhuxslt
<?xml version="1.0" encoding="UTF-8" ?>
<?oracle-xsl-mapper
<!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
<mapSources>
<source type="WSDL">
<schema location="readFile.wsdl"/>
<rootElement name="Opportulity" namespace="http://www.example.org/readFile"/>
</source>
</mapSources>
<mapTargets>
<target type="WSDL">
<schema location="writeFile.wsdl"/>
<rootElement name="Customer" namespace="http://www.example.org/writeFile"/>
</target>
</mapTargets>
<!-- GENERATED BY ORACLE XSL MAPPER 10.1.3.3.0(build 070615.0525) AT [TUE FEB 03 17:58:26 GMT+05:30 2009]. -->
?>
<xsl:stylesheet version="1.0"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:pc="http://xmlns.oracle.com/pcbpel/"
xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
xmlns:ns0="http://www.w3.org/2001/XMLSchema"
xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/"
xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/file/writeFile/"
xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
xmlns:imp1="http://www.example.org/readFile"
xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
xmlns:ns2="http://www.example.org/writeFile"
xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/file/readFile/"
xmlns:hdr="http://xmlns.oracle.com/pcbpel/adapter/file/"
exclude-result-prefixes="xsl plt pc ns0 jca imp1 tns hdr ns1 ns2 bpws ehdr hwf xp20 xref ora ids orcl">
<xsl:template match="/">
<ns2:Customer>
<ns2:RoleType>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:RoleType"/>
</ns2:RoleType>
<ns2:FirstName>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:FirstName"/>
</ns2:FirstName>
<ns2:LastName>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:LastName"/>
</ns2:LastName>
<ns2:CustomerID>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:CustomerID"/>
</ns2:CustomerID>
<ns2:Nationality>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:Nationality"/>
</ns2:Nationality>
<ns2:Phone>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:Phone"/>
</ns2:Phone>
<ns2:EmailAddress>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:EmailAddress"/>
</ns2:EmailAddress>
<ns2:AddressLine1>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:AddressLine1"/>
</ns2:AddressLine1>
<ns2:AddressLine2>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:AddressLine2"/>
</ns2:AddressLine2>
<ns2:City>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:City"/>
</ns2:City>
<ns2:State>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:State"/>
</ns2:State>
<ns2:County>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:County"/>
</ns2:County>
<ns2:Postal>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:Postal"/>
</ns2:Postal>
<ns2:Country>
<xsl:value-of select="/imp1:Opportulity/imp1:Customer/imp1:Country"/>
</ns2:Country>
</ns2:Customer>
</xsl:template>
</xsl:stylesheet>
Venkata Madhu -
XML DB repository/ Could not write to configuration file
I have one problem when I create same JDBC datasource and test connection I get: "Connection established successfully". but when I trying to save it I get: "Could not write to configuration file".
I using Oracle XE 10g database and "system" user for JNDI connection. I tryed with new user witch I gived all database permissions but I get same error message.
Do you have any idea what do I need to configure.
Thanks!This error happens, when the file permission is missing.
or the file got corrupted, change the permission to Admin folder.
Check the folder permission to this oc4j\j2ee\home\applications\xmlpserver\xmlpserver\WEB-INF -
How to Edit a XML data file from AS3 class...
Hi...
I need to edit an XML data file I have at the exit of application.... I have a demo code which is not working....
This is the code :
public function UpdateData():void
trace("Closing....");
var FileData:XML=<Hello>Hai</Hello>
var urlLdr:URLLoader = new URLLoader();
var urlRqst:URLRequest = new URLRequest ("AppData.xml");
urlRqst.data=FileData;
urlRqst.contentType = "text/xml";
urlRqst.method = URLRequestMethod.POST;
urlLdr.load(urlRqst);
This AppData file already exist and has some data in it.
Plus :
How to find the application is exiting.use: fscommand('Quit');
to exit your app.
and this is how you would use the urlloader class to save data:
public function UpdateData():void
trace("Closing....");
var FileData:XML=<Hello>Hai</Hello>
var urlVar:URLVariables=new URLVariables();
urlVar.fileData=FileData;
var urlLdr:URLLoader = new URLLoader();
var urlRqst:URLRequest = new URLRequest ("this must be an executable to parse and write data");
urlRqst.data=urlVar;
urlRqst.contentType = "text/xml";
urlRqst.method = URLRequestMethod.POST;
urlLdr.load(urlRqst);
but i don't think you can use an executable on a fl4 device so you will need to use a different class. i don' know how you're storing an xml file on a fl4 device but you should be able to use the sharedobject to read and store xml. -
ABAP Simple Transformation - How to save XML to file with CL_FX_WRITER?
Hello!
When calling a Simple Transformation program for transformation from ABAP to XML, it is possible to specify RESULT XML rxml as a class reference variable of type CL_FX_WRITER, which points to an XML writer.
How to handle CL_FX_WRITER in order to save XML to a file?
Thanks and regards,
AndreyHallo Rainer!
Many thanks. I have checked the profile parameter ztta/max_memreq_MB and it is set to 2048 MB in the development system. I hope, that won't be less on the client's machine. The only thing I did not clearly explained, is that I need to write XML data to the server. I am so sorry. Downloading to the local PC is very helpful for me also, but only for the test purposes.
Regards,
Andrey -
How can I write to a file from a livecycle designed PDF?
I am producing a PDF in Livecycle designer and would like to write a sub-set of data from the document.
I have tried methods such as exportData() but this exports everything which i don't need.
I have seen another method which is to attach a file and write to that but ideally I'd just like to be able to create a new file.
var data = xfa.data.nodes.item(0).nodes.item(1).saveXML() var oFile = util.streamFromString(data , "utf-8");
I would like to write oFile.
Thanks in advance
Edit:
I would like to add that ideally the user would be presented with a save as dialog box, so the can choose the location of where to save the xml data.an extraction out of expert one-on-one from Thomas Kyte
<quote>
when an oracle istance is created the services that support it are setup to 'log on as' the system (or operating system) account, this account has very few privileges and no acces to Window NT Domains. To access another Windows NT machine the OracleServiceXXXX must be setup to logon to the appropriate Windows NT Domain as a user who has acces to the required location for UTL_FILE.
To change the default logon for the Oracle services go to (in Windows NT):
Control Panel | Services | OracleServiceXXXX | startup | log on as; (where XXXX is the instance name)
In Windows 2000, this would be:
Control Panel | Administrative Tools | Services | OracleServiceXXX | Properties | Log on tab; (again XXXX is the instance name)
Choose the This Account radio button, and then complete the appropriate domain login information. ONce the services have been setup as a user with the appropriate privileges, ther are two options dfor setting UTL_FILE_DIR:
* Mapped Dirve: To use a mapped drive, the user that the service starts as must have setup a drive to match UTL_FILE_DIR and be logged onto the server when UTL_FILE is in use.
* Universal Naming Convention: UNC is preferable to Mapped Drives because it does not require anyone to be logged on and utl_file_dir should be set to a name in the form \\<machine name>\<share name>\<path>
You will of course need to stop and restart Oracle after changing the properties of the service.
<\quote>
I want to write some data to a (external) file. I have it working with the function UTL_FILE.
My problem is I want to write to a file on a mapped drive (so a drive on a different machine). This is not working.
Does anyone know a way to build this.
Please send your responses to [email protected]
Many thanks,
Alex Nagtegaal -
Write xmp sidecar files without need to export masters - script
I've written a script to write xmp sidecar files for referenced and online images (the 2 conditions in the script) of the selected images. I looked for a while at system events and other stuff to be able to write the xmp file, but i'm not a programmer, so in the end i chose the long and dirty way to do it.
This script will export all iptc expanded fields as aperture does (creating basically the same file). It can be easily adjusted to include other tags, even custom ones. I don't know how to get at the adjustments for images, otherwise those could be included as well.
If anyone has the energy to clean this up and make it faster, feel free to do so. Next, I'm going to try to write a script to do the opposite, import xmp sidecars for imported online and referenced files.
Here it goes (thanks to Brett Gross for the database part to find the master filename):
--script to create sidecar xmp files for referenced files without having to export masters. parts of the script (finding the file name) are by brett gross
property p_sql : "/usr/bin/sqlite3 "
global g_libPath
on run
my getLibPath()
--counter for processed images, reset, just in case
set mastercount to 0
tell application "Aperture"
if not (exists selection) then
display dialog "You have to select at least one image" buttons {"OK"} default button 1
return
else
display dialog "You have selected " & (count of selection) & " images." & return & "Continue?" default button 1
end if
set theSel to selection
--run through the selected images
repeat with currentpic from 1 to count of theSel
tell item currentpic of theSel
-- only apply to referenced and online images
if referenced and online then
set mastercount to mastercount + 1
set curID to id
--find the master file path and name - this part by brett gross, thanks
set libPOSIX to POSIX path of g_libPath
set libDBPOSIX to (libPOSIX & "/Aperture.aplib/Library.apdb") as string
set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZFILEUUID from ZRKVERSION where ZUUID='" & curID & "'\""
set ZFILEUUID to do shell script theScript
# ---------- Get the master's path
set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZIMAGEPATH from ZRKFILE where ZUUID='" & ZFILEUUID & "'\""
set ZIMAGEPATH to do shell script theScript
# ---------- Get the master's disk name
set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZFILEVOLUMEUUID from ZRKFILE where ZUUID='" & ZFILEUUID & "'\""
set ZFILEVOLUMEUUID to do shell script theScript
set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZNAME from ZRKVOLUME where ZUUID='" & ZFILEVOLUMEUUID & "'\""
set diskName to do shell script theScript
set imgPath to (diskName & "/" & ZIMAGEPATH)
--end brett gross part
--strips extension, seems to work for files and paths with more than one period
set oldlim to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
try --remove last extension only
set contador to text item -1 of imgPath
set noExtension to Unicode text 1 thru -((count of contador) + 2) of imgPath
on error --handle files with no extensions
set noExtension to imgPath
end try
set AppleScript's text item delimiters to oldlim
--create the file and path name with the .xmp extension for writing
set xmpPath to "/Volumes/" & noExtension & ".xmp" as Unicode text
--convert posix path to alias for easier write and read handling
set xmpPath to POSIX file xmpPath as file specification
-- header for xmp file
set xmpheader to ("<?xpacket begin='' id=''?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9-9, framework 1.6'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>") & return
-- footer for xmp file
set xmpfooter to ("</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>") & return
--xmp content, part 1
--check for existence of iptc tags, create content or empty string depending on existance of tags
if (exists IPTC tag "Contact") or (exists IPTC tag "Country/PrimaryLocationCode") then
set xmpcontentpartone to ("<rdf:Description rdf:about='' xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'>") & return
try
set CountryCode to value of IPTC tag "Country/PrimaryLocationCode"
set xmpcontentpartone to xmpcontentpartone & tab & "<Iptc4xmpCore:CountryCode>" & CountryCode & "</Iptc4xmpCore:CountryCode>" & return
end try
try
set CreatorContactInfo to value of IPTC tag "Contact"
set xmpcontentpartone to xmpcontentpartone & tab & "<Iptc4xmpCore:CreatorContactInfo>" & CreatorContactInfo & "</Iptc4xmpCore:CreatorContactInfo>" & return
end try
set xmpcontentpartone to xmpcontentpartone & ("</rdf:Description>") & return
else
set xmpcontentpartone to ""
end if
--xmp content, part 2
--check for existence of iptc tags, create content or empty string depending on existance of tags
if (exists IPTC tag "Category") or (exists IPTC tag "City") or (exists IPTC tag "Country/PrimaryLocationName") or (exists IPTC tag "Credit") or (exists IPTC tag "DateCreated") or (exists IPTC tag "Headline") or (exists IPTC tag "Province/State") or (exists IPTC tag "Source") or (exists IPTC tag "SpecialInstructions") or (exists IPTC tag "SupplementalCategory") or (exists IPTC tag "Writer/Editor") then
set xmpcontentparttwo to ("<rdf:Description rdf:about='' xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>") & return
try
set Category to value of IPTC tag "Category"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Category>" & Category & "</photoshop:Category>" & return
end try
try
set City to value of IPTC tag "City"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:City>" & City & "</photoshop:City>" & return
end try
try
set Country to value of IPTC tag "Country/PrimaryLocationName"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Country>" & Country & "</photoshop:Country>" & return
end try
try
set Credit to value of IPTC tag "Credit"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Credit>" & Credit & "</photoshop:Credit>" & return
end try
try
set DateCreated to value of IPTC tag "DateCreated"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:DateCreated>" & DateCreated & "</photoshop:DateCreated>" & return
end try
try
set Headline to value of IPTC tag "Headline"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Headline>" & Headline & "</photoshop:Headline>" & return
end try
try
set State to value of IPTC tag "Province/State"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:State>" & State & "</photoshop:State>" & return
end try
try
set Source to value of IPTC tag "Source"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Source>" & Source & "</photoshop:Source>" & return
end try
try
set Instructions to value of IPTC tag "SpecialInstructions"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Instructions>" & Instructions & "</photoshop:Instructions>" & return
end try
try
set SupplementalCategory to value of IPTC tag "SupplementalCategory"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:SupplementalCategory>" & SupplementalCategory & "</photoshop:SupplementalCategory>" & return
end try
try
set CaptionWriter to value of IPTC tag "Writer/Editor"
set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:CaptionWriter>" & CaptionWriter & "</photoshop:CaptionWriter>" & return
end try
set xmpcontentparttwo to xmpcontentparttwo & ("</rdf:Description>") & return
else
set xmpcontentparttwo to ""
end if
--xmp content, part 3
--check for existence of iptc tags, create content or empty string depending on existance of tags
if (exists IPTC tag "Byline") or (exists IPTC tag "Caption/Abstract") or (exists IPTC tag "CopyrightNotice") or (exists IPTC tag "Keywords") or (exists IPTC tag "ObjectName") then
set xmpcontentpartthree to ("<rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/elements/1.1/'>") & return
try
set creator to value of IPTC tag "Byline"
set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:creator><rdf:Seq><rdf:li>" & creator & "</rdf:li></rdf:Seq></dc:creator>" & return
end try
try
set description to value of IPTC tag "Caption/Abstract"
set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:description><rdf:Alt><rdf:li xml:lang='x-default'>" & description & "</rdf:li></rdf:Alt></dc:description>" & return
end try
try
set rights to value of IPTC tag "CopyrightNotice"
set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:rights><rdf:Alt><rdf:li xml:lang='x-default'>" & rights & "</rdf:li></rdf:Alt></dc:rights>" & return
end try
--keywords, slightly different, as they need to be written as a list and not as a string
--i don't think it's a problem if we create an empty list if there are no keywords present.
set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:subject><rdf:Bag>" & return
--make list item for every keyword
try
repeat with n from 1 to count of keywords
set cursubject to name of (keyword n)
set xmpcontentpartthree to xmpcontentpartthree & tab & tab & "<rdf:li>" & cursubject & "</rdf:li>" & return
end repeat
end try
set xmpcontentpartthree to xmpcontentpartthree & tab & "</rdf:Bag></dc:subject>" & return
try
set title to value of IPTC tag "ObjectName"
set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:title><rdf:Alt><rdf:li xml:lang='x-default'>" & title & "</rdf:li></rdf:Alt></dc:title>" & return
end try
set xmpcontentpartthree to xmpcontentpartthree & ("</rdf:Description>") & return
else
set xmpcontentpartthree to ""
end if
--part four. aperture doesn't seem to export anything there
set xmpcontentpartfour to "<rdf:Description rdf:about='' xmlns:photomechanic='http://ns.camerabits.com/photomechanic/1.0/'>
</rdf:Description>" & return
--part five. rating
set xmpcontentpartfive to "<rdf:Description rdf:about='' xmlns:xap='http://ns.adobe.com/xap/1.0/'>" & return
try
set Rating to main rating
set xmpcontentpartfive to xmpcontentpartfive & tab & "<xap:Rating>" & Rating & "</xap:Rating>" & return
end try
set xmpcontentpartfive to xmpcontentpartfive & "</rdf:Description>" & return
--join everything
set xmptext to xmpheader & xmpcontentpartone & xmpcontentparttwo & xmpcontentpartthree & xmpcontentpartfour & xmpcontentpartfive & xmpfooter
--write file
my writexmpFile(xmptext, xmpPath)
end if
end tell
end repeat
display dialog "Processed " & mastercount & " referenced and online image(s)." buttons {"OK"} default button 1
end tell
end run
-- write xmp sidecar file routine
on writexmpFile(theContents, xmpFileName)
--tell application "Finder"
try
open for access xmpFileName with write permission
set eof of xmpFileName to 0
write (theContents) to xmpFileName starting at eof
close access xmpFileName
on error
try
display dialog xmpFileName
close access xmpFileName
end try
end try
--end tell
end writexmpFile
--this part copied from Brett Gross-------------------------------------------------------------------------- --------------------------------
on getLibPath()
tell application "System Events" to set p_libPath to value of property list item "LibraryPath" of property list file ((path to preferences as Unicode text) & "com.apple.aperture.plist")
if ((offset of "~" in p_libPath) is not 0) then
-- set p_posix to POSIX file p_libPath
set p_script to "/bin/echo $HOME"
set p_homePath to (do shell script p_script)
set p_offset to offset of "~" in p_libPath
set p_path to text (p_offset + 1) thru -1 of p_libPath
set g_libPath to p_homePath & p_path
else
set g_libPath to p_libPath
end if
end getLibPath
--end brett gross partimigra wrote:
I've written a script to write xmp sidecar files for referenced and online images (the 2 conditions in the script) of the selected images. I looked for a while at system events and other stuff to be able to write the xmp file, but i'm not a programmer, so in the end i chose the long and dirty way to do it.
This script will export all iptc expanded fields as aperture does (creating basically the same file). It can be easily adjusted to include other tags, even custom ones.
Excellent stuff!
I don't know how to get at the adjustments for images, otherwise those could be included as well.
They are stored as binary data in the Version XML files at the bottom level of the Library package. You can also have a look around in the ZRKIMAGEADJUSTMENT table, but again the actual settings for each adjustment are in binary form.
If anyone has the energy to clean this up and make it faster, feel free to do so.
As far as I can remember, Aperture uses the 'proper' IPTC tag names when accessing them via AppleScript, so you may be able to do a loop through all the IPTC tags for each image, rather than picking out each specific one. But that would need checking. The EXIFTools site is a good place to find out about the different ways that IPTC data can be described.
Next, I'm going to try to write a script to do the opposite, import xmp sidecars for imported online and referenced files.
Don't rush unless you feel like it - I've already started planning out a free (as in beer and speech) XMP importer with a GUI so that you can choose how to map the XMP CORE tags that don't exist in Aperture. You've given me an extra idea, though - if we can decide on a set of custom tags, my importer could map the XMP CORE tags to them and your exporter could export those tags.
Thanks for the work!
Ian
P.S. I'll check through your script tomorrow, some of the database tables changed between 1.5.6 and 2.0, so you might need to add in a version check to be really thorough. -
How to write a CSV file in OSB
Hi All,
can any one tell me How to write a CSV file in OSB?
Thanks.Hey, I couldnot find any xsl usage inside pipeline pair in the links given by you. Do you have any links that gives a sample example.I could not find any links with examples. I will send you a simple config jar demonstrating the use of XSLT resources/transformations.
secondly should MFL doc replicate the name(s)of the nodes of the source xsd:I'm not sure If I understood your question.Can you please explain?
Ex: My database schema looks like:
<?xml version = '1.0' encoding = 'UTF-8'?>
<xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CountriesCollection" type="CountriesCollection"/>
<xs:complexType name="CountriesCollection">
<xs:sequence>
<xs:element name="Countries" type="Countries" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Countries">
<xs:sequence>
<xs:element name="countryId">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="countryName" minOccurs="0" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="regionId" type="xs:decimal" minOccurs="0" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
and the corresponding MFL that I have created gives this output
<?xml version="1.0" encoding="windows-1252"?>
<countriesCollection1>
<Countries>
<counrtyId>counrtyId</counrtyId>
<country_name>country_name</country_name>
<regionId>regionId</regionId>
</Countries>
<Countries>
<counrtyId>counrtyId</counrtyId>
<country_name>country_name</country_name>
<regionId>regionId</regionId>
</Countries>
</countriesCollection1>
Why I am asking this beacuse there is an error that i am getting:
Jun 19, 2009 5:50:50 PM IST> <Error> <JCATransport> <BEA-381951> <JCA inbound r
quest only invocation failed, exception: java.security.PrivilegedActionExceptio
: com.bea.wli.sb.transports.TransportException: Binary to XML mfl transformatio
failed for the MFL Resource Database-Jms-File/Database-File/MFLSample : null
ava.security.PrivilegedActionException: com.bea.wli.sb.transports.TransportExce
tion: Binary to XML mfl transformation failed for the MFL Resource Database-Jms
File/Database-File/MFLSample : null..................................................
Any help?
Regards
PS -
MICR font not displayed in PDF on SUSE Linux Server for Check Writer (XML)
We are generating checks by running the Check Writer(XML) concurrent request and are not able to see MICR fonts on the Check. We downloaded the free version from IDAutomationSMICR.ttf and the fonts were registered under /usr/local/fonts/micr directory. I registered in APPS and uploaded the file IDAutomationSMICR.ttf. Am I missing any steps. The DBA's have registered the fonts under /usr/local/fonts/micr on SUSE Linux Server . The custom Checks are generated but no luck with the fonts. Please advise. Can I download MICR fonts other than IDAutomation site? Appreciate your response.
Thanks,
HariI use version 11i, so the steps are probably different. Download a font file (gnuMICR for me). Extract it to a location of your choice on your operating system.
Follow these steps to load the MICR font to the server. (Step 11 was missing in some of the metalink documents in late 2007. I think Jan. 2008 will be OK).
1. Log in as XML Publisher Administrator.
2. Navigate to Administration->Font Files->Create Font File.
3. Fields are Font Name and File. For Font Name choose any descriptive name. File will browse your PC to locate the font file.
4. Navigate to Font Mappings->Create Font Mapping Set.
5. Mapping name is the name you will give to a set of fonts. [MICR Font]
6. Mapping code is the internal name you will give to this set. [MICR]
7. Type: 'PDF Form' for PDF templates. 'FO to PDF' for all other template types.
8. Create Font Mapping (this allows you to add multiple fonts to a set).
9. Font Family is the exact same name you see in Word under Fonts. If you don't use the same name the font will not be picked up at runtime. [GnuMICR]
10. Style and weight must also match how you use the font in Windows. Normal and Normal are good defaults. [Normal, Normal]
11. DO NOT enter Language or Territory
12. Choose a value for Font Type. [Truetype]
13. Search for the Font you just created in step 3. [GnuMICR]
14. Navigate to Configuration -> FO Processing -> Font Mapping Set. Can also be done at data def and template level under Edit Configuration. Hierarchy is Site-> Data Def -> Template.
15. Select your new mapping set.
16. Make sure the font is not referenced under File->Properties->Custom in the RTF template file.
17. Select a temporary directory on your concurrent processing node (Configuration -> General). This needs to be a private area not shared by other processes, read writeable by the applmgr (owner of the $APPL_TOP file system). It should be fairly large 5 GB or 20x larger than any datafile being used. The fonts will be downloaded here the first time they are used.
18. Also at this site level select your font mapping set.
19. Upload a template that uses your special font and test using preview. -
About the exporting and importing xml data file in the pdf form
Hi all,
I need help for importing xml data file in the pdf form. When I write some thing in the text field with fill color and typeface (font) and exported xml data using email button. When I imported that xml file in the same pdf file that is used for exporting the xml data then all the data are shown in the control but not color and font typeface. Anyone has suggestion for solving this problem. Please help me for solving this problem.
Thank you
Saroj NeupaneCan you post a sample form and data to [email protected] and I will have a look.
Maybe you are looking for
-
Profit center for purchase order without account assignment
I've requirement to include profit centers in purchase orders without account assignment category. The trouble is when there is no profit center maintained in material master. Is there a way to determine profit center in purchase order for such cases
-
Why can't I open Camera Raw???
I have photoshop CS6 extended and Bridge CS6 that came with it. When I try to open image files from bridge to edit them in Camera Raw, I get this message: I tried searching for camera raw folder, no results. Apparently it's not even on my computer..
-
Regarding app store in the older iphone
i use my 1st generation iphone and i havent updated it. does the app store work in the 1st generation iphone? or is there any other way to get the other applications. do i have to update my iphone's software to make the app store work. please help..
-
Hello, just install SSMS 2012 on a Win7 box aside with SSMS 2008R2. When I launch the program, it takes nearly 12s before I have the SQL Splash screen. Any idea why is it so slow ? How can troubleshoot this issue ? Thank's for help. Olivier
-
Find view item's oraginal column in table
Hi I need to find out a column in view original column in its parent table in my SQL program. I know I can call select dbms_metadata.get_ddl('VIEW','V_EMP','SCOTT') from dual; Then I get DDL of this view CREATE OR REPLACE FORCE VIEW "SCOTT"."V_EMP" (