Constracting an xml book data structure
I have to construct a book data structure storing detalis about a book, which i parse from a file containing the book in XML format.
I've done the parser, but i'm trying to figure out what would be the best Class I could use as a Data Structure to store the book.
I have to store info about the title, the author, chapters, etc etc, as well as the book itself...
Any suggestions would be very appreciated.
Thanx.
P.
If I understand correctly,
you have an xml file that describes a book.
Would it be an option, if you just create an oject Book that has all your necessary fields in it and populate that object with your xml values?
for ex,
class Book
String author;
String title;
String[] chapters;
}
Similar Messages
-
Simple Transformation to deserialize an XML file into ABAP data structures?
I'm attempting to write my first simple transformation to deserialize
an XML file into ABAP data structures and I have a few questions.
My simple transformation contains code like the following
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:pp="http://www.sap.com/abapxml/types/defined" >
<tt:type name="REPORT" line-type="?">
<tt:node name="COMPANY_ID" type="C" length="10" />
<tt:node name="JOB_ID" type="C" length="20" />
<tt:node name="TYPE_CSV" type="C" length="1" />
<tt:node name="TYPE_XLS" type="C" length="1" />
<tt:node name="TYPE_PDF" type="C" length="1" />
<tt:node name="IS_NEW" type="C" length="1" />
</tt:type>
<tt:root name="ROOT2" type="pp:REPORT" />
<QueryResponse>
<tt:loop ref="ROOT2" name="line">
<QueryResponseRow>
<CompanyID>
<tt:value ref="$line.COMPANY_ID" />
</CompanyID>
<JobID>
<tt:value ref="$line.JOB_ID" />
</JobID>
<ExportTypes>
<tt:loop>
<ExportType>
I don't know what to do here (see item 3, below)
</ExportType>
</tt:loop>
</ExportTypes>
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
</QueryResponseRow>
</tt:loop>
</QueryResponse>
</tt:loop>
1. In a DTD, an element can be designated as occurring zero or one
time, zero or more times, or one or more times. How do I write the
simple transformation to accommodate these possibilities?
2. In trying to accommodate the "zero or more times" case, I am trying
to use the <tt:loop> instruction. It occurs several layers deep in the
XML hierarchy, but at the top level of the ABAP table. The internal
table has a structure defined in the ABAP program, not in the data
dictionary. In the simple transformation, I used <tt:type> and
<tt:node> to define the structure of the internal table and then
tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
can occur zero or more times. But every variation I try seems to get
different errors. Can anyone supply a working example of this?
3. Among the fields in the internal table, I've defined three
one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
XML file, I expect zero to three elements of the form
<ExportType exporttype='csv' />
<ExportType exporttype='xls' />
<ExportType exporttype='pdf' />
I want to set field TYPE_CSV = 'X' if I find an ExportType element
with its exporttype attribute set to 'csv'. I want to set field
TYPE_XLS = 'X' if I find an ExportType element with its exporttype
attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
an ExportType element with its exporttype attribute set to 'pdf'. How
can I do that?
4. For an element that has a value like
<ErrorCode>123</ErrorCode>
in the simple transformation, the sequence
<ErrorCode> <tt:value ref="ROOT1.CODE" /> </ErrorCode>
seems to work just fine.
I have other situations where the XML reads
<IsNew value='true' />
I wanted to write
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
but I'm afraid that the <tt:value> fails to deal with the fact that in
the XML file the value is being passed as the value of an attribute
(named "value"), rather than the value of the element itself. How do
you handle this?Try this code below:
data l_xml_table2 type table of xml_line with header line.
W_filename - This is a Path.
if w_filename(02) = '
open dataset w_filename for output in binary mode.
if sy-subrc = 0.
l_xml_table2[] = l_xml_table[].
loop at l_xml_table2.
transfer l_xml_table2 to w_filename.
endloop.
endif.
close dataset w_filename.
else.
call method cl_gui_frontend_services=>gui_download
exporting
bin_filesize = l_xml_size
filename = w_filename
filetype = 'BIN'
changing
data_tab = l_xml_table
exceptions
others = 24.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
Can I automate the creation of a cluster in LabView using the data structure created in an auto generated .CSV, C header, or XML file? I'm trying to take the data structure defined in one or more of those files listed and have LabView automatically create a cluster with identical structure and data types. (Ideally, I would like to do this with a C header file only.) Basically, I'm trying to avoid having to create the cluster by hand, as the number of cluster elements could be very large. I've looked into EasyXML and contacted the rep for the add-on. Unfortunately, this capability has not been created yet. Has anyone done something like this before? Thanks in advance for the help.
Message Edited by PhilipJoeP on 04-29-2009 04:54 PM
Solved!
Go to Solution.smercurio_fc wrote:
Is this something you're trying to do at runtime? Clusters are fixed data structures so you can't change them programmatically. Or, are you just trying to create some typedef cluster controls so that you can use them for coding? What would your clusters basically look like? Perhaps another way of holding the information like an array of variants?
You can try LabVIEW scripting, though be aware that this is not supported by NI.
Wow! Thanks for the quick response! We would use this cluster as a fixed data structure. No need to change the structure during runtime. The cluster would be a cluster of clusters with multiple levels. There would be not pattern as to how deep these levels would go, or how many elements would be in each. Here is the application. I would like to be able to autocode a Simulink model file into a DLL. The model DLL would accept a Simulink bus object of a certain data structure (bus of buses), pick out which elements of the bus is needed for the model calculation, and then pass the bus object. I then will take the DLL file and use the DLL VI block to pass a cluster into the DLL block (with identical structure as the bus in Simulink). To save time, I would like to auto generate the C header file using Simulink to define the bus structure and then have LabView read that header file and create the cluster automatically. Right now I can do everything but the auto creation of the cluster. I can manually build the cluster to match the Simulink model bus structure and it runs fine. But this is only for an example model with a small structure. Need to make the cluster creation automated so it can handle large structures with minimal brute force. Thanks! -
Hello! This is my first time in this discussion group. The question posed is the subject line itself:
What is the smallest data structure record in a .TXT file record to be recognized as an Apple Address Book "Data Card"?
I'm lazy! As a math instructor with 40+ students per class per semester (pCpS), I would rather not have to create 40 data cards pCpS by hand, only to expunge that info at semester's end. My college's IS department can easily supply me with First name, Last name, and eMail address info, along with a myriad of other fields. I can manipulate those data on my end to create the necessary .TXT file, but I don't know the essential structure of that file.
Can you help me?
Thank you in advance.
BillHello Bill, & welcome aboard!
No idea what pCpS is, sorry.
To import a text file into Address Book, it needs to be a comma delimited .csv file, like...
Customer Name,Company,Address1,Address2,City,State,Zip
Customer 1,Company 1,2233 W Seventh Street,Unit 543,Seattle,WA,99099
Customer 2,Company 2,1 Park Avenue,,New York,NY,10001
Customer 3,Company 3,65 Loma Linda Parkway,,San Jose,CA,94321
Customer 4,Company 4,89988 E 23rd Street,B720,Oakland,CA,99899
Customer 5,Company 5,432 1st Avenue,,Seattle,WA,99876
Customer 6,Company 6,76765 NE 92nd Street,,Seattle,WA,98009
Customer 7,Company 7,8976 Poplar Street,,Coupeville,WA,98976
Customer 8,Company 8,7677 4th Ave North,,Seattle,WA ,89876
Customer 9,Company 9,4556 Fauntleroy Avenue,,West Seattle,WA,98987
Customer 10,Company 10,4 Bell Street,,Cincinnati,OH,89987
Customer 11,Company 11,4001 Beacon Ave North,,Seattle,WA,90887
Customer 12,Company 12,63 Dehli Street,,Noida,India,898877-8879
Customer 13,Company 13,63 Dehli Street,,Noida,India,898877-8879
Customer 14,Company 14,63 Dehli Street,,Noida,India,898877-8879
Customer 15,Company 15,4847 Spirit Lake Drive,,Bellevue,WA,98006
Customer 16,Company 16,444 Clark Avenue,,West Seattle,WA,88989
Customer 17,Company 17,6601 E Stallion,,Scottsdale,AZ,85254
Customer 18,Company 18,801 N 34th Street,,Seattle,WA,98103
Customer 19,Company 19,15925 SE 92nd,,Newcastle,WA,99898
Customer 20,Company 20,3335 NW 220th,2nd Floor,Edmonds,WA,99890
Customer 21,Company 21,444 E Greenway,,Scottsdale,AZ,85654
Customer 22,Company 22,4 Railroad Drive,,Moclips,WA,98988
Customer 23,Company 23,89887 E 64th,,Scottsdale,AZ,87877
Customer 24,Company 24,15620 SE 43rd Street,,Bellevue,WA,98006
Customer 25,Company 25,123 Smalltown,,Redmond,WA,98998
Try Address Book Importer...
http://www.sillybit.com/abee/ -
Address book data is XML-encoded in LDAP ?
Hi,
We are trying to find out how address book data is stored in the LDAP, and we've found several different ways apparently. Some format seems to use an XML encoded format (this is when you go in the UWC (JES5) and add a new group and in stead of selecting contacts to add, you just type a name, and an email address).
This is how it looks like in the ldap:
absi@nagios ~/ $ ldapsearch -D "cn=Directory manager" -w Jxxxxxxxxxx -b "o=PiServerDb" -h 192.168.xxx.50 "displayname=test_manueel"
version: 1
dn: piEntryID=e115cc045b373f,piPStoreOwner=adresboekadmin,o=xxxxxxxxxxxxxxt.be
,o=PiServerDb
piEntryID: e115cc045b373f
objectClass: PITYPEGROUP
objectClass: piEntry
objectClass: top
memberOfPIBook: e114db3c213216f6
displayName: test_manueel
pipEntryXMLData:: PG9saT4KIDxHcm91cEV4TWVtYmVyPnRlc3QzJTVFU01UUCU1RXRlc3QzJTQ
wdmxhYW1zcGFybGVtZW50LmJlPC9Hcm91cEV4TWVtYmVyPgogPEdyb3VwRXhNZW1iZXI+a2llcmV
3aWV0JTVFU01UUCU1RWtpZXJld2lldCU0MHZsYWFtc3BhcmxlbWVudC5iZTwvR3JvdXBFeE1lbWJ
lcj4KIDxHcm91cEV4TWVtYmVyPnRlc3Q0NSU1RVNNVFAlNUV0ZXN0NDUlNDBhYnNpLmJlPC9Hcm9
1cEV4TWVtYmVyPgo8L29saT4K
However, I can't find any usable reference to this ldap attribute 'pipEntryXMLData' , except that it's used by JES 2005Q1 onwards
I'm also concerned by the following:
- in case of problems, are there tools to read out / export this XML data in anything that is human readable / parseable ?
- what about scalability, we will be having members with thousands of entries in their addressbook, is this method scalable or will we be experiencing delays when users are looking up contacts in their address books ?
All info on this is more than welcom!
regards,
Tom.The ldapsearch tools are producing LDIF format (RFC 2849) which requires that non ascii values and values with some specific characters be Base64 encoded.
XML is out of these formats that start with a special character with regards to LDIF ('<') and for which values must be base64 encoded.
There are many decoders for base64 encoding.
Alternately, you can use an LDAP API (C or Java) and the value will not be encoded.
Regards,
Ludovic. -
Address book data is XML-encoded ?
Hi,
We are trying to find out how address book data is stored in the LDAP, and we've found several different ways apparently. Some format seems to use an XML encoded format (this is when you go in the UWC (JES5) and add a new group and in stead of selecting contacts to add, you just type a name, and an email address).
This is how it looks like in the ldap:
absi@nagios ~/ $ ldapsearch -D "cn=Directory manager" -w Jxxxxxxxxxx -b "o=PiServerDb" -h 192.168.xxx.50 "displayname=test_manueel"
version: 1
dn: piEntryID=e115cc045b373f,piPStoreOwner=adresboekadmin,o=xxxxxxxxxxxxxxt.be
,o=PiServerDb
piEntryID: e115cc045b373f
objectClass: PITYPEGROUP
objectClass: piEntry
objectClass: top
memberOfPIBook: e114db3c213216f6
displayName: test_manueel
pipEntryXMLData:: PG9saT4KIDxHcm91cEV4TWVtYmVyPnRlc3QzJTVFU01UUCU1RXRlc3QzJTQ
wdmxhYW1zcGFybGVtZW50LmJlPC9Hcm91cEV4TWVtYmVyPgogPEdyb3VwRXhNZW1iZXI+a2llcmV
3aWV0JTVFU01UUCU1RWtpZXJld2lldCU0MHZsYWFtc3BhcmxlbWVudC5iZTwvR3JvdXBFeE1lbWJ
lcj4KIDxHcm91cEV4TWVtYmVyPnRlc3Q0NSU1RVNNVFAlNUV0ZXN0NDUlNDBhYnNpLmJlPC9Hcm9
1cEV4TWVtYmVyPgo8L29saT4K
However, I can't find any usable reference to this ldap attribute 'pipEntryXMLData' , except that it's used by JES 2005Q1 onwards
I'm also concerned by the following:
- in case of problems, are there tools to read out / export this XML data in anything that is human readable / parseable ?
- what about scalability, we will be having members with thousands of entries in their addressbook, is this method scalable or will we be experiencing delays when users are looking up contacts in their address books ?
All info on this is more than welcom!
regards,
Tom.Hi,
tom_absi wrote:
We are trying to find out how address book data is stored in the LDAP, and we've found several different ways apparently. Some format seems to use an XML encoded format (this is when you go in the UWC (JES5) and add a new group and in stead of selecting contacts to add, you just type a name, and an email address).This isn't surprising as there wasn't any pre-existing attribute which could be used to add these values. So it appears they are using an XML 'blob' instead.
This is how it looks like in the ldap:
pipEntryXMLData:: PG9saT4KIDxHcm91cEV4TWVtYmVyPnRlc3QzJTVFU01UUCU1RXRlc3QzJTQ
wdmxhYW1zcGFybGVtZW50LmJlPC9Hcm91cEV4TWVtYmVyPgogPEdyb3VwRXhNZW1iZXI+a2llcmV
3aWV0JTVFU01UUCU1RWtpZXJld2lldCU0MHZsYWFtc3BhcmxlbWVudC5iZTwvR3JvdXBFeE1lbWJ
lcj4KIDxHcm91cEV4TWVtYmVyPnRlc3Q0NSU1RVNNVFAlNUV0ZXN0NDUlNDBhYnNpLmJlPC9Hcm9
1cEV4TWVtYmVyPgo8L29saT4KThis is base64 encoded and decodes as (http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/):
<oli>
<GroupExMember>test3%5ESMTP%5Etest3%40vlaamsparlement.be</GroupExMember>
<GroupExMember>kierewiet%5ESMTP%5Ekierewiet%40vlaamsparlement.be</GroupExMember>
<GroupExMember>test45%5ESMTP%5Etest45%40absi.be</GroupExMember>
</oli> However, I can't find any usable reference to this ldap attribute 'pipEntryXMLData' , except that it's used by JES 2005Q1 onwardsAppears to be a 'private' attribute. Although you can access the data because it is stored in an LDAP server I don't believe it is a public interface so it is bound to change.
I'm also concerned by the following:
- in case of problems, are there tools to read out / export this XML data in anything that is human readable / parseable ?The base64 decoded version seems parseable to me?
- what about scalability, we will be having members with thousands of entries in their addressbook, is this method scalable or will we be experiencing delays when users are looking up contacts in their address books ?Assuming you have a sufficiently scoped/tuned directory server I don't see there is going to be a problem.
Regards,
Shane. -
Data Structures and Algorithms in java book
Hi guys,
I want to know a good book which is good for Data Structures and Algorithms in java. I am good at Core java but a beginner for Data Structures in Java. I am a little poor in Data Structures concepts.
Following are the books I have found on the net. Could you help me the choose the best outta them.
1. Data Structures and Algorithms in Java - Mitchell Waite
2. Data Structures in Java - Sandra Anderson
3. Fundamentals of OOP and Data Structures in Java - Richard Weiner & Lewis J. Pinson
4. Object Oriented Data Structures Using Java - Nell Dale, Daniel T. Joyce, Chip Weemslieni wrote:
I good data structures book doesn't have to be language-specific.Thx DrLazlo, my speachYes.
The OP wrote:
I have access to these books and dont know which one to start with.What I meant is that you shouldn't narrow your search to insist that the book you choose have "Java" in the title. -
Hi all, I'm looking for a Data Structures and Algorithmitmics book in Java with the answers to many of the exercises.
Any idea?
ThanksHi all, I'm looking for a Data Structures and Algorithmitmics
book in Java with the answers to many of the exercises."Data Structures and Algorithmitmics book in Java " seems like a pretty generic name. Who is the author?
If the book is used for a university course, the publisher may only sell the answer book to authorized clients, e.g. the university bookstore. So you would have to ask them, but then they will ask if the request is on behalf of the professor. If you said you were a graduate student and a TA for the course, and on request from the professor you are asking to place an order, and to email/call you to pick it up for the professor then you might be able to get a copy. Or you could ask the professor for a letter and explain to him that you really need a copy of the answers. However, if the questions in the book are used as part of the grading questions, there is very little chance.
You could also try searching online, or ask the TA for help. In my experience, TAs have 1 or 2 hours a week where anyone can drop in and ask questions. Take advantage of that.
then you might be a -
How to add doctype when generating XML from an arbitrary data structure
I was reading SUN's tutorial "Working with XML - PART IV: Using XSLT". Inside this tutorial, in 3, it talks about how to generate XML from an arbitrary data structure making use of a XMLReader and a Transformer. The example only shows adding elements. Is there a way to add DTD information in the XML generated, i.e. <!DOCTYPE ... >? What APIs can I use?
Thanks,
AlexThe simplest way seems to me is to use a XSL file for that. The <xsl:output> attributes doctype-system and doctype-public generate the DTD declaration <!DOCTYPE YOUR_ROOT SYSTEM "yourDTDfile.dtd"> and <!DOCTYPE YOUR_ROOT PUBLIC "yourDTDfile.dtd">, respectively.
When calling transformerInstance.transform() the XSLT processor performs the identity transformation - it just copies elements, attributes, content, processing instructions and comments to the result stream.
If you're using an xsl file for your transformation already, simply add <xsl:output doctype-system="yourDTDfile.dtd"/> to your existing XSL file.
If you're only using the identity transformation you'd need to change the line of code where you obtain the transformer instance from the TransformerFactory to:
t_factory.newTransformer(new StreamSource("test.xsl"));
and use this as test.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="yourDTDfile.dtd"/>
<!-- this is the identity transformation -->
<xsl:template match="*|@*|comment()|processing-instruction()|text()">
<xsl:copy>
<xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>Good luck. -
OC4J: marshalling does not recreate the same data structure onthe client
Hi guys,
I am trying to use OC4J as an EJB container and have come across the following problem, which looks like a bug.
I have a value object method that returns an instance of ArrayList with references to other value objects of the same class. The value objects have references to other value objects. When this structure is marshalled across the network, we expect it to be recreated as is but that does not happen and instead objects get duplicated.
Suppose we have 2 value objects: ValueObject1 and ValueObject2. ValueObject1 references ValueObject2 via its private field and the ValueObject2 references ValueObject1. Both value objects are returned by our method in an ArrayList structure. Here is how it will look like (number after @ represents an address in memory):
Object[0] = com.cramer.test.SomeVO@1
Object[0].getValueObject[0] = com.cramer.test.SomeVO@2
Object[1] = com.cramer.test.SomeVO@2
Object[1].getValueObject[0] = com.cramer.test.SomeVO@1
We would expect to see the same (except exact addresses) after marshalling. Here is what we get instead:
Object[0] = com.cramer.test.SomeVO@1
Object[0].getValueObject[0] = com.cramer.test.SomeVO@2
Object[1] = com.cramer.test.SomeVO@3
Object[1].getValueObject[0] = com.cramer.test.SomeVO@4
It can be seen that objects get unnecessarily duplicated â“ the instance of the ValueObject1 referenced by the ValueObject2 is not the same now as the instance that is referenced by the ArrayList instance.
This does not only break referential integrity, structure and consistency of the data but dramatically increases the amount of information sent across the network. The problem was discovered when we found that a relatively small but complicated structure that gets serialized into a 142kb file requires about 20Mb of network communication. All this extra info is duplicated object instances.
I have created a small test case to demonstrate the problem and let you reproduce it.
Here is RMITestBean.java:
package com.cramer.test;
import javax.ejb.EJBObject;
import java.util.*;
public interface RMITestBean extends EJBObject
public ArrayList getSomeData(int testSize) throws java.rmi.RemoteException;
public byte[] getSomeDataInBytes(int testSize) throws java.rmi.RemoteException;
Here is RMITestBeanBean.java:
package com.cramer.test;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.util.*;
public class RMITestBeanBean implements SessionBean
private SessionContext context;
SomeVO someVO;
public void ejbCreate()
someVO = new SomeVO(0);
public void ejbActivate()
public void ejbPassivate()
public void ejbRemove()
public void setSessionContext(SessionContext ctx)
this.context = ctx;
public byte[] getSomeDataInBytes(int testSize)
ArrayList someData = getSomeData(testSize);
try {
java.io.ByteArrayOutputStream byteOutputStream = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream objectOutputStream = new java.io.ObjectOutputStream(byteOutputStream);
objectOutputStream.writeObject(someData);
objectOutputStream.flush();
System.out.println(" serialised output size: "+byteOutputStream.size());
byte[] bytes = byteOutputStream.toByteArray();
objectOutputStream.close();
byteOutputStream.close();
return bytes;
} catch (Exception e) {
System.out.println("Serialisation failed: "+e.getMessage());
return null;
public ArrayList getSomeData(int testSize)
// Create array of objects
ArrayList someData = new ArrayList();
for (int i=0; i<testSize; i++)
someData.add(new SomeVO(i));
// Interlink all the objects
for (int i=0; i<someData.size()-1; i++)
for (int j=i+1; j<someData.size(); j++)
((SomeVO)someData.get(i)).addValueObject((SomeVO)someData.get(j));
((SomeVO)someData.get(j)).addValueObject((SomeVO)someData.get(i));
// print out the data structure
System.out.println("Data:");
for (int i = 0; i<someData.size(); i++)
SomeVO tmp = (SomeVO)someData.get(i);
System.out.println("Object["+Integer.toString(i)+"] = "+tmp);
System.out.println("Object["+Integer.toString(i)+"]'s some number = "+tmp.getSomeNumber());
for (int j = 0; j<tmp.getValueObjectCount(); j++)
SomeVO tmp2 = tmp.getValueObject(j);
System.out.println(" getValueObject["+Integer.toString(j)+"] = "+tmp2);
System.out.println(" getValueObject["+Integer.toString(j)+"]'s some number = "+tmp2.getSomeNumber());
// Check the serialised size of the structure
try {
java.io.ByteArrayOutputStream byteOutputStream = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream objectOutputStream = new java.io.ObjectOutputStream(byteOutputStream);
objectOutputStream.writeObject(someData);
objectOutputStream.flush();
System.out.println("Serialised output size: "+byteOutputStream.size());
objectOutputStream.close();
byteOutputStream.close();
} catch (Exception e) {
System.out.println("Serialisation failed: "+e.getMessage());
return someData;
Here is RMITestBeanHome:
package com.cramer.test;
import javax.ejb.EJBHome;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
public interface RMITestBeanHome extends EJBHome
RMITestBean create() throws RemoteException, CreateException;
Here is ejb-jar.xml:
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<description>Session Bean ( Stateful )</description>
<display-name>RMITestBean</display-name>
<ejb-name>RMITestBean</ejb-name>
<home>com.cramer.test.RMITestBeanHome</home>
<remote>com.cramer.test.RMITestBean</remote>
<ejb-class>com.cramer.test.RMITestBeanBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
And finally the application that tests the bean:
package com.cramer.test;
import java.util.*;
import javax.rmi.*;
import javax.naming.*;
public class RMITestApplication
final static boolean HARDCODE_SERIALISATION = false;
final static int TEST_SIZE = 2;
public static void main(String[] args)
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
props.put(Context.PROVIDER_URL, "ormi://lil8m:23792/alexei");
props.put(Context.SECURITY_PRINCIPAL, "admin");
props.put(Context.SECURITY_CREDENTIALS, "admin");
try {
// Get the JNDI initial context
InitialContext ctx = new InitialContext(props);
NamingEnumeration list = ctx.list("comp/env/ejb");
// Get a reference to the Home Object which we use to create the EJB Object
Object objJNDI = ctx.lookup("comp/env/ejb/RMITestBean");
// Now cast it to an InventoryHome object
RMITestBeanHome testBeanHome = (RMITestBeanHome)PortableRemoteObject.narrow(objJNDI,RMITestBeanHome.class);
// Create the Inventory remote interface
RMITestBean testBean = testBeanHome.create();
ArrayList someData = null;
if (!HARDCODE_SERIALISATION)
// ############################### Alternative 1 ##############################
// ## This relies on marshalling serialisation ##
someData = testBean.getSomeData(TEST_SIZE);
// ############################ End of Alternative 1 ##########################
} else
// ############################### Alternative 2 ##############################
// ## This gets a serialised byte stream and de-serialises it ##
byte[] bytes = testBean.getSomeDataInBytes(TEST_SIZE);
try {
java.io.ByteArrayInputStream byteInputStream = new java.io.ByteArrayInputStream(bytes);
java.io.ObjectInputStream objectInputStream = new java.io.ObjectInputStream(byteInputStream);
someData = (ArrayList)objectInputStream.readObject();
objectInputStream.close();
byteInputStream.close();
} catch (Exception e) {
System.out.println("Serialisation failed: "+e.getMessage());
// ############################ End of Alternative 2 ##########################
// Print out the data structure
System.out.println("Data:");
for (int i = 0; i<someData.size(); i++)
SomeVO tmp = (SomeVO)someData.get(i);
System.out.println("Object["+Integer.toString(i)+"] = "+tmp);
System.out.println("Object["+Integer.toString(i)+"]'s some number = "+tmp.getSomeNumber());
for (int j = 0; j<tmp.getValueObjectCount(); j++)
SomeVO tmp2 = tmp.getValueObject(j);
System.out.println(" getValueObject["+Integer.toString(j)+"] = "+tmp2);
System.out.println(" getValueObject["+Integer.toString(j)+"]'s some number = "+tmp2.getSomeNumber());
// Print out the size of the serialised structure
try {
java.io.ByteArrayOutputStream byteOutputStream = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream objectOutputStream = new java.io.ObjectOutputStream(byteOutputStream);
objectOutputStream.writeObject(someData);
objectOutputStream.flush();
System.out.println("Serialised output size: "+byteOutputStream.size());
objectOutputStream.close();
byteOutputStream.close();
} catch (Exception e) {
System.out.println("Serialisation failed: "+e.getMessage());
catch(Exception ex){
ex.printStackTrace(System.out);
The parameters you might be interested in playing with are HARDCODE_SERIALISATION and TEST_SIZE defined at the beginning of RMITestApplication.java. The HARDCODE_SERIALISATION is a flag that specifies whether Java serialisation should be used to pass the data across or we should rely on OC4J marshalling. TEST_SIZE defines the size of the object graph and the ArrayList structure. The bigger this size is the more dramatic effect you get from data duplication.
The test case outputs the structure both on the server and on the client and prints out the size of the serialised structure. That gives us sufficient comparison, as both structure and its size should be the same on the client and on the server.
The test case also demonstrates that the problem is specific to OC4J. The standard Java serialisation does not suffer the same flaw. However using the standard serialisation the way I did in the test case code is generally unacceptable as it breaks the transparency benefit and complicates interfaces.
To run the test case:
1) Modify provider URL parameter value on line 15 of the RMITestApplication.java for your environment.
2) Deploy the bean to the server.
4) Run RMITestApplication on a client PC.
5) Compare the outputs on the server and on the client.
I hope someone can reproduce the problem and give their opinion, and possibly point to the solution if there is one at the moment.
Cheers,
AlexeiHi,
Eugene, wrong end user recovery. Alexey is referring to client desktop end user recovery which is entirely different.
Alexy - As noted in the previous post:
http://social.technet.microsoft.com/Forums/en-US/bc67c597-4379-4a8d-a5e0-cd4b26c85d91/dpm-2012-still-requires-put-end-users-into-local-admin-groups-for-the-purpose-of-end-user-data?forum=dataprotectionmanager
Each recovery point has users permisions tied to it, so it's not possible to retroacively give the users permissions. Implement the below and going forward all users can restore their own files.
This is a hands off solution to allow all users that use a machine to be able to restore their own files.
1) Make these two cmd files and save them in c:\temp
2) Using windows scheduler – schedule addperms.cmd to run daily – any new users that log onto the machine will automatically be able to restore their own files.
<addperms.cmd>
Cmd.exe /v /c c:\temp\addreg.cmd
<addreg.cmd>
set users=
echo Windows Registry Editor Version 5.00>c:\temp\perms.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Data Protection Manager\Agent\ClientProtection]>>c:\temp\perms.reg
FOR /F "Tokens=*" %%n IN ('dir c:\users\*. /b') do set users=!users!%Userdomain%\\%%n,
echo "ClientOwners"=^"%users%%Userdomain%\\bogususer^">>c:\temp\perms.reg
REG IMPORT c:\temp\perms.reg
Del c:\temp\perms.reg
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights. -
XML IDOC data (hosted on a web server) & handling multiple WSDLs
Hi ALL,
1)how to design an Interface for picking up an XML IDOC data (hosted on a web server) which will be uploaded to SAP or converted to a file
this is what the customer has given me ..can any one explain me this and help me how to more forward
2).This Interface must use UDDI concept because we are going to use multiple BAPIs /RFCs as WSDLs
what is this mean can any send me some document on this
3).Use web-service navigator concept as we will be handling multiple WSDLs
i worked on 1. to define a place holder in WebAS for holding the
wsdls.
2. publish the wsdls in WebAS UDDI Repostory
but i have never used web-service navigator concept as we will be handling multiple WSDLs what is the difference ..send me some step by step docs ..
thanks very much
RK..1.I am not clear with the requirement too. THere is no big deal in sending XML to IDOC or File. Based on your requirement you have to import IDOC structure or ify ou are using file, create a structure for the file.
If u are asking about sendin the XML directly without mapping, even you can do that without MM and even IM.
Please be more elaborate and if you are not clear with what client said, paraphrase them or ask again. Its not good to start work unless we are very clear with the requirement.
you can say to my understanding i feel this, now pI will send data like this. Is it correct?
2. More information on UDDI
http://en.wikipedia.org/wiki/UDDI
I dont think you need to worry much about this now with many features provided in ESR especially
3. http://<Host>:<port>/wsnavigator/
The webservices going out of PI are published here.
provide host and port are host and port details of ext system.
Once you enter link in your browser, it shows the available webservices hosted there.
All you need is to click on the required wsdl and test it.
It is as good as sending your data from PI to other system.
It is similar to Altova XML spy but the difference here is you enter the values directly here but in XML spy we send XML . -
Help with XML, display data on swipe/click
Hello.
I am trying to create a moibile app that displays XML data. It's basically a phone book. I want the data to change when swiped. I can get the data in just fine. I can get it to display fine. I am not seeing the correct image first, however. I think it's a problem with my imagenum variable.
Then, I want to change what is displayed when the user clicks/swipes on the screen. How do I do that?
stop();
var nameArray:Array = new Array();
var countryArray:Array = new Array();
var portraitArray:Array = new Array();
var flagArray:Array = new Array();
var jobtitleArray:Array = new Array();
var imageNum:Number=0;
var totalImages:Number;
//Load XML
var XMLURLLoader:URLLoader = new URLLoader();
XMLURLLoader.load(new URLRequest("recbook.xml"));
XMLURLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(event:Event):void {
var theXMLData:XML = new XML(XMLURLLoader.data);
totalImages=theXMLData.name.length();
for (var i:Number =0; i < totalImages; i++){
//push xml data into the arrays
nameArray.push(theXMLData.name[i]);
countryArray.push(theXMLData.country[i]);
portraitArray.push(theXMLData.portrait[i]);
flagArray.push(theXMLData.flag[i]);
jobtitleArray.push(theXMLData.jobtitle[i]);
//data is processed
loadData();
function loadData():void {
var thisPortrait:String = portraitArray[imageNum];
var thisCountry:String = countryArray[imageNum];
var thisName:String = nameArray[imageNum];
var thisJobtitle:String = jobtitleArray[imageNum];
var thisFlag:String = flagArray[imageNum];
var dataLoader:Loader = new Loader();
dataLoader.load(new URLRequest(portraitArray[imageNum]));
dataLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dataLoaded);
function dataLoaded(event:Event):void {
//I want to start with image 0 (img1.jpg) and cycle through with a mouse click (finger swipe on iOS)
stage.addEventListener(MouseEvent.CLICK, loadMainImage1);
function loadMainImage1(event:MouseEvent):void {
portraitUILoader.source=thisPortrait;
flagUILoader.source=thisFlag;
selectedName.text=thisName;
selectedCountry.text=thisCountry;
selectedJobtitle.text=thisJobtitle;
//add to imageNum (1);
imageNum++;
if (imageNum < totalImages) {//stopping at img2
trace("imageNum " + imageNum);
trace("image name (thisPortrait) " + thisPortrait);//losing image 4 somewhere
loadData();
trace("Total Images " + totalImages);
//click to move past the home screenI'd like to ditch this. don't know how.
homeScreen_mc.addEventListener(MouseEvent.CLICK, goNext);
function goNext(event:MouseEvent):void
nextFrame();
*/here's the output:
imageNum 1
image name (thisPortrait) images/img1.jpg
imageNum 2
image name (thisPortrait) images/img2.jpg
imageNum 3
image name (thisPortrait) images/img3.jpg
Total Images 4
Total Images 4
Total Images 4
Total Images 4
It starts the display on image 1 (the second in the series img2.jpg)*/Thank you.
That helped. I get the correct images in the output, but not in the display. I also get the following error. Any chance you could help with that?
new output after moving the increment:
imageNum 0
image name (thisPortrait) images/img1.jpg
imageNum 1
image name (thisPortrait) images/img2.jpg
imageNum 2
image name (thisPortrait) images/img3.jpg
imageNum 3
image name (thisPortrait) images/img4.jpg
TypeError: Error #2007: Parameter url must be non-null.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at iOS_fla::MainTimeline/loadData()
at iOS_fla::MainTimeline/loadData()
at iOS_fla::MainTimeline/loadData()
at iOS_fla::MainTimeline/loadData()
at iOS_fla::MainTimeline/loadData()
at iOS_fla::MainTimeline/processXML()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete() -
I have created the record in BizTalk schema but i will give to Data Structure Type as reference For eg:Recordname(Reference) instead of recordname(Complex type).
Please help me to sort this out
You can add a reference to an existing type only.
You might have to manually edit the XSD file to change the xmlns definiton to xmlns:tns and then after you define the record type, set the datatype to tns:.... this creates the XML Type. Then later in your schema you can instantiate this with a name and
then set type to tns:.... (Reference)
Regards. -
Looking for suitable and robust data structure?
I have an application where i have to give user an option to correlate the
response returned by a method call with other methods arguments.
I have provided a jtree struture where user can see methods and their
responses and can correlate them by selecting appropriate arguments
where these values could be used.
I used a data structure to store such relations like
A hashmap where every key is a unique number representing method number
and value ia a matrix.
In each matrix, the first element of every row would be the Response object and
all remaining elments in the row would be Argument objects. :)
Now maybe someone would ask, for every method there is always only one return type
then why such a matrix with Reponse object as first element of each row.
The reason is that i gave user an option to not only relate response as a whole Object to
different arguments of different methods but user can select a field of this response object if this
is a complex type or user can select any element if the response is a Collection object to relate
with arguments.
I am not sure whether this structure is more appropriate or i can use more robust
and memory efficient structure.
Please give me your useful suggestions.J2EER wrote:
I have an application where i have to give user an option to correlate the
response returned by a method call with other methods arguments.I really don't understand you.
I have provided a jtree struture where user can see methods and their
responses and can correlate them by selecting appropriate arguments
where these values could be used.Huh?
I used a data structure to store such relations likeErr, what happened to the rest of your sentence? Or is the next part the rest of it?
A hashmap where every key is a unique number representing method number
and value ia a matrix.Where does this matrix come from? In my book, a matrix is a 2 dimensional structure. What do you mean by it?
In each matrix, the first element of every row would be the Response object and
all remaining elments in the row would be Argument objects. :)
Now maybe someone would ask, for every method there is always only one return type
then why such a matrix with Reponse object as first element of each row.You're still talking about methods? If so, don't all methods have just one return type?
The reason is that i gave user an option to not only relate response as a whole Object to
different arguments of different methods but user can select a field of this response object if this
is a complex type or user can select any element if the response is a Collection object to relate
with arguments.
I am not sure whether this structure is more appropriate or i can use more robust
and memory efficient structure.
Please give me your useful suggestions.Perhaps you could give a more detailed explanation and more importantly, provide some examples of what you mean. -
Use XML as data input for Crystal Report for Eclipse
Hi,
I am completely new to crystal report and please kindly forgive me if I ask some stupid questions.
Actually, I have searched the forum for the topic and found some related threads, but I still want to
have some responses from crystal report experts on this issue.
Our developer tool is IBM RAD 7.0 and it has crystal reports tools installed in it. I want to use
crystal report to solve one of our business solutions. I have the following questions about the
feasbility of this solution:
(1). I need to specify data at runtime during report generation. I think using fixed data source
(for example, SQL query or Stored Procedure) may not fit our needs. I think if crystal report
can accept XML as input to generate reports at runtime, then it will be perfect. Can CR
use XML as data source as input?
(2). Actually, one of our business requirements is to generate a letter. Can CR do a report
layout such that a letter format can be achieved? If yes, would you let me know the
report layout name?
(3). We need to export the report into PDF format, I know CR can do PDF output. But can
CR be controlled to export this into bytes stream? Or the PDF must be saved into a
physical file?
(4) If I need to learn more about CR, which book will you recommend?
Thanks in advance for your advice,
RaymondThanks for the help Ted
Works like a charm now.
Or atleast my very very simple XML report works.
Now I just need to play around and see what I can do and what I cant.
I just want to make sure I understand how this works.
1) I start of with a XML file (or URL or other data source as explained in your BLOG)
2) I then have to create blank report which will have its data source set to my XML file.
This report (rpt file) will always have its data source set to the original XML location
Can this be dynamically changed, or does a new rpt file need to be created each time
(or atleast I will have to re-run "CreateXMLInlineSchemaReport" from your BLOG)
3) I can now use this rpt file as I would any other rpt file but its data source will be the original XML file
- If I update or change the XML file, the report will dynamically reflect these changes.
4) To change the data source, I need to recreate a new rpt file as per point 2. Which will now be blank.
5) Filtering.... if I want to filter the XML data do I use normal parameters. If I want to filter the data before
I pull it do I need to change anything. In otherwords if I have a XML file with 1000 records, but I only want say
5 of them, how do I only pull those 5 without first pulling the whole 1000 records. Hope that makes sense.
As I said I am very new to this so some things still fly over my head, but I do play around abit so hopefully
will find what I am looking for.
Cheers
Darren
PS any other links to info on creating and running reports of XML data sources would be greatly appriciated
Maybe you are looking for
-
Possible bug in flash player 9 with video..somewhat urgent help
Hi, I was making a site based on heavy use of video. The site was working just fine, the videos played well, actionscript ok, etc. Last night I upgraded my flash player, and suddenly the site looks completely broken. Videos now have large pixels and
-
I bought a VGA connector to watch TV shows we missed from ABC.com. Works fine for photos and Utube videos so the connection is good. But when I try a TV show or a video from Itune I get just a black screen. Tried on both our large Samsung LCD and sma
-
WEC7 DHCP Allocator not sending ACK for a DHCP client
Hi All, I have a WEC7 device configured as DHCP Allocator. My PC (windows 7) will get ip from DHCP allocator successfully. WEC7 ip settings: ip: 169.254.0.1 subnet: 255.255.0.0 DNS: 0.0.0.0 My PC Ip after got ip from WEC7 DHCP Allocator: ip : 169.254
-
I have deleted the thumbnails and now all I have are icon thumbnails. (.jpg) Help? Thanks!!
-
Hello Everyone, I cannot find any clear documentation on this. We have Windows 7 Machines connecting to Windows Server 2012 R2 Shares with redirected Desktop/Documents/Pictures shares with Offline Files enabled on a LAN. Do we need to schedule a syn