DTD Creation using Java from XMLSchema
Dear Friends
Can anybody solve my problem.See friends i have the Schema With the help of that schema i want to create DTD Using Java .If u peoples have any solution please forward me sample code or tell me where i can get the information.
your best bet is open up a String object and create dtd according to schema,u probably have to hard code allots....or post your schema here...
Similar Messages
-
Reg: adding DTD declaration using java
Dear All,
I want to add the document type declaration definition to xml file using java.
I am using ,
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "test.dtd");But it refers the specified dtd file....Can i add dtd definition directly....The dtd are as,
<!DOCTYPE test [
<!ATTLIST person nick ID #IMPLIED>
]>Is it any method to add the above...
Thanks,
Karthik.VIf you invoke the print method on the top-level ELEMENT, you get
just the body of the document with no DTD or XMLDecl. if you invoke
print on the top level NODE (the DOCUMENT node), then the output
document will contain the XMLDecl and DTD.
So please try to print from DOCUMENT node. -
Need Sample Code for Vendor creation using JAVA API
Hi,
I have a scenario like Vendor creation using <b>Java API</b>.
1.I have Vendors (Main) Table.
2.I have <b>look up</b> tables like Account Group.
3.Also <b>Qualifier table</b>(Phone numbers) too.
Could you please give me the sample code which helps me to create Vendor records using Java API?
<b>I need Code samples which should cover all of the above scenario.</b>
<b>Marks will be given for the relevent answers.</b>
Best Regards
PK DevarajHi Devraj,
I hope the below code might solve all your problem:-
//Adding Qualified field
//Creating empty record in Qualifed table
//Adding No Qualifiers
Record qualified_record = RecordFactory.createEmptyRecord(new TableId(<TableId>));
try {
qualified_record.setFieldValue(new FieldId(<fieldId of NoQualifier), new StringValue(<StringValue>));//Adding No Qualifier
catch (IllegalArgumentException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
catch (MdmValueTypeException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
//Creating Record in Qualified table
CreateRecordCommand create_command = new CreateRecordCommand(connections);
create_command.setSession(sessionId);
create_command.setRecord(qualified_record);
try
create_command.execute();
catch(Exception e)
System.out.println(e.toString());
RecordId record_id = create_command.getRecord().getId();
//Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
QualifiedLookupValue lookup_value = new QualifiedLookupValue();
int link = lookup_value.createQualifiedLink(new QualifiedLinkValue(record_id));
//Adding Yes Qualifiers
lookup_value.setQualifierFieldValue(0 , new FieldId(<FieldID of Yes Qualifier>) , new StringValue(<StringValue>));
//Now adding LookUP values
//Fetch the RecordID of the value selected by user using the following function
public RecordId getRecordID(ConnectionPool connections , String sessionID , String value , String Fieldid , String tableid)
ResultDefinition rsd = new ResultDefinition(new TableId(tableid));
rsd.addSelectField(new FieldId(Fieldid));
StringValue [] val = new StringValue[1];
val[0] = new StringValue(value);
RetrieveRecordsByValueCommand val_command = new RetrieveRecordsByValueCommand(connections);
val_command.setSession(sessionID);
val_command.setResultDefinition(rsd);
val_command.setFieldId(new FieldId(Fieldid));
val_command.setFieldValues(val);
try
val_command.execute();
catch(Exception e)
RecordResultSet result_set = val_command.getRecords();
RecordId id = null;
if(result_set.getCount()>0)
for(int i = 0 ; i < result_set.getCount() ; i++)
id = result_set.getRecord(i).getId();
return id;
//Finally creating the record in Main table
com.sap.mdm.data.Record empty_record = RecordFactory.createEmptyRecord(new TableId("T1"));
try {
empty_record.setFieldValue(new FieldId(<FieldId of text field in Main table>),new StringValue(<StringValue>));
empty_record.setFieldValue(new FieldId(<FieldId of lookup field in Main table>), new LookupValue(<RecordID of the value retrieved using the above getRecordID function>));
empty_record.setFieldValue(new FieldId(<FieldId of Qualified field in Main table>), new QualifiedLookupValue(<lookup_value>));//QualifiedLookUp value Retrieved above
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (MdmValueTypeException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
//Actually creating the record in Main table
CreateRecordCommand create_main_command = new CreateRecordCommand(connections);
create_main_command.setSession(sessionId);
create_main_command.setRecord(empty_record);
try
create_main_command.execute();
catch(Exception e)
System.out.println(e.toString());
Thanks
Namrata -
Access database using Java from HTML webpage
Hi,
I've got to create some online maths tests to be taken by students with their marks being stored in a database.
I've wrote some simple java code which can add/remove and modify entries in a test mySQL database that I made. What I now need to do is be able to add entries to the database from a html page.
The math tests will be java applets with the students having to interact according to questions, press submit and their score will be output. The score will then be entered into the database.
The problem I'm having is that with an Applet their are all sorts of security issues (I'm having problems getting images to load in an Applet) so assume I'll face the same security issues when I try to access a database through an applet.
So, could someone please help get started.
CheersMVC - I assume you mean model-view-control and not Marvel vs Capcom :)
If so then does this mean I should completely seperate the user interface (the actual applets that will contain the test), the database (that will store the results) and the link between the two?
is it possible to acheive this using Java, Java Applets, Java Script and the database (in my case mySQL) and could you give me some tips on how best to tackle the problem.
Thanks -
Can I send email using Java from my localhost(Tomcat) with Internet connect
Hi friends,
Please tell me can I send email from my localhost (Tomcat) using Java when my computer is connected to Internet?
I don't have any SMTP username or password or the like, as I found in some codes available in net.
Please suggest and any simple code if possible.
Please don't send me the link of JavaMail API to read.
---SujoyThank you for the link. Though I have not tested the provided code, I will test it.
--Sujoy -
Using java from command prompt
Hi, I have used command prompts for a long time, though not recently. But this has never happenned to me, and I may have been using a different OS the last time I really used a command prompt. I am currently running Windows XP.
Anyways, when I try to simply change a directory, you know cd "filename", it tells me:
Parameter format not correct - "filename"
Basically, it won't accept any strings as a parameter. I'm really surprised at this. Is this normal? In any case, I got around this by using the short names for files. For example, I used the name docume~1 instead of "documents and settings".
Then, when I got to the folder where my java files were stored, it told me it was an invalid directory but nonetheless allowed me to use it. However, no commands worked except for cd..
Java did not work, nor did basic commands like dir or help. Do you have any idea what is wrong with my command prompt? I know this is not specifically a question about Java, but I can't use Java without this.
thanks.Basically, it won't accept any strings as a parameter.
I got around this by using the short names for files. For example, I
used the name docume~1 instead of "documents and settings".So it is accepting some strings.
Check that you are using cmd.exe not command.com. Ie, from
Start->Run... typecmdAnd not command.
Try the javac command and if the computer says'javac' is not recognized as an internal or external command,
operable program or batch file.then will have to set your OS path (not CLASSPATH - do not set
CLASSPATH at any time or the command prompt will likely never work
again).
Instructions for setting the OS path are [urlhttp://java.sun.com/j2se/1.5.0/install-windows.html]here. Scroll down to
point number 5 -
Decompressing Data using Java from ZLIB
hello all i really need your aid .
we have a system that needs to be changed as soon as possible
to receive a compress stream of data that was compressed using the
ZLIB (a.k.a. gzip) from the http://www.zlib.net/
and i can't manage to Decompress it
i tried to use the
1) java.util.zip.GZIPInputStream
2) java.util.zip.Inflater
3)com.jcraft.jzlib.ZInputStream
all failed...
does anybody can help me with ideas...have you tried with
new InflaterInputStream(anInputStream, new Inflater(false));If it doesnt work, do you have a sample of the data you try to decompress? -
How can I decode Japanese character using java from JavaScript escape() function
Hi:
I have an application which supports Japanese character. I am using JavaScript escape() function to encode the text field before I posted it through web server and then I will just convert it into hex number to decode it through an Integer. It works fine for the character between ascii 1-255. However, it faild on all the double bytes character. All the unicode has the format of "%uXXXX" after it is escaped from JavaScript. How can I resolve the decoding problem?
Thank,
DavidPlease use 'encodeURI()', though it is supported only IE after 5.5.
I'm not sure Netscape.
Thanks,
Katsumi
dwang <[email protected]> wrote:
Hi:
I have an application which supports Japanese character. I am using JavaScript
escape() function to encode the text field before I posted it through
web server and then I will just convert it into hex number to decode
it through an Integer. It works fine for the character between ascii
1-255. However, it faild on all the double bytes character. All the
unicode has the format of "%uXXXX" after it is escaped from JavaScript.
How can I resolve the decoding problem?
Thank,
David -
Adding a listener to Active directory for user creation using Java
Hi,
I would like to add a listener to active directory such that when a user is created to the "Users" container, I should be notified or informed. I would like to do this with Java. What should I do ?
Regards,
Anand Kumar DYou should add a NamingListener or a NamespaceChangedListener.
-
Ftping an exe using Java from Windows to Unix
Hi would like to know an ftp code so that I can transfer exe files, wvm files from my unix server to my windows machine.
Thanks
DebasishHi would like to know an ftp code so that I can
transfer exe files, wvm files from my unix server to
my windows machine.
You do know of course that an exe file will not run on unix?
Other than that you MUST have a ftp server on one machine and a ftp client on the other. Unix machines almost always have ftp servers - there is no point in writing code to do that.
Some versions of windows also have ftp servers.
You can download clients and servers as well. So no point in writing code for either.
But if you insist then search for jakarta on the apache site. The commons net package has FTP code. -
Need auto PR creation using ME51n from excel file
Hi experts,
I have a requirement for above mentioned subject line
I have gone through BAPI_PR_CREATE fm .
need to test the fm successfully, so that i can do the programming.
so could you tell me what are fields,i need to take to create a PR successfully.
if you have any sample code or doc please do share.
Thank you all.Remember the values in extensionin structure has to be placed based on definition of BAPI_TE_MEREQITEM.
So it's not easy if you try to test the fm by SE37, because you have to respect the positions
It's easier by program:
BAPI_TE_MEREQITEM-PREQ_ITEM = <item number of PR>.
BAPI_TE_MEREQITEM-<ZZFIELD1> = <.............>.
BAPI_TE_MEREQITEM-<ZZFIELD2> = <.............>..
BAPI_TE_MEREQITEM-<ZZFIELDN> = <.............>.
So then you need to move to extensionin structure:
EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEREQITEM'.
MOVE BAPI_TE_MEREQITEM TO EXTENSIONIN+30.
APPEND EXTENSIONIN.
and you need to transfer the flag for fields you want to change the values, that means you need to chenahe the structure BAPI_TE_MEREQITEMX
(enhance the append strutcture CI_EBANDBX:
BAPI_TE_MEREQITEMX-PREQ_ITEM = <item number of PR>.
BAPI_TE_MEREQITEMX-<ZZFIELD1> = 'X'..
BAPI_TE_MEREQITEMX-<ZZFIELD2> = 'X'.
BAPI_TE_MEREQITEMX-<ZZFIELDN> = 'X'
and move it to EXTENSIONIN:
EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEREQITEMX'.
MOVE BAPI_TE_MEREQITEMX TO EXTENSIONIN+30.
APPEND EXTENSIONIN.
Max -
How to run Java from Firefox Extension using liveconnect?!
Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from around the net to get where I am now. I'm sure I'm just making some stupid error at some step.
In order to work out what I'm misunderstanding/doing wrong I'd be really grateful if someone could show me how to get it to work using a very basic example:
Say I have a .java file taken from the sun pages:
* The HelloWorldApp class implements an application that
* simply displays "Hello World!" to the standard output.
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
}So I stick it into a jar using:
jar.exe cvfe HelloWorldApp.jar HelloWorldApp.class HelloWorldApp.class
I then place it directly on my C: drive.
In the javascript of my firefox extension I have code copied and pasted from https://developer.mozilla.org/en/Java_in_Firefox_Extensions:
var urlClasz = java.lang.Class.forName("java.net.URL");
var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1);
urlArray[0] = new java.net.URL('file:///C:/HelloWorldApp.jar');
var cl = java.net.URLClassLoader.newInstance(urlArray);
var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
var aStaticMethod = aClass.getMethod("HelloWorldApp", []);
var greeting = aStaticMethod.invoke(null, []);This seems to start java but then only gives me the error:
"Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.ClassNotFoundException: HelloWorldApp]."
I would be infinitely grateful if someone could show me the code I would use in this situation to run the HelloWorldApp. If I could get it working in this basic situation I'm sure I could work it out from there.
Thank you very, very much!!By the way, I answered just because nobody did and I have some experience with using java from mozilla javascript.
But I never played with Firefox extensions.
No problem baftos, I understand you might not have all the answers but you've helped loads so far, so thanks a lot! I've found it very difficult to find good documentation on this for a beginner like me.
Adding public did it (although I thought that I'd tried that, oops) so thanks again for that. I may have a couple of other questions just in case you happen to know the answer!
I'd like to send some string arguments to the method I really want to run eg:
public class HelloWorldApp {
public static void sayHello(String[] args)
{code}After googling .forName and .getMethod to see how to pass parameters I've added some code:
{code:java}
var strClass = java.lang.Class.forName("java.lang.String");
var parameters = java.lang.reflect.Array.newInstance(strClass,2);
parameters[0] ="My string argument";
parameters[1] ="3"; // etc...
var argHolder = java.lang.reflect.Array.newInstance(strClass,1);
argHolder[0] = strClass;
var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
var aStaticMethod = aClass.getMethod("sayHello", argHolder);
var greeting = aStaticMethod.invoke(null, parameters);
{code}What I thought I was doing was creating a java array: argHolder and putting the string class/object thingy?! in it so that getMethod would look for a method called "sayHello" which took a string array as an argument... but apparently not!
This brings me back to square one with a cannot find method with these arguments error:
"Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.IllegalArgumentException: No method found matching name getMethod and arguments [java.lang.String, [Ljava.lang.String;]]."
You don't happen to know how to do this as well do you?!
Edited by: mzatanoskas on Feb 13, 2009 1:40 PM -
Batch command for using Java in IE
Hello,
I'm looking for a batch command that sets IE to use Java (Sun).
It should do the same job as if manually checking the check box of 'Use <java version> for applet' in advanced internet options of IE.
Is there a way to do it?Sorry, currently there's no batch command to set IE to use Java from Sun.
There're quite a few registry keys need to be set when that option is selected.
Registry settings for:
- turning off console for MSVM;
- hooking up Sun's Java console to IE;
- adding a "TreatAs" to the Web Browser Applet Control so that applets with applet tag will use Sun's Java;
etc. -
How to access sharepoint logs using Java?
Is there a way to access Sharepoint logs using Java from a remote machine?
Any help / pointers would be appreciated. Thanks.Hello,
I am not aware about any client modal class for log but if you create your own service and host in SP server then you can call this web service in JAVA. (i am not sure whether JAVA supports .NET web service or not).
You can refer this for web service:
http://www.arboundy.com/2010/12/centalised-view-of-sharepoint-uls-log-files/
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
I am creating a cloud service on azure with 2 virtual machines using java sdk API. Service created successfully.
My input endpoint details are as follows.
INPUT ENDPOINTS
Head : 191.238.144.47:2400
Head : 191.238.144.47:22
Node0 : 191.238.144.47:43211
For Head instance port 2400 is for HTTPS and port 22 is for SSH and for Node0 instance port 43211 is for SSH.
But I am having problem with doing a ssh on Head instance. Sometimes it works sometimes doesn't. Same problem with HTTPS also.
I have some application running over there but when i try to access it thru browser sometimes it works but most of the time doesn't. When I restart the instances from azure portal, its works after
that(not always but most of the time).
Now I am confused what is going on there. I am creating cloud service and virtual machines using java sdk and setting input endpoints also. After creation of all instances i restart every instance programmatically .
I am not sure whether restart is required or not. It must be something to do with input endpoints only but not able to get the right thing i guess. When i do the same thing thru azure portal(creation of cloud service with virtual machines and setting up input
end points) everything works fine but not achieving the result when implementing it by java sdk API. Please help me.HI Nithin,
Thanks for your reply. I am setting the endpoints after creating my instances using update call. Here's the code snippet.
AzureService aServ = new AzureService(session);
if(aServ.checkNameAvailability(clusterName)) {
aServ.createHostedService(clusterName, "dbX cluster");
// Creating head instance
aServ.createHead(clusterName, imgName, headType, userName, pswd);
// Setting end points for head node
String name = "ssh";
int port = 22;
aServ.updateVMInputEndpoint(clusterName, "Head", name, port);
// Restarting head instance
aServ.restartVM(clusterName, "Head");
String roleName = "Node";
String tmpRoleName = "";
for(int i=0; i<noi; i++) {
port = 43210+(i+1);
tmpRoleName = roleName + i;
// Creating node instance
aServ.createVM(clusterName, tmpRoleName, imgName, nodeType, userName, pswd);
// Setting end points for node instance
aServ.updateVMInputEndpoint(clusterName, tmpRoleName, name, port);
// Restarting node instance
aServ.restartVM(clusterName, tmpRoleName);
// Method to update the input endpoint details
public void updateVMInputEndpoint(String clusterName, String vmName, String name, int port)
throws Exception {
VirtualMachineGetResponse resp = computeManagementClient.getVirtualMachinesOperations().
get(clusterName, clusterName, vmName);
VirtualMachineUpdateParameters updateParameters = new VirtualMachineUpdateParameters();
//get the configuration list
ArrayList<ConfigurationSet> configlist = resp.getConfigurationSets();
//get inputendpoint list and update it
ArrayList<InputEndpoint> endpointlist = configlist.get(0).getInputEndpoints();
InputEndpoint inputEndpoint = new InputEndpoint();
inputEndpoint.setEnableDirectServerReturn(false);
inputEndpoint.setPort(port);
inputEndpoint.setLocalPort(port);
inputEndpoint.setName(name);
inputEndpoint.setProtocol(InputEndpointTransportProtocol.TCP);
endpointlist.add(inputEndpoint);
// Open port for https on head node
if(vmName.equals("Head")) {
inputEndpoint = new InputEndpoint();
inputEndpoint.setEnableDirectServerReturn(false);
inputEndpoint.setPort(2400);
inputEndpoint.setLocalPort(2400);
inputEndpoint.setName("https");
inputEndpoint.setProtocol(InputEndpointTransportProtocol.TCP);
endpointlist.add(inputEndpoint);
updateParameters.setConfigurationSets(configlist);
//required for update
OSVirtualHardDisk osVirtualHardDisk = resp.getOSVirtualHardDisk();
updateParameters.setOSVirtualHardDisk(osVirtualHardDisk);
updateParameters.setRoleName(resp.getRoleName());
OperationResponse updtResp = computeManagementClient.getVirtualMachinesOperations().update(clusterName, clusterName, resp.getRoleName(), updateParameters);
And every time i am creating a new cloud service along with head and node instances. Region is "South Central US".
I am setting ProvisionGuestAgent field to true at instance creation time. Thank you.
Maybe you are looking for
-
Hex String of format "01:02:03:04:05:06" to Integer?
Yes, that is a Mac Address, does anyone know if there is some "comfortable" conversion routine in Cocoa for converting Hex numbers from String to int? The ":" could be stripped, of course, they are only delimiters for easier reading... Many thanks fo
-
HI again everyone! Is it posible when in a numeric field(9 digits allaw) the first entered numbers are 202 a pop-up warning to come up(Please copy to...). Thanks
-
Why has iCloud stopped working in Mavericks, why has iCloud stopped working in Mavericks
I have a .me mail account since loading mavericks the site won't load, just sends an erroe message why?
-
Error to create a new event template
I recent perform migration from adobe connect 8.2 to adobe connect 9.0. When I create a new event template and try to view it under Event Management I get - No resource found Cannot serve request to /content/connect/c1/7/en/events/event/shared/24124/
-
Sometimes I can't write diacritics like "é", "ã" in e-mails.
Sometimes I can't write diacritics like "é", "ã" in my e-mails. I write in Portuguese and use diacritics too much. My OS is Linux Ubuntu 11.04. Sometimes the problem occur, and sometimes it doesn't. This problem doesn't exist when I use other web bro