Include another xml file in web.xml
I was able to use XML Entity to include another xml file in web.xml for older servlet specifications, i.e.:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" [
<!ENTITY my-web SYSTEM "my-web.xml">
]>
<web-app>
&my-web;
</web-app>This allows me to share my-web.xml among various web applications.
How do I achieve the same thing for servlet specification 2.5, which does not have a DTD but rather an XSD?
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">I am using Glassfish V2UR1. I know about $domain-dir/config/default-web.xml, but for reasons I won't get into I cannot put things in there.
Hi Maksim. I understood that. It's just that I would prefer some method that doesn't require the developers to do something like extracting a file from the EAR file, changing the file and then putting it back in. As you probably know, some developers could handle it and some will most certainly make mistakes.
When they do they come to my group and say "my app doesn't work" and then we have to spend time figuring out why.
Plus, once the developers get used to doing things the automated way they're going to have a hard time remembering to do a manual step each time they do a build.
I have heard that there may be some way to do something similar to this on Visual Administrator. I'm going to investigate that too.
Thanks!
David.
Similar Messages
-
How to read configuration data from an xml file (not web.xml)?
Hi,
I want to separate the application specific configuration parameters in a separate xml file and read them as and when they are needed? I know that I can use the wb.xml but I want to separate them in a different xml file because I don't want the web.xml file to be played around later after deployment. If any change is needed then it should be done in the application-config.xml.
How can I read the parameters from this xml file in my jsp code and also what should be the location of this file if I have
../webapps/Root/application
directoty structure ?
Any help is greatly appreciated.can you give an example of a property file and also
it is loaded in the jsp ?Hmm... loading properties in a JSP is not a very good idea. You should do it in a separate class, rather than mixing the logic with the display logic.
Properties properties = new Properties();
properties.load(UtilClass.class.getResourceAsStream("config.properties"));
// Add a try - catch block around the load
// for IOException... -
Java property file in web.xml?
I'm having trouble getting a web app to work resonably closely to how I expect:
I have a property file that is accessed by the package of java classes ( under
WEB-INF/classes). In the classes ( package com.th.lifeinsruance ) i have a property
file which is referenced in the java code as com.th.lifeinsurance.xx.properties.
It seems the only place that wl6.0 is prepared to look for this property file
is under the /weblogic6.0 dir ( i.e totally outside the web app!!). I would guess
that I'm supposed to register this property file in web.xml for the app however
the only examples refer to DataSources and so on ( to set a resource). Is this
correct? Does someone have an example of a java property file being read correctly
in its package with the .class files?
Many Thanks
MarkI've some other solution for the same problem which is working fine for me.
1) make a jar file only consisting of the properties file
jar -cvf DescriptionBundle.jar DescriptionBundle.properties
2) copy the jar file to the /dist/Portal-inf/lib folder
3) Use the following code to get the ResourceBundle
Locale locale = null;
Locale locale = null;
locale = Locale.US;
servletReq.getSession().setAttribute("myLocale", locale);
ResourceBundle bundle = ResourceBundle.getBundle("DescriptionBundle", locale);
if (bundle == null) {
logger.warning("bundle is null");
for (Enumeration e = bundle.getKeys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
String s = bundle.getString(key);
servletReq.getSession().setAttribute(key, s);
logger.info("Key is" + key + "value is" + s);
This solution doesn't suit the title of the topic but is another way to access the properties files. -
How to chage the welcome file in web.xml using creator?
Hi guys,
I want to set the welcome file in web.xml to index.html but every time I run my project in creator, creator replaces index.html by faces/index.jsp. I need the index.html to check if the browser enables cookies & javascript and then I redirect to index.jsp. If I change the web.xml in a common editor, build the war-file with ant and deploy the project with tomcat, everything is fine. but how can I change it in creator?
thanks in advanceSorry, that doesn't make much sense.
The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
Are you a user of this utility? -
Download a XML file from Web Services Using Flex
Hi All...
I am new for flex, im developing a windows application using Flex/Air, i have connected the web services with user authentication, now I want to download a xml file using web services in flex,
how can i do this?? please reply...
Thanks in advance
VasanthHi All....
I have done this myself using sample tutorials...
here is the code for your reference guys
plyLoginName = txtEmailIdDownload.text;
var urlpath:String = new String("your url p?LoginName=");
urlpath = new String(urlpath.concat(plyLoginName));
urlpath = new String(urlpath.concat("&PlayerType="));
urlpath = new String(urlpath.concat(chkseasonvalue));
Alert.show(urlpath);
var request:URLRequest = new URLRequest(urlpath)
var fileRef:FileReference = new FileReference();
fileRef.download(request,"yourfilename.xml");
Alert.show('File downloaded Successfully');
txtEmailIdDownload.text = "";
txtPWDownload.text = "";
thanks
Vasanth -
Use of jsp-file in web.xml
hello
can anybody explain about , when we need <jsp-file> in web.xml
and why we use this tag in place of <url-pattern>?If you want to declare a JSP in your web.xml file you use the jsp-file tag instead of the servlet-class tag. Normally there is no need to declare a JSP in the web.xml file unless you want to use init-params.
Usually people can access a JSP directly wether it is declared in the web.xml or not. So it is not that the jsp-file tag replaces the url-pattern tag so much as the url-pattern tag is not needed for a JSP. However notthing prevents you from declaring the JSP in the web.xml and then mapping the JSP to a different url that doesn't end in '.jsp'. -
How to create a proxy to retrieve the xml file from web services
Hi Every one,
We have a requirment where we receive a xml file from Kenexa, a third party HR tool using a middleware tool. from SAP side We have to create a proxy to retrieve the xml file from web services by initiating call through middleware tool i used earlier.
these are the steps i intend to follow to accomlish the requirement.
1) middleware tool has to initiate the call to kenexa web services to receive the xml file when it is available.
2) On SAP we need to create a ABAP Proxy service provider to middleware where this file can be received.
Can any one guide me how i can create a proxy to retrieve the xml file from web services by initiating call through other middlewre (its not PI).
Any help would be really great, i am not a ABAP developer, so please help me with this. Thanks.Thank for reply.
The computers are in different locations, but yes it's possible, the users in this enviroment are all local administrator of the machines, and we can distribute the script centrally from the DC automatically
Acrobat use Java, right? I'm not so expert in java, but something about it could not be so difficult to manage.
Do you know some place where i can get some info about JS and acrobat? -
Loading an xml file from an xml file
I'm trying to load an xml file from an xml file, but I'm
having problems. My first xml file is really simple - it only
contains one attribute with the name of another xml file in it
(eventually I will have multiple xml files in here and run a loop
on them...this is why I want to load an xml file from an xml file).
Currently, with the code below, I can get the main xml file
to load ("main.xml"), but I cannot get the secondary xml files to
load FROM the main.xml.
I want to then take childNode values from the secondary xml
file and use them within my .swf in text boxes and whatnot.
Any guidance? I think I'm going wrong on the line where I'm
saying "i.newxml.load(i.attributes.location);"
- How can I get this to work?johnypeter:
I tried changing the code inside the loop to use just
"newxml" instead of "i.newxml", and I declared with "var newxml =
new XML();" - was this what you were thinking?
kglad:
The reason I tried to use the loadXML() function in the loop
was so that for each node in my "main.xml" it would load the new
xml file listed - this is a no-no? Do you have any ideas as to what
I could do?
For the for-loop, what should I change in it? I'm not great
with loops so I tried to modify some code from another loop I found
in another forum thread - not the right way to do it here?
Also, what should I trace? The value of the _root.address, or
i.attributes.location? I have created dynamic text boxes on my
stage to see if the correct value from the xml file loads (ie. the
name of the xml file within the xml file) and it does, but now I
don't know how to put that information into ANOTHER loadXML()
function and get the node information from it - does that make
sense???
Below are the examples of the xml files I am using. In the
first one, main.xml, I will have a list of multiple xml files, each
with the same nodes and elements as in the details.xml file
(different values, of course).
This is just to give you an example of what I'm trying to
accomplish - pulling ALL the addresses and phone numbers from
multiple xml files. I cannot manually collect this information, as
it is dynamic, and will be updated in each individual details.xml.
I was hoping to collect the information by simply adding to and
updating ONE xml file - main.xml.
Do you think this can be done? Am I going about it the wrong
way? I'm quite limited in AS knowledge, which is why I'm piecing
together code from other posts! -
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} -
How to refer an xml file within a xml file?
Hi
I would like to refer a xml file within a xml file from where i would like to extracts some elements & attributes.
Plz, suggest me hot to do.
Thank you.You mean you want to link the file thru some resource pointer and then make the external file availabe for parsing and other processing operations?
-
How to transfer multi-input xml file to One xml file using BPM?
Hi!
Using BPM, We wana transfer multiful xml file to One xml at Remote FTP Server.
I don't know how to design BPM.
============== samle1: input xml====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Shipments SYSTEM "DTD/Shipment.dtd">
<Shipments>
<sendingPartnerID>XXX</sendingPartnerID>
<receivingPartnerID>XXX_UPSTMS</receivingPartnerID>
<receivingMessageType>TPSDLS</receivingMessageType>
<Shipment ID="0081646547" Type="CREATE">
<CustomerID>XXX</CustomerID>
</Shipment>
</Shipments>
============== samle2: output xml====================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Shipments SYSTEM "DTD/Shipment.dtd">
<Shipments>
<sendingPartnerID>XXX</sendingPartnerID>
<receivingPartnerID>XXX_UPSTMS</receivingPartnerID>
<receivingMessageType>TPSDLS</receivingMessageType>
<Shipment ID="0081646547" Type="CREATE">
</Shipment>
<Shipment ID="0081886548" Type="CREATE">
</Shipment>
<Shipment ID="0081646999" Type="CREATE">
</Shipment>
</Shipments>
Message was edited by: ChangSeop SongHi,
To convert multiple xml files into a single file, you will have to perform a N:1 mapping.
The following tutorials are available on SAP to help you understand BPM and also to collect multiple XML messages so that they can be mapped into a single message. Check them out,
http://help.sap.com/saphelp_nw04/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
Regards,
Bhavesh -
1 xml file to multiple xml files with 200 records in each
Hello Experts,
I have below scenario.
Please suggest me which might be the best approch to work on.
1) XML file to XML file
I will have 1 pretty huge XML file which i need to break in multiple XML files with 200 records each.
1) first approch i can have bpm in which i can split the file according to my requirement.
2) Second approch i can create 2 scenarios in which 1st scenario will pick up XML file and create multiple flat files with File content conversion. Second scenario will pick up all these flat files and create XML files.
2) XML file to XML file
Or i can have multiple files with 1 record per file and i need to merge in multiple XML files with 200 records in each.
So its kind of 1:N or M:N scenarios.
Please tell me which is might be better performance and design wise.
Or if you have any idea in any other way i can do this, then please reply as soon as possbile.
Please tell me if you have OS command for the same or some script to run or anything which i can implement.
Thanks,
Hetalwhat is your senario? is it File to File?
You can use multi mapping concept without BPM. You can handle the 200 records per message logic in the multimapping.
Regards,
Praveen Gujjeti. -
Merging two xml files into single xml file
i hav to merge 2 xml files in to single xml file
my xml files are
input1.xml
<?xml version="1.0"?>
<PreVCD>
<component name="stack">
<subpath path="stack_environment">
<variable var="ins" symbol="!" wireonbus="1"/>
</subpath>
</component>
<dump>
<time t="0">
<data>
<symbol sign="!" value="0"/>
</data>
</time>
<time t="10">
<data>
<symbol sign="!" value="1"/>
</data>
</time>
<time t="25">
<data>
<symbol sign="!" value="0"/>
</data>
</time>
</dump>
</PreVCD>
input2.xml
<?xml version="1.0"?>
<PreVCD>
<component name="stack">
<subpath path="stack_behavior">
<variable var="i" symbol="@" bussize="1"/>
</subpath>
</component>
<dump>
<time t="0">
<data>
<symbol sign="@" value="0"/>
</data>
</time>
<time t="5">
<data>
<symbol sign="@" value="1"/>
</data>
</time>
<time t="10">
<data>
<symbol sign="@" value="0"/>
</data>
</time>
<time t="20">
<data>
<symbol sign="@" value="1"/>
</data>
</time>
</dump>
</PreVCD>
The ouput should look like:
<PreVCD>
<component name="stack">
<subpath path="stack_behavior">
<variable var="i" symbol="@" bussize="1"/>
</subpath>
<subpath path="stack_environment">
<variable var="ins" symbol="!" wireonbus="1"/>
</subpath>
</component>
<dump>
<time t="0">
<data>
<symbol sign="@" value="0"/>
<symbol sign="!" value="0"/>
</data>
</time>
<time t="5">
<data>
<symbol sign="@" value="1"/>
</data>
</time>
<time t="10">
<data>
<symbol sign="@" value="0"/>
<symbol sign="!" value="1"/>
</data>
</time>
<time t="20">
<data>
<symbol sign="@" value="1"/>
</data>
</time>
<time t="25">
<data>
<symbol sign="!" value="0"/>
</data>
</time>
</dump>
</PreVCD>
thanks for any adviceMerge xml documents with the xslt document() function.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" />
<xsl:template match="/">
<xsl:copy-of select="*"/>
<xsl:copy-of select="document('input2.xml')"/>
</xsl:template>
</xsl:stylesheet> -
Java code to convert XML file to ISO XML format
Hi Experts,
I need to convert an XML file to ISO Xml format using Java code.I dont have any idea about the ISO XML format.I searched but what i am getting is ISO is an encoding in XML.
It will be very helpful if any one can give me a sample ISO XML file, and any way around to carry out the required conversion.
Thanks .
AnikaHi,
For ISO encoding you need the XML file to be converted with below providing the encoding paramter as ISO. for e.g.
<?xml version="1.0" encoding="ISO-8859-1"?>
instead of
<?xml version="1.0" encoding="UTF-8"?>
this can be possible with using XML encoders.
Refer XML encoding--> http://www.w3schools.com/XML/xml_encoding.asp
Refer Java Code with uasage of XMLEncoder
http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLEncoder.html
Thanks
Swarup -
Load XML file into oracle xml buffer
Hi guys,
I'm a starter in Oracle XML Development, I wander how I can load a xml file into oracle xml buffer(xmlctx* document) through programming with c++ in visual studio.
When I use orastream structure, it compiled failed.
Thank you very much!
Edited by: pomelo on 2010-11-15 下午5:39try this
LOAD DATA
INFILE '/home/oraread/'
INTO TABLE xmlloadtable
(id,
file_name filler,
data_xml lobfile(file_name) terminated by eof
)you can add the file_name field as a column to your table between the id and xml column and remove the filler word in the .ldr file if you need to keep the name of the file
Maybe you are looking for
-
After Upgrade to Netweaver, opening pdf from portal gives an error
After an upgrade to Netweaver 4.0, the following code for opening a pdf file constructed from a byte stream passed from an RFC fails. Document doc = new Document(PageSize.A4); javax.servlet.http.HttpServletResponse myResponse = request.getServletResp
-
Using 'DECODE' instead of 'CASE' in select
Hi, I am using CASE statements in my Select clause using 9i. SELECT CASE WHEN S.cmpy_num = S.cpty_borg_num THEN ''OURS'' ELSE ''THEIRS''
-
Cant get into the administrator
After a clean install of W2003 with SQL2005 Express and CF7.02 with no errors. I get an error message "The page cannot be displayed" when trying to open the Adminstrator for the first time. I cant get into the Web Srv Cnfg Tool either. here is where
-
Hi, Can we setting up virtual user table in ironport? Thanks. Alex Ling
-
ICloud Notes keeps recovering deleted items. How do I stop it?
Every time I delete a note in iCloud Notes it recovers the file back to the 'On My Mac' recovery folder. I close the program out, open it back up, and it just does it over and over again. I had as much as 10 recovered items in there at one time. It i