Reading XML data from .pages file
Hi All!
I've been trying to get a script up and running, but frankly I'm lost. The script should read the date, lesson no, and name fields from a .pages file and then use that information to send an e-mail.
What I'm having a problem with is reading the data from the .pages file and I don't know what the best way to do it is because I'm still a novice at this.
So there are two ways I can think of:
1. Read directly from the Pages document when it is open. The problem with this is that it's a Pages template and it contains tables. Perhaps the easiest thing would be just to select certain cells directly from pages, but I have no idea how they're labeled or how to access them so I came up with a second idea. If you happen to know how to do this, I would greatly appreciate it.
2. Pages documents can be unzipped and one of the files is an xml file with a lot of tags and the data I need. I found the following post that talks about how to parse XML via an XSL stylesheet. After going through some tutorials, I got stuck because the xml itself in the Pages file is just a mess to me and I'm confused about which node to choose. In other xml docs you can see a clear, nicely laid out tabbed structure so you can at least figure out the path to the node you want. I stumbled across a nice script for TextWrangler which cleans up XML, but it just barks at the Pages file.
3. On top of that, I will need to use the name field and match that with an Address Book e-mail address. Should I change the template and make it into an address book field?
Thanks in advance,
Paul
The script should read the date, lesson no, and name fields from a .pages file and then use that information to send an e-mail.
Maybe you might want to try the following script:
tell application "Pages"
activate
tell foreground layer of page 1 of front document
select (text box 1 whose vertical position < 0.5)
tell application "System Events"
keystroke "c" using {command down} -- ⌘C
keystroke "a" using {shift down, command down} -- ⇧⌘A
end tell
set theText to the clipboard
end tell
end tell
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
set theTextFields to text items of theText
set AppleScript's text item delimiters to TID
set {theDate, theLessonNo, theStudent} to {item 2, item 4, item 6} of theTextFields
Similar Messages
-
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
Reading XML Data from ABAP Program?
Hi,
How do I read XML Data from an ABAP Program? For example if I have the below basic XML Code-
<xml>
<Name> Thiru </Name>
<Age> 24 </Age>
<City> chennai </Chennai>
</xml>
How do i read the data within the Name,Age, and City tags into variables in the ABAP Program?
Regards,
Thiruif you decide to do in XSLT, I have a sample list here:
XML file like this:
<?xml version="1.0" encoding="UTF-16"?>
<F>
<P1>
<t_1>value1</t_1>
<t_2>testvalue</t_2>
</P1>
<P2>
</P2>
</F>
XSLT file like this:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="F">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<<b>DOCUMENT</b>>
<xsl:apply-templates/>
</<b>DOCUMENT</b>>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="P1">
<ENTRY>
<<b>T_1</b>><xsl:value-of select="t_1"/></T_1>
<<b>T_2</b>><xsl:value-of select="t_2"/></T_2>
</ENTRY>
</xsl:template>
</xsl:transform>
ABAP program like this:
DATA: BEGIN OF wa_upload,
text(255) TYPE c,
END OF wa_upload,
itab_upload LIKE TABLE OF wa_upload,
BEGIN OF wa_document,
t_1 TYPE string,
t_2 TYPE string,
END OF wa_document,
itab_document LIKE TABLE OF wa_document.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'XXXXX'
filetype = 'ASC'
TABLES
data_tab = itab_upload.
CALL TRANSFORMATION zrappel_xml_test
SOURCE XML itab_upload
RESULT <b>document</b> = itab_document.
You should pay attention to the bold words.
hope it will be helpful
thanks -
Regarding reading the data from the files without using Stremas
hai to all of u...
here i have a problem where i have to read the data from the files without using any streams.
please guide me how to do this one,if possible by giving with an example
Thanks & Regard
M.RamakrishnaSimply put, you can't.
By why do you need to? -
Reading the data from excel file which is in application server.
Hi,
Iam trying to read the data from excel file which is in application server.
I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
I tried just reading using open data set and read data set it is giving junk characters.
Please suggest me if you have any solution.
Best Regards,
Brahma ReddyHi Narendra,
Please see the below code I have written
OPEN DATASET pa_sfile for INPUT in text mode ENCODING DEFAULT MESSAGE wf_mess.
CHECK sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
else.
split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
wa_upload-field34 wa_upload-field35 wa_upload-field36 .
wa_upload-field1 = wf_field1.
wa_upload-field2 = wf_field2.
append wa_upload to int_upload.
clear wa_upload.
ENDIF.
ENDDO.
CLOSE DATASET pa_sfile.
Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
Please suggest me any other way.
Thanks for your help,
Brahma Reddy -
How to read the data from a file in another computer with user name and password login
How to read read the data from a file in anohter computer which need to login with user name and password?
duplicate post: http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
duplicate post: http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
duplicate post http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682 -
Kinect Explorer WPF C# read depth data from the file and conversion to skeleton
Hello,
I am using Kinect sensor to do some research on biometrics. Since it is impossible to find people to collect some samples, I would like to use samples from the TUM - GAID database, where there exist Color View and Depth View (in .raw format) samples. Therefore,
I need to read these samples from the file and do a batch processing, instead of performing real-time collecting of samples (where I can take automatically the Skeleton view using the Kinect SDK). So, I need help on
1. Reading the data from the file (instead of activating the Kinect sensor) and give this data as an input for conversion to a skeleton
2. Read the .raw files
Thank you very much
Kind regardsHiya,
I doubt this forum, C Sharp, will provide much help. You are asking about the Kinects system not C#
language. However, you can try this link; http://kinectforwindows.codeplex.com/
Hope this help. Thanks :) -
Hello,
Greetings to everybody. I am having a problem reading or capturing the XML data being send by a URL and the said URL does not send the XML data as a file, but it just send it out as data.
I do not know how to capture the said xml data from the said given URL. Please Help. Thank You, very, very, very much.
Cheers !
vins
[email protected]public String getXml(String strURL){
URL url = null;
URLConnection conn = null;
BufferedReader in = null;
try{
url = new URL(strURL);
conn = url.openConnection();
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
StringBuffer xml = new StringBuffer();
while ((line = in.readLine()) != null){
xml.append(line);
catch (Exception e){ }
finally { // close th eresource
return xml.toString()
}String xml = getXml("http://www....");
InputSource source = new InputSource(new StringReader(xml));
// use a parse to parse the xml document in the inputsource -
How to read the data from excel file and store into the table?
Hi All,
I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
All the excel fields and my table columns are same.
Can you share with me how can acheive this using LOB's?
ThanksHi OraSuirya,
you can try with external tables .
syntax as follows
create table ext_table_csv (
i Number,
n Varchar2(20),
m Varchar2(20)
organization external (
type oracle_loader
default directory ext_dir
access parameters (
records delimited by newline
fields terminated by ','
missing field values are null
location ('file.csv')
reject limit unlimited;
For this you need to create directory
Directory Creation syntax:
create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
grant read, write on directory ext_dir to <User>;
please paste the excel file in the particular directory .
I hope this will help you.
Please correct me if I am wrong anywhere .
Thanks,
Tippu. -
Hi,
I am tring to read data from a file into my Web Service program. Its a plain text file with item descriptions and price info etc. At the moment I'm trying BufferedReader in = new BufferedReader(...) but I keep getting an exception with Tomcat not being able to locate my file.
Should there be a specific location for files such as this? Or do I need to add a path to a properties or build file? I have tried many different system locations.
I've tried to follow the Sun coffee bean example, but I have found it very complex and would appreciate a clear simple answer.
This is driving me crazy and any help would be much appreciated.
//Daniel.public static void main(String argv[]) {
try {
String filename="absolute path to some file";
BufferedReader in = new BufferedReader(
(Reader)new FileReader(filename)
String line;
while ((line=in.readLine()) != null)
System.out.println(line);
catch (Exception e) {
System.out.println(e.toString()); -
Reading Unicode data from a file...
I am writing an application that needs to read some configuration data from a file. An end user edits the configuration file to provide the configuration data. The Java code reads this file and uses the configuration data supplied by the user.
The user can also save non-ascii characters as part of the configuration data. hence, I do not want to use java properties files. What are the other options available that allow me reading Unicode data into my Java code and will also allow user to save the configuration file as Unicode?Java characters are Unicode characters. Read file data that consists of Unicode characters as Java characters or strings.
You can read the data as primitive char values using the DataInputStream class. The InputStreamReader class can also read Unicode (UTF-16) data.
Data can be written using the OutputStreamWriter class. -
Reading the data from 2 files and writing it into the 3rd file?
Hi,
I am reading datas from 2 files Say,
Example1.txt Example2.txt
Ashok ^data1^data2^data3
Babu ^data1^data2^data3
Chenthil ^data1^data2^data3
Danny ^data1^data2^data3
I want those data's to be written in a 3rd file. Say,
Example3.txt
Ashok^ data1^data2^data3
Babu^ data1^data2^data3
Chenthil^ data1^data2^data3
Danny^ data1^data2^data3
So that i can tokenize it with a delimeter(^) and get the values. Here how to append the datas in this form in Example3.txt. Eventhough u use FileWriter with append "true" as a parameter how they will apend like the Example3.txt file? Please do provide an answer for this..Since this is very urgent to be delivered...Expecting postive response.
Thanx,
JavaCrazyLoverimport java.io.*;
import java.util.*;
public class en
public static void main(String args[]) throws IOException
{int data,data1,offset,offset1;
FileOutputStream fos1=new FileOutputStream("c:/example3.txt");
FileInputStream fis=new FileInputStream("c:/example1.txt");
FileInputStream fis1=new FileInputStream("c:/example2.txt");
while((data=fis.read())!=-1)
fos1.write(data);
while((data=fis1.read())!=-1)
fos1.write(data);
fis.close();
fis1.close();
fos1.close();
}first create those 3 files in c: -
Hello,
I am EXTREMELY new to java programming. I've read a book on learning java and I have no clue how to read in data from an input (text) file.
I'd like to have the user enter a filename at the keyboard. The file will contain data for two fields separated by a blank. I want to read it into an array of a class of objects. Ex. 1 8
3 8
8 49
The first number should go into array.fld1 and the second number should go in array.fld2.
ex. cout <<< please enter your filename
cin >>filename << endl;
i:=0;
while not eof(filename)
read array.fld1;
read array.fld2;
i++;
Can someone help me with this??Simple example
try {
BufferedReader in = new BufferedReader(new FileReader("FileName.txt"));
String str;
while ((str = in.readLine()) != null) {
//do whatever whith str
in.close();
} catch (IOException e) {
//Handle Exception... -
Load XML-data from large file into plain table
We have to load data from an XML file to a relational table row by row.
The structure of the data is very simple:
<ROOT>
<repReport>
<KNZ>XY</KNZ>
<LA>test123</LA>
<Ident>AA20</Ident>
</repReport>
<repReport>
</repReport>
</ROOT>.
The table econtains the fields KNZ, LA, Ident, ...
If the file is small the following PL/SQL-code works fine:
CREATE OR REPLACE PROCEDURE Loadxml_Epd AS
fil BFILE ;
len INTEGER;
insrow INTEGER;
ctxHdl NUMBER;
buffer_c CLOB ;
amt NUMBER := dbms_lob.lobmaxsize;
src_offset NUMBER := 1 ;
dst_offset NUMBER := 1 ;
lang_ctx NUMBER := dbms_lob.default_lang_ctx;
warning NUMBER;
errNo NUMBER;
errMsg VARCHAR2(1999);
BEGIN
fil := BFILENAME('XML_DIR','200412MKBReport.xml');
DBMS_LOB.OPEN(fil, DBMS_LOB.LOB_READONLY);
len := DBMS_LOB.GETLENGTH(fil);
INSERT INTO INIT_CLOB(init) VALUES( EMPTY_CLOB())
RETURNING init INTO buffer_c;
dbms_lob.loadfromfile(buffer_c,fil, amt, dst_offset, src_offset);
ctxHdl := dbms_xmlsave.newContext ('SST_XML_EPD');
dbms_xmlsave.setRowTag (ctxHdl , 'repReport');
dbms_xmlsave.SetIgnoreCase(ctxHdl , 1);
dbms_xmlsave.SetSqlToXmlnameEscaping (ctxHdl , TRUE);
dbms_xmlsave.propagateOriginalException(ctxHdl , TRUE);
dbms_xmlsave.SetCommitBatch(ctxHdl , 1);
dbms_xmlsave.SetBatchSize(ctxHdl , 1);
insrow := DBMS_XMLSAVE.insertXML(ctxHdl,buffer_c);
DBMS_OUTPUT.PUT_LINE('Anzahl Sätze:' || TO_CHAR(insrow,'999999999'));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLCODE);
errMsg := SQLERRM;
DBMS_OUTPUT.PUT_LINE(SUBSTR(errMsg,1,2000));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
END;
But if the file is larger (50 MB in our case) this does not work. In various documents we found that we have to use another sort of XML-parser but we did not find any example how this is really done.
Does anybody have an example how to load this data that is as simple as our problem?We have to load data from an XML file to a relational table row by row.
The structure of the data is very simple:
<ROOT>
<repReport>
<KNZ>XY</KNZ>
<LA>test123</LA>
<Ident>AA20</Ident>
</repReport>
<repReport>
</repReport>
</ROOT>.
The table econtains the fields KNZ, LA, Ident, ...
If the file is small the following PL/SQL-code works fine:
CREATE OR REPLACE PROCEDURE Loadxml_Epd AS
fil BFILE ;
len INTEGER;
insrow INTEGER;
ctxHdl NUMBER;
buffer_c CLOB ;
amt NUMBER := dbms_lob.lobmaxsize;
src_offset NUMBER := 1 ;
dst_offset NUMBER := 1 ;
lang_ctx NUMBER := dbms_lob.default_lang_ctx;
warning NUMBER;
errNo NUMBER;
errMsg VARCHAR2(1999);
BEGIN
fil := BFILENAME('XML_DIR','200412MKBReport.xml');
DBMS_LOB.OPEN(fil, DBMS_LOB.LOB_READONLY);
len := DBMS_LOB.GETLENGTH(fil);
INSERT INTO INIT_CLOB(init) VALUES( EMPTY_CLOB())
RETURNING init INTO buffer_c;
dbms_lob.loadfromfile(buffer_c,fil, amt, dst_offset, src_offset);
ctxHdl := dbms_xmlsave.newContext ('SST_XML_EPD');
dbms_xmlsave.setRowTag (ctxHdl , 'repReport');
dbms_xmlsave.SetIgnoreCase(ctxHdl , 1);
dbms_xmlsave.SetSqlToXmlnameEscaping (ctxHdl , TRUE);
dbms_xmlsave.propagateOriginalException(ctxHdl , TRUE);
dbms_xmlsave.SetCommitBatch(ctxHdl , 1);
dbms_xmlsave.SetBatchSize(ctxHdl , 1);
insrow := DBMS_XMLSAVE.insertXML(ctxHdl,buffer_c);
DBMS_OUTPUT.PUT_LINE('Anzahl Sätze:' || TO_CHAR(insrow,'999999999'));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLCODE);
errMsg := SQLERRM;
DBMS_OUTPUT.PUT_LINE(SUBSTR(errMsg,1,2000));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
END;
But if the file is larger (50 MB in our case) this does not work. In various documents we found that we have to use another sort of XML-parser but we did not find any example how this is really done.
Does anybody have an example how to load this data that is as simple as our problem? -
JAXB: Read XML data from a String?
Hi,
I get XML data not from file but as a string and I wanted to use JAXB to parse it and get my Java Objects.
The unmarshall methods wants an "InputStream", but "StringBufferInputStream" is deprecated, so that I don't know a way to use my String as InputStream.
Can someone give me a hint other then writing the data in a file first?Hi FrankSch,
The unmarshall methods wants an "InputStream", but
"StringBufferInputStream" is deprecated, so that I
don't know a way to use my String as InputStream.
Can someone give me a hint other then writing the data
in a file first?Yes, the class StringBufferInputStream is deprecated, and the deprecation notice reads:
Deprecated. This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class.
The JDK API usually mentions an alternative to the deprecated method/class and in this case, you should use java.io.StringReader. It has one constructor and should suite you nicely:
StringReader(String s) That way, you get an InputStream object; you can now use JAXB.
Hope this helps,
-ike, .si
Maybe you are looking for
-
Hello and thanks in advance, I've read as many threads as possible and done everything I could to get my HP P1505n working again but can't and need some new advice. I've had this printer for a couple of years and it worked well and always connected.
-
Please Help; Windows 7 Home Premium to Professional.
In requirement for an IT class, I installed Windows 7 Professional over my Windows 7 Home Edition installation on my netbook. I have encountered a seriously problem though, as Windows 7 Professional seems to be stuck in Safe Mode and will not let me
-
SQL queries in one statement with derby
Hi, I am using a derby embedded database and i need to create a database at the installation. So i need to create a lot of tables. But it seems like I have to create a statement for each create table query. Is this true? Isn't there a way to execute
-
Oracle Retail Integration - Currency Rate Oracle Object
Defect 13014568 has been created via Defect Workbench iBug portal request id: (3095217). Fix is ready for QA. It is planned to be released in RIB 12.0.11.4 bundle, expected by 31st Jan 2012. In version 12.0.11: The Oracle Object for currency rates Cr
-
How do I unlock an object?
Manage to figure out how to select object and lock it now I cant find how to unlock it, please help?