Split an XML File and invoke a Web Serivce for each splits using an XSLT
Hi,
We Have a requirement to Split an incoming XML File into chunks based on a child element and hit the target Web Service for each and every split ( i.e no of splits = no of hits on WebService).
Currently, the incoming XML file is getting splitted and gets appended to the SAME Payload and the WebService is hitted only once with the entire Payload.
Is it possible to invoke a WebService within a XSLT ?
Please find below the XSLT code used to split the file in chunks of 3
<xsl:param name="pItemsNumber" select="3"/>
<xsl:template match="@*|node()">
<xsl:choose>
<xsl:when test="count(Batch/Item) > 4">
<ItemMaintenance>
<xsl:for-each-group select="Batch/Item"
group-adjacent="(position()-1) idiv $pItemsNumber">
<xsl:result-document href="ItemsMatch\{current-grouping-key()}.xml">
<ItemMaintenance>
<xsl:copy-of select="current-group()"/>
</ItemMaintenance>
</xsl:result-document>
</xsl:for-each-group>
</ItemMaintenance>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Hello,
It is possible to invoke a webservice from XSLT. To achieve this you must create a custom XSLT function that does the actual webservice call. You need to write an implementation in Java for this. See my blogpost http://blog.melvinvdkuijl.nl/2010/02/custom-xslt-functions-in-oracle-soa-suite-11g/ for a simple example.
Regards,
Melvin
Similar Messages
-
Hi ,
We have a catalog that defines 2 types of products (they have too many different properties), so wanted to keep them on two different MDEX engines and serve the applications requests. Here DB catalog and front end ATG application is same for both the MDEX instances.
Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin?
Thanks
DevHi, also have had some problem some monthes ago - I created separete component ProductCatalogSimpleIndexingAdminSecond. After that one of my colleage gave me some advice:
The creating separate component like ProductCatalogSimpleIndexingAdmin for the second IOC is possible way for resolving your situation. But I afraid that this way will be required creating mane duplicates for already existed components.
In my opinion the better way is the following:
starting from AssemblerApplicationConfiguration and ApplicationConfiguration component. It contains details for connecting between ATG and Endeca. Of course you should configure different components for different Endeca Apps.
After that:
Find all components that uses AssemblerApplicationConfiguration and ApplicationConfiguration. Customize these components for using one or another *Configuration component depending on what index works. (many variants released it: the most simple global custom component with flag.)
Then customize the existed ProductCatalogSimpleIndexingAdmin. Using one or another IOC and setting the flag in global custom component when index started. You can add some methods into your custom ProductCatalogSimpleIndexingAdmin like:
Execute baseline index for both IOC (one by one)
Execute baseline for IOC 1
Execute baseline for IOC 2.
Note: you should be afraid about incremental (partial) index in this configuration. But resolving conflicts in incremental index should be done after full implementation these changes.
Regards -
I have some more problem in the web.xml file and url-pattern in my syste
HI ALL!
How can I create and place the web.xml and URL-parrten.Because I run
the tomcat in my computer with ME system.
Hocwhat is the problem? please be more specific and detailed? check a sample web.xml file and make your own one and place it in your <application-context>\WEB-INF folder..
-
Loading xml file and parsing error in web start
Hello,
I load a xml file from jar file, but i have a error at parsing see :
ClassLoader cl= this.getClass().getClassLoader();
File file = new File(cl.getResource("paradise/test/maquette/parser/areas.xml").getFile());
parseur.parse(new InputSource(new FileInputStream(file)), this);
the file opening but at parseur.parse() i have a path error with :
http:// . . . . \Paradise_client\paradise.jar!\paradise\test\maquette\parser\areas.xml , bad name of directories .....
Can you help me ? please :-(I need to do a similar thing but in my case I don't know the structure of the xml file. I have 2 questions for this mapping. For an xml file like this:
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<publisher>Dummy Publisher Co.</publisher>
<publisher_address>
<city>London</city>
<street>Heart St.</street>
<no>23/5</no>
</publisher_address>
<description>An in-depth look at creating applications
with XML.
</description>
</book>
</catalog>
If I'm right, I need to create a database named catalog and a table named book. But the problem comes out here: How can i store publisher_address? In a table or what? Other problem is, is there a difference between storing id attribute of the book and genre element of the book? I think they are just columns of the book table. But if I'm wrong what is the correct solution? -
Hi All,
We are trying to access the Create Deployment method stated below
http://msdn.microsoft.com/en-us/library/windowsazure/ee460813
We have uploaded the Package in the blob and browsing the configuration file. We have checked trying to upload manually the package and config file in Azure portal and its working
fine.
Below is the code we have written for creating deployment where "AzureEcoystemCloudService" is our cloud service name where we want to deploy our package. I have also highlighted the XML creation
part.
byte[] bytes =
new byte[fupldConfig.PostedFile.ContentLength + 1];
fupldConfig.PostedFile.InputStream.Read(bytes, 0, bytes.Length);
string a = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
string base64ConfigurationFile = a.ToBase64();
X509Certificate2 certificate =
CertificateUtility.GetStoreCertificate(ConfigurationManager.AppSettings["thumbprint"].ToString());
HostedService.CreateNewDeployment(certificate,
ConfigurationManager.AppSettings["SubscriptionId"].ToString(),
"2012-03-01", "AzureEcoystemCloudService", Infosys.AzureEcosystem.Entities.Enums.DeploymentSlot.staging,
"AzureEcoystemDeployment",
"http://shubhendustorage.blob.core.windows.net/shubhendustorage/Infosys.AzureEcoystem.Web.cspkg",
"AzureEcoystemDeployment", base64ConfigurationFile,
true, false);
<summary>
/// </summary>
/// <param name="certificate"></param>
/// <param name="subscriptionId"></param>
/// <param name="version"></param>
/// <param name="serviceName"></param>
/// <param name="deploymentSlot"></param>
/// <param name="name"></param>
/// <param name="packageUrl"></param>
/// <param name="label"></param>
/// <param name="base64Configuration"></param>
/// <param name="startDeployment"></param>
/// <param name="treatWarningsAsError"></param>
public static
void CreateNewDeployment(X509Certificate2 certificate,
string subscriptionId,
string version, string serviceName, Infosys.AzureEcosystem.Entities.Enums.DeploymentSlot deploymentSlot,
string name, string packageUrl,
string label, string base64Configuration,
bool startDeployment, bool treatWarningsAsError)
Uri uri = new
Uri(String.Format(Constants.CreateDeploymentUrlTemplate, subscriptionId, serviceName, deploymentSlot.ToString()));
XNamespace wa = Constants.xmlNamespace;
XDocument requestBody =
new XDocument();
String base64ConfigurationFile = base64Configuration;
String base64Label = label.ToBase64();
XElement xName = new
XElement(wa + "Name", name);
XElement xPackageUrl =
new XElement(wa +
"PackageUrl", packageUrl);
XElement xLabel = new
XElement(wa + "Label", base64Label);
XElement xConfiguration =
new XElement(wa +
"Configuration", base64ConfigurationFile);
XElement xStartDeployment =
new XElement(wa +
"StartDeployment", startDeployment.ToString().ToLower());
XElement xTreatWarningsAsError =
new XElement(wa +
"TreatWarningsAsError", treatWarningsAsError.ToString().ToLower());
XElement createDeployment =
new XElement(wa +
"CreateDeployment");
createDeployment.Add(xName);
createDeployment.Add(xPackageUrl);
createDeployment.Add(xLabel);
createDeployment.Add(xConfiguration);
createDeployment.Add(xStartDeployment);
createDeployment.Add(xTreatWarningsAsError);
requestBody.Add(createDeployment);
requestBody.Declaration =
new XDeclaration("1.0",
"UTF-8", "no");
XDocument responseBody;
RestApiUtility.InvokeRequest(
uri, Infosys.AzureEcosystem.Entities.Enums.RequestMethod.POST.ToString(),
HttpStatusCode.Accepted, requestBody, certificate, version,
out responseBody);
<summary>
/// A helper function to invoke a Service Management REST API operation.
/// Throws an ApplicationException on unexpected status code results.
/// </summary>
/// <param name="uri">The URI of the operation to invoke using a web request.</param>
/// <param name="method">The method of the web request, GET, PUT, POST, or DELETE.</param>
/// <param name="expectedCode">The expected status code.</param>
/// <param name="requestBody">The XML body to send with the web request. Use null to send no request body.</param>
/// <param name="responseBody">The XML body returned by the request, if any.</param>
/// <returns>The requestId returned by the operation.</returns>
public static
string InvokeRequest(
Uri uri,
string method,
HttpStatusCode expectedCode,
XDocument requestBody,
X509Certificate2 certificate,
string version,
out XDocument responseBody)
responseBody =
null;
string requestId = String.Empty;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = method;
request.Headers.Add("x-ms-Version", version);
request.ClientCertificates.Add(certificate);
request.ContentType =
"application/xml";
if (requestBody != null)
using (Stream requestStream = request.GetRequestStream())
using (StreamWriter streamWriter =
new StreamWriter(
requestStream, System.Text.UTF8Encoding.UTF8))
requestBody.Save(streamWriter,
SaveOptions.DisableFormatting);
HttpWebResponse response;
HttpStatusCode statusCode =
HttpStatusCode.Unused;
try
response = (HttpWebResponse)request.GetResponse();
catch (WebException ex)
// GetResponse throws a WebException for 4XX and 5XX status codes
response = (HttpWebResponse)ex.Response;
try
statusCode = response.StatusCode;
if (response.ContentLength > 0)
using (XmlReader reader =
XmlReader.Create(response.GetResponseStream()))
responseBody =
XDocument.Load(reader);
if (response.Headers !=
null)
requestId = response.Headers["x-ms-request-id"];
finally
response.Close();
if (!statusCode.Equals(expectedCode))
throw new
ApplicationException(string.Format(
"Call to {0} returned an error:{1}Status Code: {2} ({3}):{1}{4}",
uri.ToString(),
Environment.NewLine,
(int)statusCode,
statusCode,
responseBody.ToString(SaveOptions.OmitDuplicateNamespaces)));
return requestId;
But every time we are getting the below error from the line
response = (HttpWebResponse)request.GetResponse();
<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Code>BadRequest</Code>
<Message>The specified configuration settings for Settings are invalid. Verify that the service configuration file is a valid XML file, and that role instance counts are specified as positive integers.</Message>
</Error>
Any help is appreciated.
Thanks,
ShubhenduPlease find the request XML I have found it in debug mode
<CreateDeployment xmlns="http://schemas.microsoft.com/windowsazure">
<Name>742d0a5e-2a5d-4bd0-b4ac-dc9fa0d69610</Name>
<PackageUrl>http://shubhendustorage.blob.core.windows.net/shubhendustorage/WindowsAzure1.cspkg</PackageUrl>
<Label>QXp1cmVFY295c3RlbURlcGxveW1lbnQ=</Label>
<Configuration>77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0NCiAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KDQogIFRoaXMgZmlsZSB3YXMgZ2VuZXJhdGVkIGJ5IGEgdG9vbCBmcm9tIHRoZSBwcm9qZWN0IGZpbGU6IFNlcnZpY2VDb25maWd1cmF0aW9uLkNsb3VkLmNzY2ZnDQoNCiAgQ2hhbmdlcyB0byB0aGlzIGZpbGUgbWF5IGNhdXNlIGluY29ycmVjdCBiZWhhdmlvciBhbmQgd2lsbCBiZSBsb3N0IGlmIHRoZSBmaWxlIGlzIHJlZ2VuZXJhdGVkLg0KDQogICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCi0tPg0KPFNlcnZpY2VDb25maWd1cmF0aW9uIHNlcnZpY2VOYW1lPSJXaW5kb3dzQXp1cmUxIiB4bWxucz0iaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS9TZXJ2aWNlSG9zdGluZy8yMDA4LzEwL1NlcnZpY2VDb25maWd1cmF0aW9uIiBvc0ZhbWlseT0iMSIgb3NWZXJzaW9uPSIqIiBzY2hlbWFWZXJzaW9uPSIyMDEyLTA1LjEuNyI+DQogIDxSb2xlIG5hbWU9IldlYlJvbGUxIj4NCiAgICA8SW5zdGFuY2VzIGNvdW50PSIyIiAvPg0KICAgIDxDb25maWd1cmF0aW9uU2V0dGluZ3M+DQogICAgICA8U2V0dGluZyBuYW1lPSJNaWNyb3NvZnQuV2luZG93c0F6dXJlLlBsdWdpbnMuRGlhZ25vc3RpY3MuQ29ubmVjdGlvblN0cmluZyIgdmFsdWU9IkRlZmF1bHRFbmRwb2ludHNQcm90b2NvbD1odHRwcztBY2NvdW50TmFtZT1zaHViaGVuZHVzdG9yYWdlO0FjY291bnRLZXk9WHIzZ3o2aUxFSkdMRHJBd1dTV3VIaUt3UklXbkFrYWo0MkFEcU5saGRKTTJwUnhnSzl4TWZEcTQ1ZHI3aDJXWUYvYUxObENnZ0FiZnhONWVBZ2lTWGc9PSIgLz4NCiAgICA8L0NvbmZpZ3VyYXRpb25TZXR0aW5ncz4NCiAgPC9Sb2xlPg0KPC9TZXJ2aWNlQ29uZmlndXJhdGlvbj4=</Configuration>
<StartDeployment>true</StartDeployment>
<TreatWarningsAsError>false</TreatWarningsAsError>
</CreateDeployment>
Shubhendu G -
Expecting response in XML format after invoking bea web service
What should I do in order to receive the response from the web service in XML document
(i.e. a well-formed XML document) after invoking the web service via my client
application
(a servlet in my case)? I would like to validate the XML document against a schema
in my
servlet. I deployed my web service sucessfully and followed the WSDL web page
recommendation about creating a client. That is I used the generated stub (client
jar file
generated using clientgen) in my servlet. The result I received was a java object
and not in
XML document form.If you do clientgen on a WSDL, it will generate
java types by default. You can trun this off by
setting autotype="false" in the clientgen ant task.
I have not tried it out, but i think this will use
javax.xml.soap.SOAPElement instead of
generated java types. Then you can create a
DOM object from soap element.
Another option is to use DII with generic
typemapping. An example here:
http://www.manojc.com/?sample27
Regards,
-manoj
http://manojc.com
"Michael Wong" <[email protected]> wrote in message
news:3f1edd7c$[email protected]..
>
What should I do in order to receive the response from the web service inXML document
(i.e. a well-formed XML document) after invoking the web service via myclient
application
(a servlet in my case)? I would like to validate the XML document againsta schema
in my
servlet. I deployed my web service sucessfully and followed the WSDL webpage
recommendation about creating a client. That is I used the generated stub(client
jar file
generated using clientgen) in my servlet. The result I received was ajava object
and not in
XML document form. -
Howto transform a Sales Order (idoc) into xml file and download it?
I need to tranform a Sales order into an xml file such that I could download the file onto my disk. I try to transform an IDOC.
I do the following from an example and I get an xml document on screen but I do get get any file downloaded:
DATA: document TYPE REF TO if_ixml_document.
document = g_ixml->create_document( ).
DATA: ostream TYPE REF TO if_ixml_ostream.
ostream = g_stream_factory->create_ostream_uri(
system_id = 'file://C:\test.xml' ).
DATA: renderer TYPE REF TO if_ixml_renderer, rc TYPE i.
renderer = g_ixml->create_renderer( ostream = ostream
document = document ).
rc = renderer->render( ).
document->render( ostream = ostream recursive = ' ').
Is there something else I should do? Is there another approach for transforming a sales order to an xml file.
The R/3 4.6 system is used.
Thank you
-eglese-Hi Eglese,
Another option could be to use XML port configured for the IDOC and use the XML files generated be extracted from Web Dynpro using a file download UI element.
Thanks and Regards,
Sam Mathew -
Reading A xml file and sending that XML Data as input to a Service
Hi All,
I have a requirement to read(I am using File adapter to read) a xml file and map the data in that xml to a service(schema) input variable.
Example of xml file that I have to read and the content of that xml file like below:
<StudentList>
<student>
<Name> ravi</Name>
<branch>EEE</branch>
<fathername> raghu</fathername>
</student>
<student>
<Name> raju</Name>
<branch>ECE</branch>
<fathername> ravi</fathername>
</student>
<StudentList>
I have to pass the data(ravi,EEE,raghu etc) to a service input varible. That invoked Service input variable(schema) contains the schema similar to above schema.
My flow is like below:
ReadFile file adapter -------------------> BPEL process -----> Target Service.I am using transform activity in BPEL process to map the data from xml file to Service.
I am using above xml file as sample in Native Data format(to create XSD schema file).
After I built the process,I checked file adapter polls the data and receive the file(I am getting View xml document in EM console flow).
But transform activity does not have anything and it is not mapping the data.I am getting blank data in the transform activity with only element names like below
---------------------------------------------------------------------------EM console Audit trail (I am giving this because u can clearly understand what is happening-----------------------------------------------------
-ReceiveFile
-some datedetails received file
View XML document (This xml contains data and structure like above xml )
- transformData:
<payload>
<InvokeService_inputvariable>
<part name="body">
<StudentList>
<student>
<name/>
<branch/>
<fathername/>
</student>
</StudentList>
</part>
</InvokeService_inputvariable>
'Why I am getting like this".Is there any problem with native data format configuration.?
Please help me out regarding this issue as I am running out my time.Hi syam,
Thank you very much for your replies so far so that I have some progrees in my task.
As you told I could have put default directory in composite.xml,but what happenes is the everyday new final subdirectory gets created in the 'soafolder' folder.What I mean is in the c:/soafolder/1234_xmlfiles folder, the '1234_xmlfiles' is not manually created one.It is created automatically by executing some jar.
Basically we can't know the sub folder name until it is created by jar with its own logic. whereas main folder is same(soafolder) ever.
I will give you example with our folder name so that it would be more convenient for us to understand.
1) yesterday's the folder structure : 'c:/soafolder/130731_LS' .The '130731_LS' folder is created automatically by executing some jar file(it has its own logic to control and create the subdirectories which is not in our control).
2) Today's folder structure : 'c:/soafolder/130804_LS. The folder is created automatically(everytime the number part(130731,130804).I think that number is indicating 2013 july 31 st like that.I have to enquire about this)is changing) at a particular time and xml files will be loaded in the folder.
Our challenge : It is not that we can put the default or further path in composite.xml and poll the file adapter.Not everytime we have to change the path in composite.xml.The process should know the folder path (I don't know whether it is possible or not.) and everyday and file adapter poll the files in that created subfolders.
I hope you can understand my requirement .Please help me out in this regard. -
Reading data From XML file and setting into ViewObject to Pouplate ADF UI
Hi,
I have following requirement.
I would like to read data from XML file and populate the data in ViewObject so that the data can be displayed in the ADF UI.
Also when user modifies the data in the ADF UI, it should be modified back into to ViewObject.
Here is an example - XML file contains Book Title and Author. I would like to read Book Title and Author from XML file and set it into ViewObject Attribute and then display Book title and Author in ADF UI page. Also when user modifies Book title and Author, I would like to store it back in View Object.
Please help me with this requirement and let me know if any solution exist in ADF, for populating the ADF UI screen fields with external XML file data.
ThanksRead chapter 42 http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcadvvo.htm of the fusion developer guide
Section 42.7, "Reading and Writing XML"
Section 42.8, "Using Programmatic View Objects for Alternative Data Sources"
Timo -
XML files and assemblies in bin directory
In VS 2010 the bin directory was very simple and straight forward. Now in VS 2012 Web apps the bin directory is filled with a bunch of System and Microsoft assemblies a bunch of folders named with the two letter country code use in URLs and a bunch
of xml files with the name of the System and Microsoft assemblies. I can guess the reason for the assemblies is so that the web app can be deployed to servers without the .Net Framework installed or to which the installed app does not have access to
the GAC. But what is the reason for all of the xml files. Then to add insult to injury, even though the project is created with all of these xml files listed in the bin folder, each and everyone has a yellow triangle with an exclamation mark
beside which I assume means that the file does not exist physically in the folder. When you go to windows explorer sure enough they aren't there.
What is the purpose of all of these xml files, and if they are needed then why aren't they added to the bin folder? I can not publish my project because the files do not exist. Can I delete these files with impunity?
Edward R. Joell MCSD MCDBAHow can you possibly think that this is an ASP.Net issue?
Visual Studio 2012 created the listing for those files and foreign folders in the bin, NOT Asp.Net.
Visaul Studio 2012 listed those files in the bin and failed to create the files physically NOT Asp.Net.
Visual Studio 2010 does NOT put those extraneous files in the exact same kind of Asp.Net project, but Visual Studio 2012 does.
This is behavior that only occurs with the new version of Visual Studio. If it were an Asp.Net issue then Visual Studio 2010 would exhibit the same behavior.
Visual Studio is the mechanism that carries out publishing the project. This is a function of the IDE. It is Visual Studio that is reporting it can not complete the task because it cannot find the files it did not create.
This is new behavior from Visual Studio 2012, which makes it impossible to work.
In addition, Visual Studio 2012 keeps having the Output and Errors window show up on the level where the code windows are suppose to open and the code windows open where the output window is supposed to open.
This behavior has NOTHING to do with Asp.Net or it would be present in ALL versions of Visual Studio, but it is only happening in Visual Studio 2012.
Are the moderators of this forum trying to avoid the hard questions, or are they trying to hide flaws in Visual Studio?
Edward R. Joell MCSD MCDBA -
Read an XML file and send it to client
Hi,
I'm introducing to servlet development and I'm trying to do some AJAX calls. The client side is implemented, but I have some troubles on the server side. I want to open an XML file and send it to the client. How can I do that? Any special header?
I have implemented this test in PHP, so you can imagine what I would like to do:
if ($type == "xml"){
$xml = "";
$file = fopen ("file.xml", "r");
while (!feof ($file)){
$xml .= fgets ($file, 4096);
fclose ($file);
header ("Content-type: text/xml; charset=ISO-8859-1");
echo $xml;
}The XML file is:
<?xml version='1.0' encoding='ISO-8859-1'?>
<users>
<user>
<name>Pepe</name>
<age>18</age>
</user>
<user>
<name>María</name>
<age>21</age>
</user>
</users>Thanks.Not very useful:(.
This is my code:
PrintWriter out = null;
try{
String type = request.getParameter ("type");
if (type.equals ("xml")){
response.setContentType ("text/xml; charset=ISO-8859-1");
out = response.getWriter ();
String xml =
"<?xml version='1.0' encoding='ISO-8859-1'?>" +
"<users>" +
"<user>" +
"<name>Pepe</name>" +
"<age>18</age>" +
"</user>" +
"<user>" +
"<name>María</name>" +
"<age>21</age>" +
"</user>" +
"</users>";
out.println (xml);
}finally{
out.close ();
}This code works. The servlet send back the xml and the client shows the content but, as you can see, i'm not reading the xml file. So my problem is on reading the xml file as a plain text. My code is this:
response.setContentType ("text/xml; charset=ISO-8859-1");
out = response.getWriter ();
String xml = "";
FileReader fr = null;
BufferedReader br = null;
try{
fr = new FileReader (new File ("file.xml"));
br = new BufferedReader (fr);
String linea;
while ((linea = br.readLine ()) != null){
xml += linea;
//System.out.println (linea);
fr.close ();
}catch (Exception e){
e.printStackTrace ();
}But now I get an Exception File not found. The xml file is in the web directory (I'm using net beans 6.8). Where I have to put the file?
Thanks.
Edited by: GagleKas on Mar 15, 2010 6:39 AM -
Insert SWF that calls external XML files and images
Hi
I am using Acrobat XI Pro on a Windows 7 system.
I have a PDF in which I have an SWF file. This SWF file contains text content that is called from an XML file and also some images that is called externally. I have added the folder that contains the XML file and the images by right-clicking the SWF > Properties > Resources > Add Directory. However, none of the content is loading.
I have tried adding the images and xml file separately as well. Even that did not work.
What could be wrong? Please advise.
SreekanthDebugging Flash content in a PDF from the Flash Pro or Flex editor is possible, but it's complicated (you need to juggle about with the SDK to load a special Acrobat plugin). If you're creating these SWFs yourself, the fastest way to debug is to add a bunch of ActionScript calls that report to Acrobat's console to tell you what's going on. Use ActionScript's externalInterface.call() and the Acrobat JS console.println() functions, just like if you were talking to JavaScript in a web page.
Rich media resources cannot be imported globally in Acrobat. In theory it's possible (the ISO standard allows XObject references to shared assets) but there's no authoring tool. -
How can I take the part that parses the .XML file and make it a procedure.
CREATE OR REPLACE PACKAGE BODY XMLSTUD6 AS
Author: Jimmy Harris
Created: 5/25/2006
Purpose: 1.This package has an XML file initialized to a variable called DOC .
2.It will then take the values from the XML file and insert them into a PL/SQL table.
3.From the PL/SQL table it will insert values into the STUDENTS table.
4.After step four above, the STUDLOAD procedure will insert (Sequence,Status, .XML file, USER, SYSDATE, ERROR_Message
into the AUDIT_XMLSTUD table regardless if insert status was successfull or not status is indicated by either an Y or
NO and the original XML filed that was currently processed, the date and user who executed the procedure.
If the status was NO then it will insert the Oracle SQLERRM massage, into the REASON_FOR_ERROR column.
If status is Y then REASOK_FOR_ERROR IS NULL.
5,Make sure you embed the xml file with an inner and outer ' ' ie: ' the whole .xml file string ' as the input
parameter into the STUDLOAD procedure.
This package excepts the whole .XML file as a CLOB as an input parameter, so that the end-user will not have
modify the code.
Modification History: 1.6/09/2006 JImmy Harris Modified code, added the Function "WORD_CONVERTER1" to accept the requested text data and
return a coded value back to our Welligent system.
2. Was advised that a front end type of functionality was not neccesary for this issue so I removed the INSERT_XML_FILE,
UPDATE_XML_FILE and the INSERT_XML_file.
FUNCTION WORD_CONVERTER1 (v_domain IN VARCHAR2 := null,
v_incoming IN VARCHAR2 := null) RETURN VARCHAR2 IS
v_well VARCHAR2(32);
v_editdd BOOLEAN;
v_code VARCHAR2(32);
CURSOR C_conv_wrd IS
SELECT WELL
INTO v_code
FROM CONVERSION_TABLE
WHERE DOMAIN = UPPER(TRIM(v_domain))
AND INCOMING = UPPER(TRIM(v_incoming));
BEGIN
OPEN c_conv_wrd;
LOOP
FETCH c_conv_wrd INTO v_code;
EXIT WHEN c_conv_wrd%NOTFOUND;
END LOOP;
CLOSE c_conv_wrd;
RETURN v_code;
END WORD_CONVERTER1;
PROCEDURE STUDLOAD (DOC CLOB) IS
v_parser xmlparser.Parser;
v_doc xmldom.DOMDocument;
v_nl xmldom.DOMNodeList;
v_n xmldom.DOMNode;
v_mm NUMBER;
v_dd NUMBER;
v_yyyy NUMBER;
v_DATE DATE;
v_race VARCHAR2(1);
v_eth VARCHAR2(1);
v_prim_lang VARCHAR2(1);
v_house_lang VARCHAR2(1);
v_gender VARCHAR2(1);
TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
s_tab stuxml_type := stuxml_type();
v_success VARCHAR2(200);
v_failure VARCHAR2(200);
l_error_code varchar2(200);
BEGIN
-- Create a parser.
v_parser := xmlparser.newParser;
xmlparser.setValidationMode(v_parser, FALSE);
-- Parse the document and create a new DOM document.
SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
v_doc := SYS.XMLPARSER.getDocument(v_parser);
-- Free resources associated with the Parser now it is no longer needed.
xmlparser.freeParser(v_parser);
-- Get a list of all the STUD nodes in the document using the XPATH syntax.
v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
-- Loop through the list and create a new record in a table collection for each STUD record.
FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
v_n := xmldom.item(v_nl, stud);
s_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
s_tab(s_tab.last).STUDENT_DOB := v_date;
s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
v_race := WORD_CONVERTER1('RACE',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Race')));
v_eth := WORD_CONVERTER1('EHTNICITY',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Ethnicity')));
v_prim_lang:= WORD_CONVERTER1('PRIMARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/PrimaryLanguage')));
v_house_lang:= WORD_CONVERTER1('SECONDARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/HouseholdLanguage')));
v_gender := WORD_CONVERTER1('GENDER',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Gender')));
s_tab(s_tab.last).STUDENT_RACE := v_race;
s_tab(s_tab.last).STUDENT_ETHNIC := v_eth;
s_tab(s_tab.last).STUDENT_PRI_LANG :=v_prim_lang;
s_tab(s_tab.last).STUDENT_SEC_LANG := v_house_lang;
s_tab(s_tab.last).STUDENT_GENDER :=v_gender;
END LOOP;
FOR stud IN s_tab.first..s_tab.last LOOP
INSERT INTO STUDENTS (SHISID, SSN, DOE_SCHOOL_NUMBER,PATIENT_TYPE, TEACHER, HOMEROOM,STUDENT_LAST_NAME, STUDENT_FIRST_NAME, STUDENT_MI,STUDENT_DOB,
STUDENT_BIRTH_CERT, STUDENT_COMM,STUDENT_MUSA, STUDENT_FAMSIZE, STUDENT_FAMINCOME,STUDENT_UNINSURED, STUDENT_LUNCH, STUDENT_ZIP,STUDENT_STATE,
STUDENT_COUNTY, STUDENT_STREET,STUDENT_APART_NO, STUDENT_PHONE, STUDENT_H2O_TYPE,STUDENT_WASTE_TRT, STUDENT_HOME_SET, STUDENT_NONHOME_SET,
STUDENT_GENDER, STUDENT_RACE, STUDENT_ETHNIC,STUDENT_PRI_LANG, STUDENT_SEC_LANG, STUDENT_ATRISK,EMER_COND_MEMO, ASSIST_DEVICE_TYPE,
SCHOOL_ENTER_AGE,STUDENT_CURR_GRADE, S504_ELIG_DATE, S504_DEV_DATE,S504_REV_DATE, STUDENT_504, STUDENT_IEP,IEP_EXP_DATE, GRAD_CLASS, TYPE_DIPLOMA,
GRADE_RETAIN, LIT_PASS_TEST_MATH, LIT_PASS_DATE_MATH,LIT_PASS_TEST_WRITE, LIT_PASS_DATE_WRITE, LIT_PASS_TEST_READ,LIT_PASS_DATE_READ, SPEC_ED_ELIG,
SPEC_ED_CODE,TRANSPORT_CODE, TRANSPORT_NO, PRIME_HANDICAP,PRIME_HANDICAP_PERCENT, PRIME_HANDI_MANAGER, FIRST_ADD_HANDI,FIRST_ADD_HANDICAP_PERCENT,
FIRST_ADD_HANDI_504, FIRST_ADD_HANDI_504_DATE, SECOND_ADD_HANDI, SECOND_ADD_HANDICAP_PERCENT, MED_EXTERNAL_NAME, INS_TYPE, INS_PRI, INS_NAME,
INS_MEDICAID_NO, ELIGDATE, INS_PRIV_INSURANCE, INS_APPR_BILL, INS_APPR_DATE, INS_PARENT_APPR,INS_POL_NAME, INS_POL_NO, INS_CARRIER_NO,
INS_CARRIER_NAME, INS_CARRIER_RELATE, INS_AFFECT_DATE, INS_COPAY_OV, INS_COPAY_RX, INS_COPAY_AMBUL,INS_COPAY_EMER, INS_COPAY_OUTPAT,STUDENT_INACTIVE,
PHYS_ID, ENCOUNTERNUM,USERID,MODDATE, STUDENT_ID, S504_DISABILITY,CHAPTER1, WELLNESS_ENROLL, SCHOOL_OF_RESIDENCE,INITIAL_IEP_DATE, CALENDAR_TRACK,
USA_BORN,ALT_ID, FUTURE_SCHOOL, IEP_LAST_MEETING,IEP_LAST_SETTING, IEP_LAST_REFER_EVAL, THIRD_ADD_HANDI,LEP, GIFTED, IEP_EXIT_REASON,
CASE_MANAGER_ID, INTAKE_NOTES, CALLER_PHONE,CALL_DATE, CALLER_RELATIONSHIP, CALLER_NAME,BUSINESS_PHONE, FAX, EMAIL,HIGHEST_EDUCATION, INTAKE_DATE,
SERVICE_COORDINATOR, DISCHARGE_DATE, DISCHARGE_REASON, DISCHARGE_NOTES,INTAKE_BY, INTAKE_STATUS, IEP_LAST_SERVED_DATE,IEP_APC_DATE, IEP_EXIT_DATE,
ADDRESS2, LEGAL_STATUS, RELIGION, EMPLOYMENT_STATUS, TARG_POP_GROUP1, TARG_POP_GROUP2, MARITAL_STATUS,THIRD_ADD_HANDI_PERCENT, LAST_INTERFACE_DATE,
SERVICE_PLAN_TYPE,CURRENT_JURISDICTION, FIPS, BIRTH_PLACE_JURISDICTION,BIRTH_PLACE_HOSPITAL, BIRTH_PLACE_STATE, BIRTH_PLACE_COUNTRY,
OTHER_CLIENT_NAME, SIBLINGS_WITH_SERVICES, PERM_SHARE_INFORMATION,PERM_VERIFY_INSURANCE, REFERRING_AGENCY, REFERRING_INDIVIDUAL,AUTOMATIC_ELIGIBILITY,
INTAKE_IEP_ID, FUTURE_SCHOOL2,FUTURE_SCHOOL3, TRANSLATOR_NEEDED, TOTAL_CHILDREN_IN_HOME,REFERRED_BY, FAMILY_ID, SCREENING_CONSENT_FLAG,PICTURE_FILE,
DUAL_ENROLLED, DOE_SCHOOL_NUMBER2)
VALUES (123456789025, null,null ,null,null,null ,s_tab(stud).STUDENT_LAST_NAME,s_tab(stud).STUDENT_FIRST_NAME,s_tab(stud).STUDENT_MI,
s_tab(stud).STUDENT_DOB,null ,null,null ,null,null,null,null,s_tab(stud).STUDENT_ZIP,s_tab(stud).STUDENT_STATE ,s_tab(stud).STUDENT_COUNTY,
s_tab(stud).STUDENT_STREET,s_tab(stud).STUDENT_APART_NO,null,null,null ,null , null,
s_tab(stud).STUDENT_GENDER ,s_tab(stud).STUDENT_RACE , s_tab(stud).STUDENT_ETHNIC,
s_tab(stud).STUDENT_PRI_LANG ,s_tab(stud).STUDENT_SEC_LANG, null, null ,null , null,
null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null, null,null );
END LOOP;
INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
HTP.HTMLOPEN;
v_success:= 'The values from the .XML file have been successfully inserted into the STUDENTS table in the Oracle Database.';
htp.bold(v_success);
HTP.HTMLCLOSE;
COMMIT;
-- Free any resources associated with the document now it that it is no longer needed.
xmldom.freeDocument(v_doc);
EXCEPTION
WHEN OTHERS THEN
l_error_code := SQLERRM;
INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
HTP.HTMLOPEN;
v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
htp.bold(v_failure);
HTP.HTMLCLOSE;
COMMIT;
END STUDLOAD;
PROCEDURE UPDSTUDLOAD (DOC CLOB) IS
v_parser xmlparser.Parser;
v_doc xmldom.DOMDocument;
v_nl xmldom.DOMNodeList;
v_n xmldom.DOMNode;
v_mm NUMBER;
v_dd NUMBER;
v_yyyy NUMBER;
v_DATE DATE;
v_race VARCHAR2(1);
v_eth VARCHAR2(1);
v_prim_lang VARCHAR2(1);
v_house_lang VARCHAR2(1);
v_gender VARCHAR2(1);
TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
s_tab stuxml_type := stuxml_type();
v_success VARCHAR2(200);
v_failure VARCHAR2(200);
l_error_code varchar2(200);
BEGIN
-- Create a parser.
v_parser := xmlparser.newParser;
xmlparser.setValidationMode(v_parser, FALSE);
-- Parse the document and create a new DOM document.
SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
v_doc := SYS.XMLPARSER.getDocument(v_parser);
-- Free resources associated with the Parser now it is no longer needed.
xmlparser.freeParser(v_parser);
-- Get a list of all the STUD nodes in the document using the XPATH syntax.
v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
-- Loop through the list and create a new record in a table collection for each STUD record.
FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
v_n := xmldom.item(v_nl, stud);
s_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
s_tab(s_tab.last).STUDENT_DOB := v_date;
s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
v_race := WORD_CONVERTER1('RACE',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Race')));
v_eth := WORD_CONVERTER1('EHTNICITY',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Ethnicity')));
v_prim_lang:= WORD_CONVERTER1('PRIMARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/PrimaryLanguage')));
v_house_lang:= WORD_CONVERTER1('SECONDARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/HouseholdLanguage')));
v_gender := WORD_CONVERTER1('GENDER',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Gender')));
s_tab(s_tab.last).STUDENT_RACE := v_race;
s_tab(s_tab.last).STUDENT_ETHNIC := v_eth;
s_tab(s_tab.last).STUDENT_PRI_LANG :=v_prim_lang;
s_tab(s_tab.last).STUDENT_SEC_LANG := v_house_lang;
s_tab(s_tab.last).STUDENT_GENDER :=v_gender;
END LOOP;
FOR stud IN s_tab.first..s_tab.last LOOP
UPDATE STUDENTS
SET
STUDENT_LAST_NAME = s_tab(stud).STUDENT_LAST_NAME,
STUDENT_FIRST_NAME = s_tab(stud).STUDENT_FIRST_NAME,
STUDENT_MI = s_tab(stud).STUDENT_MI,
STUDENT_DOB = s_tab(stud).STUDENT_DOB,
STUDENT_ZIP = s_tab(stud).STUDENT_ZIP,
STUDENT_STATE = s_tab(stud).STUDENT_STATE,
STUDENT_COUNTY = s_tab(stud).STUDENT_COUNTY,
STUDENT_STREET = s_tab(stud).STUDENT_STREET,
STUDENT_APART_NO = s_tab(stud).STUDENT_APART_NO
WHERE SHISID = 123456789025;
END LOOP;
INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
HTP.HTMLOPEN;
v_success:= 'The updated .XML file has been successfully saved to the STUDENTS table in the Oracle Database.';
htp.bold(v_success);
HTP.HTMLCLOSE;
COMMIT;
-- Free any resources associated with the document now it that it is no longer needed.
xmldom.freeDocument(v_doc);
EXCEPTION
WHEN OTHERS THEN
l_error_code := SQLERRM;
INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
HTP.HTMLOPEN;
v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
htp.bold(v_failure);
HTP.HTMLCLOSE;
COMMIT;
END UPDSTUDLOAD;
PROCEDURE DELSTUDLOAD (DOC CLOB) IS
v_parser xmlparser.Parser;
v_doc xmldom.DOMDocument;
v_nl xmldom.DOMNodeList;
v_n xmldom.DOMNode;
v_mm NUMBER;
v_dd NUMBER;
v_yyyy NUMBER;
v_DATE DATE;
TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
s_tab stuxml_type := stuxml_type();
v_success VARCHAR2(200);
v_failure VARCHAR2(200);
l_error_code varchar2(200);
BEGIN
-- Create a parser.
v_parser := xmlparser.newParser;
xmlparser.setValidationMode(v_parser, FALSE);
-- Parse the document and create a new DOM document.
SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
v_doc := SYS.XMLPARSER.getDocument(v_parser);
-- Free resources associated with the Parser now it is no longer needed.
xmlparser.freeParser(v_parser);
-- Get a list of all the STUD nodes in the document using the XPATH syntax.
v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
-- Loop through the list and create a new record in a table collection for each STUD record.
FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
v_n := xmldom.item(v_nl, stud);
s_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
s_tab(s_tab.last).STUDENT_DOB := v_date;
s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
END LOOP;
FOR stud IN s_tab.first..s_tab.last LOOP
DELETE FROM STUDENTS
WHERE SHISID = 123456789025;
END LOOP;
INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
HTP.HTMLOPEN;
v_success:= 'The .XML file has been successfully deleted from the STUDENTS table in the Oracle Database.';
htp.bold(v_success);
HTP.HTMLCLOSE;
COMMIT;
-- Free any resources associated with the document now it that it is no longer needed.
xmldom.freeDocument(v_doc);
EXCEPTION
WHEN OTHERS THEN
l_error_code := SQLERRM;
INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
HTP.HTMLOPEN;
v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
htp.bold(v_failure);
HTP.HTMLCLOSE;
COMMIT;
END DELSTUDLOAD;
END XMLSTUD6;Try opening the problem files using a text editor or file viewer to see what the first few bytes contain. All valid FM binary files for FM 11 will contain <MakerFile 11.0> in the first bytes of the file.
When updating books, it's sometimes better to just to create a new book file and add the files to that.
When renaming files in a book, changes at the system level will break any links/cross-references between files, so it's always best to use the Rename option in the Book file to change FM file names. This will maintain the correct linkages. -
Reading from XML file and updating the table ????
Hi
I have package which reads the hier.XML file and does Update inserts into the 5 tables
i have table called MAIN_tbl with the column cur_date.
The package kicks if this cur_date is one day less than the hier.XML file DT.
Currently i m manually checking this date's to make sure the Main_tbl cur_date is n sync with
hier.XML file DT.
for example :- hier.xml file DT is "20091020" then main_table cur_date should be 10/19/2009
in order to kicks of the pakage.
what i m looking to do ??
compare the hier.xml DT with the main_table cur_date,
if cur_date is -1(Preivous day) of hier.xml DT then run hier_pkg(Package)
if not then update main_table cur_date to -1(previous day) of the hier.xml DATE
Then later write the above logic to update the main_table in a procedure, and
then call the package from the procedure.
below are the top few lines of the hier.XML file which is relevant to the one which we are trying to do
<?xml version = '1.0'?>
<HIER_POSTING num ="111" HIER_TYP="CD" DT="20091020" Global="Y">
FYI : The hier.XML file is located in UNIX space.
How do i accomplish this. any idea ????
Thank you so much in advance. For giving a thought on this problem!!!Any thought on this guys ???
Thanks!! -
Reading the datas in the Xml file and store it in the array using java
Hi every one
Can any one send me the java coding for traversing through XML file and get the data and store it in the array (SAX parser is prefered)
its a urgent requirement . please help me
Regards
Aruni send it to ur mail id ,
could you please send me a mail to [email protected]
Maybe you are looking for
-
Can't sign PDF documents.
Can't sign PDF documents. After pressing the Accept button, no preview of my signature, and the screen reverts to the document.
-
A queue using a linked list..having troubles with the rest
ok... this is the assignment ( [http://jessehardesty.com/uploads/p2.JPG] ) picture is kind of big... I have to have a "queue" class, but I will have to remove some people from the line that are in the middle (which is why i put it in quotes). this is
-
Convert 1D array element to integer
Does anyone know how I can extract the value (element) from a 1D array so that the output value is an integer ? I'm having signal incompatibility problems (again). I need to use the particular element from an array in various math blocks i.e. Add S
-
I cannot reactivate my e-reader with my existing Adobe ID and password which are both correct. I alwayss get the message "activation server error, Code: E_AUTH_NOT_READY" What kind of problem is this and what is most important, how can I solve it qui
-
Appending internal tables.
Hello All, Can any of you let me know How can we append one internal contents to other when their structure do not match?? Is it possible? Or is there an other approach for this?? Thanks Karthik Krishna