XMLSamples
I'm trying to use the classes in XMLSamples as a prototype for some new functionality. Howerver, I get a compile error on the code when its in my project:Class FindElement not found in my project.
I'm referencing the same libraries and have the same import statements in my project as the sample app. However, I do have a different root directory/package.
Questions:
*Where is the FindElement class located: that is, in which package?
*Why does the sample compile OK but my project doesn't since the libraries and import statement are the same.
Thanks for any assistance.
I'm using 3.2.2. The specific call in question follows:
XMLStreamToParse = FindElement.class.getResourceAsStream("/sample.xml"); in the TransformShoppingCart.java class.
Calls similar to the above are used in several sample class including the FindElement.java sample class.
The only difference I see is that the root directory for the samples has the java 1.2 libraries in a subdirectory whereas my root directory does not.
I've search the hard disk for this class and also the javadoc with no luck.
Hope this helps?
Similar Messages
-
Where can I find the RTF file for xmlsamples on Oracle official website?
The xmlsamples' link is:
http://www.oracle.com/technology/products/xml-publisher/xmlpsamples.html
The report that I'm working on is almost the same as the "Invoices" sample from the link above, but I don't know how to make my own report like that. I wonder if there would be a RTF file for this sample.
Anyone knows about this?cat .bash_history
-
How can I get content of xml elements?
Hello everybody,
here is my xml document and my code which parses xml. I want to print content of all elements from xml to console but result is only null. But names of all elements shows correctly. Where is problem? Thank you in advance
XMLSample.java
import java.io.File;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class XMLSample {
private void getAttribute(Document doc) {
NodeList list = doc.getElementsByTagName("*");
for (int i=0; i<list.getLength(); i++) {
// Get element
Element el = (Element)list.item(i);
System.out.println(el.getNodeName());
System.out.println(el.getNodeValue());
private Document executeXML(String[]argv) {
if (argv.length != 1) {
System.err.println("Usage: java DomEcho filename");
System.exit(1);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document doc = null;
try {
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(new File(argv[0]));
} catch (SAXException sxe) {
// Error generated during parsing)
Exception x = sxe;
if (sxe.getException() != null)
x = sxe.getException();
x.printStackTrace();
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
System.out.println("doc > " + doc);
return doc;
public static void main(String argv[]) {
XMLSample dom = new XMLSample();
Document doc = dom.executeXML(argv);
dom.getAttribute(doc);
library.xml
<library>
<book>
<author>
Jan Zitniak
</author>
<title>
JSP Guru
</title>
</book>
<book>
<author>
Jan Zitniak
</author>
<title>
JSP Guru
</title>
</book>
</library>If you have XML like:
<target>value</target>What you actually have in DOM is:
Element
TextCall getFirstChild() on the Element and cast the result as Text. Then call getNodeValue() on the Text node.
- Saish -
I am trying to extract the xmlsample jar. I get a exception raised, can anybody help?
created: xmlnews/admin/
extracted: xmlnews/admin/AdminServletHTML.java
extracted: xmlnews/admin/MultipartHandler.java
extracted: xmlnews/admin/NewsAdmin.jpr
extracted: xmlnews/admin/RSSHandler.java
extracted: xmlnews/admin/AdminServlet.java
created: xmlnews/common/
extracted: xmlnews/common/Common.jpr
extracted: xmlnews/common/ConnectionParams.java
extracted: xmlnews/common/DynNewsEnv.java
extracted: xmlnews/common/GenUtility.java
extracted: xmlnews/common/RequestHandler.java
extracted: xmlnews/common/RequestParams.java
extracted: xmlnews/common/UserPreference.java
extracted: xmlnews/common/UserValidation.java
java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:210)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:133)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:142)
at sun.tools.jar.Main.extractFile(Main.java:715)
at sun.tools.jar.Main.extract(Main.java:678)
at sun.tools.jar.Main.run(Main.java:191)
at sun.tools.jar.Main.main(Main.java:904)I tried to extract with the following command
jar -xvf xmlsample.jar
My path settings are:
C:\downloads\xml_dynamic_news>path
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.0_01\bin
I have tried to extract on three seperate machines and still get the
same exception.
Can anybody help with my problem? -
Removing the dummy root element
Looks like I created a topic that cannot
be replied to! The topic maintainers will
have to delete it.
After looking at the XMLSample code I realized my mistake... oops!
A quick edit turned off the <root>
containment. Not sure why it's there in
the sample in the first place.
For anyone else who tries this, here's the
change to remove the dummy root element:
The new code in XMLSample.java is:
out.appendChild(result);
instead of:
// create a dummy document element for the
// output document
Element root = out.createElement("root");
out.appendChild(root);
// append the transformed tree to the dummy
// document element
root.appendChild(result);
nullHi,
Please try deleting the xml files corresponding to the dimensions from the backend and try opening the dimension member sheet.
For deleting the XML file follow the workaround in my reply of the below thread,
Re: Master data issue in CV
Hope this helps,
Regards,
G.Vijaya Kumar -
Inconsistent Files in XML Dynamic News Sample Application
The files are on these following sites:
http://otn.oracle.com/sample_code/tech/xml/xmlnews/Readme.html
http://otn.oracle.com/sample_code/tech/xml/xmlnews/install.html
The directory structure described in these 2 sites are not the same.
Customer is stuck on:
http://otn.oracle.com/sample_code/tech/xml/xmlnews/install.html
Extracting the application source code
The application files are stored in an archive named "xmlnews.jar". Download the archive, create a directory for the files
(for example, XMLNEWSDIR), then do the following steps.
Copy the "xmlsample.jar" from your downloaded directory to the XMLNEWSDIR directory
Set the current working directory to XMLNEWSDIR
Execute the following command to extract the files:
jar xvf xmlsample.jar
when extracting the jar drive the directory structure is not the same as in the documentation
Documentation states to extract the xmlsample.jar file which is not included on Oracle website. Can not locate xmlsample.jar - can not run sample application.
Need solving:
1. Which file runs the dynamic new application?
2. Where is the file located?Hi,
apologies for not responding sooner, however this issue is unrelated to the Documentation directory that this forum was created to support.
Please use the Sample Code specific forum at: Sample Code
Regards,
Les -
Generating xml from xsd automated
with jdev i can generate a xml dummy document from some xsd-source. i want to do the same in a java program. is there by any chance a (the) library where i can access such a method? i know about jaxb class generation, but that is not what i need.
thanksi propably didnt make myself clear enough, sorry about that. :)
your link (jaxb):
1. generate java classes (beans)
2. write some code calling all the right setter-methods of the generated classes to fill your xml-object.
what i need:
1. write one method as explained in my earlier posting
2. compile once, use infinitly for many many different xsds without the need for further coding or recompiling.
why jaxb doesn't fulfil my requirements?
1. you have to generate classes for each new xsd you want a xmlsample for.
2. you have to write new code, calling the correct setters of the generated classes. each time you have a different xsd.
Maybe you are looking for
-
Export Address Book using CSV file to Verizon Webmail
I need to export the contents of my address book using a CSV file format which is compatible with Verizon Webmail. Verizon Webmail will not acknowledge any other format other than CSV and reject my attempts to use Mac sys tem formats. Help.... Chan
-
Cant change main enail address
it is not letting me change my main email address as it says the one im changing it to is my rescue address but i have changed my rescue address to a different ine now.. v annoying as the existing main email is not in use anymore !
-
How to manage source for mobile app build by android studio,Git or team explorer?
Hi,We use TFS 2013 for source control ,now we want to start mobile app using "android studio", How could control source of that project,How we can have features of "tfs source control" on that type of project such a mobile app that uses "android stud
-
Como puedo administrar las alarmas y agregar consultas ???
Tengo un Query el cual quiero ponerlo como filtro en una alarma para que de aviso de las cuentas contables pero no se como hacer para usar las alarmas alguien sabe???????
-
Hi, i am having a little trouble in uploading project form MSP to SAP via OPENPS v2.02. i have to manually give wbs numbering in MSP in the "ID" field. how should i work so that system automatically assigns numbering to wbs element on upload. Thanks!