Create log-configuration.xml contents in portalapp.xml
Hi All,
I created a PAR file and want to use log-configuration.xml contents in portalapp.xml and view or edit log controllers in Visual Admin. Is this possible? Can i modify portalapp.xml and create and manage log controllers in Visual Admin.
Thanks
Prasad
Hi Viet,
For NW 7.0x, we'd put the log-configuration.xml in the META-INF directory of the project's EAR. It'll work with settings in Visual Admin & ConfigTool.
http://help.sap.com/saphelp_nw70/helpdata/en/cc/e03842134bad04e10000000a1550b0/frameset.htm
However, the log-configuration.xml is no longer used since NW 7.1 (not sure if it comes back in NW 7.3)
http://wiki.sdn.sap.com/wiki/display/Java/7.0to7.1evolutioninLogConfiguration
/people/heidrun.reichart/blog/2006/11/24/how-to-use-sap-netweaver-administrator-with-sapacutes-java-platform-enterprise-edition-5 (you should also read the exchanged comments)
Also, in NW 7.3, I believe VA is no longer exist and the entire logging configuration is done using NWA & ConfigTool. You can search for more information about using NWA in NW 7.3 and/or java development for NW 7.3. Also, you'd probably want to post your questions in WDJ and/or Java development forums.
Hope it helps.
Dao
Edited by: Dao Ha on Aug 4, 2011 10:13 AM
Similar Messages
-
How to change the HTTP Response as XML (Content Type "text\xml") ?
Hi Friends ,
I have created one RFC Destination TYPE H . When i am trying to post some XML Message to that particular HTTP Service using POST method . It succesfully accepted the XML File but , it is returning the String as " OK" . In the connection test trace i have seen the Content Type as "text/html" but * I need to get as "text\xml" .*
I need to get response back as XML not plain text .
1 Any Configuration setting do we need to do on Service (SICF ) ?
2. Or any other place we need to modify to get the HTTP Response as XML not plain text
Can you please help to solve the problem . Any clue ?
Thanks & Regards.,
V.Rangarajan
Edited by: ranga rajan on Jan 2, 2008 2:07 PMDear users,
we have requirement sending SMS to the customers mobiles. I am successfully sending the messages to the customers mobiles by using the above method. Facing issues with response message. The response messages is in plain text fromat in single line like...Sent
Using HTTP_AAE Receiver adapter.
The response message was failed while excution of the message mapping with the error
Mapping failed in runtimeRuntime Exception when executing application mapping program com/sap/xi/tf/_MM_SMS_CUST_RES_; Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Content is not allowed in prolog.
please share the comments how to pass the Status of the message to SAP ECC from SAP HTTP adapter
Regards,
Sudir. -
How to change the HTTP Response as XML (Content Type "text\xml") When Post
Hi Friends ,
I have created one RFC Destination TYPE H . When i am trying to post some XML Message to that particular HTTP Service using POST method . It succesfully accepted the XML File but , it is returning the String as " OK" . In the connection test trace i have seen the Content Type as "text/html" but * I need to get as XML format no Srting ( Type "text\xml" . ) *
I need to get response back as XML not plain text .
1 Any Configuration setting do we need to do on Service (SICF ) ?
2. Or any other place we need to modify to get the HTTP Response as XML not plain text
Can you please help to solve the problem . Any clue ?
Thanks & Regards.,
V.RangarajanDear users,
we have requirement sending SMS to the customers mobiles. I am successfully sending the messages to the customers mobiles by using the above method. Facing issues with response message. The response messages is in plain text fromat in single line like...Sent
Using HTTP_AAE Receiver adapter.
The response message was failed while excution of the message mapping with the error
Mapping failed in runtimeRuntime Exception when executing application mapping program com/sap/xi/tf/_MM_SMS_CUST_RES_; Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Content is not allowed in prolog.
please share the comments how to pass the Status of the message to SAP ECC from SAP HTTP adapter
Regards,
Sudir. -
Extracting xml content in a XMLTYPE VIEW
Experts:
I need to create an xmltype view based on the following xml content.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<EMPLOYEES CREATED="2013-02-06T12:33:00" xsi:noNamespaceSchemaLocation="http://supporthtml.oracle.com/TEST_SCHEMA.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EMPLOYEE_TRANS MODE="A" emp_id="1">
<emp_nm>SCOTT</emp_nm>
<emp_dept>FN</emp_dept>
<mgr>DON</mgr>
<sal>4000</sal>
<updt_ts>2013-02-06T12:28:00</updt_ts>
</EMPLOYEE_TRANS>
<EMPLOYEE_TRANS MODE="A" emp_id="2">
<emp_nm>KEVIN</emp_nm>
<emp_dept>HR</emp_dept>
<mgr>MIKE</mgr>
<sal>3000</sal>
<updt_ts>2013-02-06T12:29:00</updt_ts>
</EMPLOYEE_TRANS>
</EMPLOYEES>I want to run a select statement againt this view which can give me column data in this format.
This xml is already stored in an Oracle XMLTYPE Object Relation table which conforms to a registered xsd schema document.
select CREATED, MODE, EMP_ID, emp_nm, emp_dept, mgr, sal, updt_ts from employees_view.
Result:
2013-02-06T12:33:00 A 1 SCOTT FN DON 4000 2013-02-06T12:28:00
2013-02-06T12:33:00 A 2 KEVIN HR MIKE 3000 2013-02-06T12:29:00How can I achieve this? I tried by getting various errors. I would appreciate if someone can send me a sample
11.2.0.3
Linux
XMLDBThanks
Kevin
Edited by: Kevin_K on Feb 6, 2013 9:54 AM
Edited by: Kevin_K on Feb 6, 2013 9:55 AMI guess the above makes a regular relational view? correct?Yes.
How can I extract the of CREATED attribute from the top most employees element and attributes "MODE" and "emp_id" from EMPLOYEE_TRANS element ? You have to use a two-level approach :
SQL> select x1.created, x2.*
2 from EMPLOYEES_OR_TABLE t
3 , xmltable('/EMPLOYEES'
4 passing t.object_value
5 columns created timestamp path '@CREATED'
6 , emps xmltype path 'EMPLOYEE_TRANS'
7 ) x1
8 , xmltable('/EMPLOYEE_TRANS'
9 passing x1.emps
10 columns emp_mode varchar2(1) path '@MODE'
11 , emp_id number path '@emp_id'
12 , emp_nm varchar2(30) path 'emp_nm'
13 , updt_ts timestamp path 'updt_ts'
14 ) x2 ;
CREATED EMP_MODE EMP_ID EMP_NM UPDT_TS
06/02/13 12:33:00,000000 A 1 SCOTT 06/02/13 12:28:00,000000
06/02/13 12:33:00,000000 A 2 KEVIN 06/02/13 12:29:00,000000
The first XMLTable x1 extracts top-level information, then passes the collection of EMPLOYEE_TRANS elements to a second XMLTable that breaks each item in separate rows and columns.
It's also possible to use a single XMLTable, but with a little more complex XQuery expression. -
Print Specific Frames and Dynamic XML content
Hello, I am trying to print specific frames of my Flash movie
with the dynamic text loaded from an XML file. The code below only
prints the current frame I am on and does not print the XML text.
The dataOK that is commented out is a function I have before that
loads the XML content. The XML content is loaded to dynamic text
boxes. Any help on this would be greatly appreciated.I am still having difficulty loading the XML data and the
frameNum parameter does not seem to work. Argghhhh....
function printTut(myevent:MouseEvent):void{
var myPrintJob:PrintJob = new PrintJob();
var mySprite:Sprite = new Sprite();
var printArea:Rectangle = null;
var options:PrintJobOptions = null;
var frameNum:int = 2;
mySprite.addChild(stage);
mySprite.rotation=90;
mySprite.scaleY=.80;
mySprite.scaleX=.80;
myPrintJob.start();
myPrintJob.addPage(mySprite,printArea,options,frameNum);
myPrintJob.send();
print_btn.addEventListener(MouseEvent.CLICK,printTut); -
Deployment of Logging configuration
Hi,
I have a problem, when I deploy an EAR-DC with a log-configuration.xml.
I cant see in the Visual Administrator (under Cluster->J2E->Server 0
0_..->Services->Deploy) the log configuration deployment. There was no
error/warning after the deployment in the console.
I have another EAR-DC and there I configured this xml-File similar and everything works fine.
Regards,
TrianI'm not sure whether you have the same problem as I have:
I deployed EAR from NWDS and log configuration didn't change even if I had created log-configuration.xml. Then I found this file in root of EAR instead of inside META-INF folder. I made manual modificaton to that and manually deployed. And configuration worked. Still I want to have correct deployment automatically from NWDS. -
Pi 7.1 ehp1 log-configuration.xml, howto create/edit in NWDS?
Hello,
In NWDS 2.0 You have a special mode in NWDS to edit the file. You get tabs with Log Formatter, Log Destination, Log Controller and Source.
How does it work in NWDS 7.1 EHP1?
The log-configuration shipped with the example module is packed inside the sample adapter module jar. This seems not right? It should be in the ear?
In nwds I create an ear, and then use the nwpacktool to repack it as an sda to be able to deploy with jspm. There is a firewall so I can't deploy from nwds.
I'm building an adapter module. It works fine besides that the logcontroller doesn't display in the nwa, and I can't set the log levels.
I've tried placing the log-configuration.xml both in the META-INF of the jar and the META-INF of the ear but it still doesn't work.
Thanks for your help.
Best regards
Otto FrostHello,
The NWDS 7.1 EHP1 doesn't recognize the file in the META-INF.
In 7.11 the log-configuration.xml isn't used anymore according to SAP.
When the module is started the tracing location is displayed in the log-configurator automagically.
My module wasn't started after deployment.
To start it I had to go into the NWA - Operation Management -
Systems - Start&Stop - Java EE applications - myPiModule
It was stopped, but started up when I clicked the "Logs" link.
After this it is visible in the tracing locations in the nwa log configurator.
Best regards
Otto Frost -
How to log to a file using the log-configuration.xml?
Hello *,
I created following log-configuration.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log-configuration SYSTEM "log-configuration.dtd">
<log-configuration>
<log-formatters>
<log-formatter name="DefaultFormatter" pattern="%25d %-60l %s: %m" type="TraceFormatter"/>
</log-formatters>
<log-destinations>
<log-destination count="10" effective-severity="ALL" limit="1000000" name="DefaultDestination" pattern="FDLB_GUI.%g.trc" type="FileLog">
<formatter-ref name="DefaultFormatter"/>
</log-destination>
</log-destinations>
<log-controllers>
<log-controller effective-severity="ALL" maximum-severity="FATAL" minimum-severity="DEBUG" name="DefaultController">
<associated-destinations>
<destination-ref association-type="LOG" name="DefaultDestination"/>
</associated-destinations>
</log-controller>
</log-controllers>
</log-configuration>
From a Web Dynpro view I want to use the log-controller. I'm using the default logger:
Logging location.
private static final com.sap.tc.logging.Location logger =
com.sap.tc.logging.Location.getLocation(EinstiegView.class);
In the wdInit method I want to log a simple message:
public void wdDoInit()
//@@begin wdDoInit()
logger.setEffectiveSeverity(com.sap.tc.logging.Severity.ALL);
logger.fatalT("test logging to new file logger");
//@@end wdDoInit()
I see the message in the defaultTrace.0.log, but my own log file doesn't appear.
How to address the log-controller of my log-configuration.xml?
Thanks in advance,
Jürgen DufnerHi,
I guess the follwing part of your log-configuration is wrong:
<log-controller
effective-severity="ALL"
maximum-severity="FATAL" m
nimum-severity="DEBUG"
name="DefaultController">
Try to change in log-configuration the value for name in <log-controller> to the start sequence of the packages to be logged. E.g., all our packages should start with com.yourcompanyname.projectname
To log all messages from classes in these packages make the name = com.yourcompanyname.projectname.
Hope that helps,
Regards, Astrid
Therefore I list -
Log-configuration.xml config does not show up in Visual Admin
I have the following log-configuration.xml file created for a EAR project. When I deploy the file I cannot see the formatters/destinations/controllers in the log configurator.
Please help.. thanks in advance
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log-configuration SYSTEM "log-configuration.dtd">
<log-configuration>
<log-formatters>
<log-formatter
name="XBTR_SERVICE_EJB_Formatter"
pattern="[%s] %24d [%t] %l %m"
type="TraceFormatter"/>
</log-formatters>
<log-destinations>
<log-destination
count="1"
effective-severity="ALL"
limit="1000000"
name="XBTR_SERVICE_EJB_Destination"
pattern="./logs/applications/java/ejb/xBTRservice.log"
type="FileLog">
<formatter-ref
name="XBTR_SERVICE_EJB_Formatter"/>
</log-destination>
</log-destinations>
<log-controllers>
<log-controller
effective-severity="ALL"
maximum-severity="ALL"
minimum-severity="ALL"
name="XBTRService_Log_Controller">
<associated-destinations>
<destination-ref
association-type="LOG"
name="XBTR_SERVICE_EJB_Destination"/>
</associated-destinations>
</log-controller>
</log-controllers>
</log-configuration>Hi Rajeshkr,
Sorry, i am kinda new to web dynpro and sap in general so i may need you to be more explicit
I am not quite sure what this part means or how to check "...has been deployed successfully in the deploy node of the visual Node and check for the Log Configuratior Node and check for your deployed application...."
What i did do is go to the server to and search the entire directory structure for the log-configuration.xml but could not find it. Also, the config cannot be seen via the log-configurator in visual administration engine which its supposed too i think. and lastly the behavoiur i set in the log-configuration.xml is not reflected in the defaultTrace
Then i saw this post so i went to check the EAR file in my workspace and found that it was just like Manik described.
Maybe u could check this link where i posted more about my problem Log-Configuration.xml Problems
I would love to award points if it helps -
SAP Logging- Confuguring log-configuration.xml
Hi,
I am implementing saplogging, my log-configuration.xml looks like this.
<log-formatters>
<log-formatter
name="DefaultFormatter"
type="ListFormatter"/>
</log-formatters>
<log-destinations>
<log-destination
count="5"
effective-severity="ALL"
limit="80000"
name="MyLog4Log"
pattern="./log/applications/MyLog.%g.log" type="FileLog"/>
<log-controllers>
<log-controller
effective-severity="ALL"
maximum-severity="ALL"
minimum-severity="ALL"
name="/Applications/myLogAP">
<associated-destinations>
<destination-ref association-type="LOG" name="MyLog4Log"/>
</associated-destinations>
</log-controller>
and in my class I am implementing like this.
private static Category catLogger = null;
catLogge=Category.getCategoryCategory.APPS_COMMON, "myLogAP");
catLogger.errorT(...,...,...);
It is not creating any file by name MyLog.0.log
But if I use
catLogger.addLog(new FileLog("./log/applications/MyLog.%g.log"));
it is creating file and puttion logs into it. i dont think its a good practice to use the second one.
I want to get name only from log-configuration.xml.
Please put your suggession and comments
Regards
Abhijith YSHI,
Try,
turn off 'ForceSingleTraceFile' in visual admin
visual admin->global configuration->kernal->log manager.
but second method of yours is also good -
Problem loading log-configuration.xml
Dear Experts!
I am developing J2EE application. I created file log-configuration.xml using SAP NetWeaver Developer Studio and put it into META-INF directory in ear file. If I use SDM to deploy ear, it displays message that deployment is successful. But Logging categories and trace locations are not created (I checked it using Visual Administrator -> Log Configurator). When I run my application it writes messages to defaultTrace instead of destination described in log-configuration.xml.
I checked logs of J2EE server and logs of SDM. No error messages.
Where is my mistake? Any ideas are welcome.
WBR,
AntonHi Anton,
Last week I was trying to explore more on the Logging and Tracing concept and I followed these documents.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f361cbea-0c01-0010-a3a0-8948bebb0a23
/people/sap.user72/blog/2004/11/10/log-configuration-for-a-web-dynpro-application
The Logging categories and trace locations are created and I was able to see the application specific logs in the specified location.
Also try to create a blank .log file on the server and then try running your application.
Regards,
Rekha Malavathu -
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 -
How to create new XML file using retreived XML content by using SAX API?
hi all,
* How to create new XML file using retreived XML content by using SAX ?
* I have tried my level best, but output is coming invalid format, my code is follows,
XMLFileParser.java class :-
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
public class PdfParser extends XMLFilterImpl {
private TransformerHandler handler;
Document meta_data;
private StringWriter meta_data_text = new StringWriter();
public void startDocument() throws SAXException {
void startValidation() throws SAXException {
StreamResult streamResult = new StreamResult(meta_data_text);
SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
try
handler = factory.newTransformerHandler();
Transformer transformer = handler.getTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
handler.setResult(streamResult);
handler.startDocument();
catch (TransformerConfigurationException tce)
System.out.println("Error during the parse :"+ tce.getMessageAndLocation());
super.startDocument();
public void startElement(String namespaceURI, String localName,
String qualifiedName, Attributes atts) throws SAXException {
handler.startElement(namespaceURI, localName, qualifiedName, atts);
super.startElement(namespaceURI, localName, qualifiedName, atts);
public void characters(char[] text, int start, int length)
throws SAXException {
handler.characters(text, start, length);
super.characters(text, start, length);
public void endElement(String namespaceURI, String localName,
String qualifiedName) throws SAXException {
super.endElement("", localName, qualifiedName);
handler.endElement("", localName, qualifiedName);
public void endDocument() throws SAXException {
void endValidation() throws SAXException {
handler.endDocument();
try {
TransformerFactory transfactory = TransformerFactory.newInstance();
Transformer trans = transfactory.newTransformer();
SAXSource sax_source = new SAXSource(new InputSource(new StringReader(meta_data_text.toString())));
DOMResult dom_result = new DOMResult();
trans.transform(sax_source, dom_result);
meta_data = (Document) dom_result.getNode();
System.out.println(meta_data_text);
catch (TransformerConfigurationException tce) {
System.out.println("Error occurs during the parse :"+ tce.getMessageAndLocation());
catch (TransformerException te) {
System.out.println("Error in result transformation :"+ te.getMessageAndLocation());
} CreateXMLFile.java class :-
Sax.startDocument();
Sax.startValidation();
Sax.startElement("", "pdf", "pdf", new AttributesImpl());
Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());
String xmp_str = new String(meta_data.getByteArray(),"UTF8");
char[] xmp_arr = xmp_str.toCharArray();
Sax.characters(xmp_arr, 0, xmp_arr.length);
Sax.endElement("", "pdf", "pdf");
Sax.endValidation();
Sax.endDocument();
Sax.endElement("", "basic-metadata", "basic-metadata");* In CreateXMLFile.java
class, I have retreived the xml content in the meta_data object, after that i have converted into character array and this will be sends to SAX
* In this case , the XML file created successfully but the retreived XML content added as an text in between basic-metadata Element, that is, retreived XML content
is not an XML type text, it just an Normal text Why that ?
* Please help me what is the problem in my code?
Cheers,
JavaImranSax.startDocument();
Sax.startValidation();
Sax.startElement("", "pdf", "pdf", new AttributesImpl());
Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());
String xmp_str = new String(meta_data.getByteArray(),"UTF8");
char[] xmp_arr = xmp_str.toCharArray();
Sax.characters(xmp_arr, 0, xmp_arr.length);
</code><code>Sax.endElement("", "basic-metadata", "basic-metadata");</code>
<code class="jive-code jive-java">Sax.endElement("", "pdf", "pdf");
Sax.endValidation();
Sax.endDocument();
* I HAVE CHANGED MY AS PER YOUR SUGGESTION, NOW SAME RESULT HAS COMING.
* I AM NOT ABLE TO GET THE EXACT OUTPUT.,WHY THAT ?
Thanks,
JavaImran{code} -
Log-configuration.xml How to use it
I am trting to use the logging xcapabilities by usinmg log-configuration.xml but is unable to do so by simply configuring it. If I do using using coding i.e by adding in code location and filelog in code I am able to log. But instead of it I am more intrested to use log-configuration.xml. So please provide me with exact steps that need to be done for configuraing it rightly with category defined as well and using a fileLog as an example.
I am trting to use the logging xcapabilities by usinmg log-configuration.xml but is unable to do so by simply configuring it. If I do using using coding i.e by adding in code location and filelog in code I am able to log. But instead of it I am more intrested to use log-configuration.xml. So please provide me with exact steps that need to be done for configuraing it rightly with category defined as well and using a fileLog as an example.
-
Displaying XML content in the browser without creating the XML file
Hi,
In my web application, i am getting the data from the database and generating an XML file based on that. This file is created, read and its content is displayed in the browser when the user clicks a specific link on the jsp.
As per the new requirement, i am not supposed to generate the XML file. Instead when the user clicks on the specific link on the jsp, the XML should get displayed in the browser directly without generating the XML file.
Can someone plz help me in how to do this?
Moreover, this XML generation application should support multiple clients. Do i need to make my application thread-safe explicitly even though i am using a servlet to do this?
Please suggest
ThanxAvoid multi post
http://forum.java.sun.com/thread.jspa?messageID=9858529
Maybe you are looking for
-
I'm not sure if this a Leopard, iPod Touch, or iTunes issue. Problem seems to occur after I've synced the touch and later restarted iTunes (say, after a software update). Haven't noticed the problem with my wife's 5G ipod. I get the following message
-
How to create a passsword protection for EXCEL file
Hi, I have created EXCEL, CSV and DBF file generation through Oracle PL/SQL. Now my client expecting to create a password protection. Can anyone tell me how to create a passsword protected file? Cheers, San
-
After Effects Crash Problem With Program?
Hi Adobe Staff. I have a problem with Adobe After Effects. The Program always Crashes. Is there a way to fix this problem. so the program does no longer crash. when I use the program. If you guys can help me I would greatly appriciate it. Thank You.
-
Mac will not start up after software up date, just screen with Apple logo and spinning icon? I have tried safe start up, unplugged all other cables, no luck?
-
Cant get audio on my recordings for iphone 4s
cant get audio on my recordings for iphone 4s