DocumentBuilderFactory question

Hi to all!
Is it possible to force DocumentBuilderFactory to use default platform implementation? It's neither possible to change system property in applet nor write a file in lib directory.
Thanks

Is it possible to force DocumentBuilderFactory to use
default platform implementation? It's neither possible
to change system property in applet nor write a file
in lib directory.Doesn't it use the default platform implementation by, um, default? Perhaps you meant to ask how to make it use some other implementation?
And you can change a system property in an applet if you sign it.

Similar Messages

  • Contents of META-INF/services/javax.xml.parsers.DocumentBuilderFactory?

    I am currently working on an applet that solves Sudoku puzzles, allowing you to build your own in a Constructor and then solve them in a seperate Solver. To do this, we are implementing the puzzles files as XML documents.
    I have the code completely complied and on the server ( [sudoku.unl.edu|sudoku.unl.edu]) and it runs NEARLY perfectly, however when trying to access the server to save the xml code, the apache error_log presents this message: "File does not exist: classes/META-INF/services
    /javax.xml.parsers.DocumentBuilderFactory"
    Looking at the Java Doc here it says that the program should look for that in the jars. I am unsure of exactly how the applet is interacting with the server, but typing "java -version" yields:
    java version "1.6.0_11"
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)Notably, the code works PERFECTLY in NetBeans, contacting the server using SCP and uploading the file and such, so the code doesn't seem to be the problem, unless I need to direct the DocumentBuilder code somehow. This is the code that I believe is causing the trouble (I have tried to include all relevant imports that are in my code):
    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.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    DocumentBuilderFactory factoryBuilder;
              DocumentBuilder builder;
              Document doc;
              Element docElement;
              try
                   factoryBuilder  = DocumentBuilderFactory.newInstance( );
                   builder = factoryBuilder.newDocumentBuilder();
                   doc = builder.parse( indexLocation );
                   docElement = doc.getDocumentElement();
                   NodeList children = docElement.getChildNodes();          
                   for(int i =0; i < children.getLength(); i++)
                        if(children.item(i).getNodeType() == 1)
                             if((children.item(i).getNodeName()).equals("directory"))
                                  if ((children.item(i).getAttributes().getNamedItem("name").getNodeValue()).equals("UsersInput")) {
                                       Node firstChild = findNodeItem(children.item(i), "Difficulty0.." + this.upperField.getText());
                                       Node secondChild = findNodeItem(firstChild, "Level" + this.levelField.getText());
                                       Node thirdChild = findNodeItem(secondChild, (String)suTypeList.getSelectedItem());
                                       Element newFile = doc.createElement("file");
                                       newFile.setAttribute("name", fileName);                              
                                       thirdChild.appendChild(newFile);                              
                   SshParameters params = new SshParameters("cse.unl.edu", "consystlab","A/tutti");
                // create new Scp instance
                Scp scp = new Scp(params);
                // register event listener
                scp.addListener(this);
                // establish connection
                scp.connect();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   Transformer transformer = tFactory.newTransformer();
                   DOMSource source = new DOMSource(doc);
                   StringWriter sw=new StringWriter();
                   StreamResult result = new StreamResult(sw);
                   transformer.transform(source, result);
                   String xmlString=sw.toString();
                // upload file
                  scp.upload(xmlString.getBytes(), indexPath, "libraryIndex.xml");
                 // disconnect
                scp.disconnect();
              catch (IOException e)
                   System.out.println("IO ERROR7");
                   System.out.println(e);
              catch (TransformerException tranE){
                   tranE.printStackTrace();               
              catch (ParserConfigurationException e)
                   System.out.println("IO ERROR8");
                   System.out.println(e);
              catch (SAXException e)
                   System.out.println("IO ERROR9");
                   System.out.println(e);
              }So my question is, what exactly are the contents of the file in the META-INF/services folder? I have manually created this file in my classes directory, where the program is searching. When I place text in it, it appends the text with .class and searches for that file, but doesn't seem to do anything with the file. I attempted directing it to the "DocumentBuilderFactory.class" file that I extracted from the classes.jar included with the JDK.
    I feel like all I need is this file to contain the correct content and the code will FINALLY work, but I have not been able to find anything out there on it.
    Thank for you for your help, sorry this was such a long message.
    -Jason

    Thanks!
    Thanks for the fast reply. I don't know if I made my point clear.
    I do not want to determine the parser by myself. I want the client system use the default parser, so I do not have the hit of downloading the fairly large parser jar.
    However, I want it not to do an empty request to the server for nothing. This turn around time kills an Applet. I want a fast loading applet!
    I'll go in trial and error mode, when I find the time next week.
    Thanks again, I appreciate it!
    K<o>

  • Another beginner question...

    here is my xml document once again:
    <?xml version='1.0' encoding='utf-8'?>
    <BalancingData>
         <updateInfo>
              <totalClaimsRead>12345678910</totalClaimsRead>
              <claimsDeleted>3888459</claimsDeleted>
         </updateInfo>
    </BalancingData>
    here is my code:
              DocumentBuilder DB  = DocumentBuilderFactory.newInstance().newDocumentBuilder();
              Document Doc           = DB.parse(new File("practice.xml"));
              NodeList NL               = Doc.getElementsByTagName("totalClaimsRead");
              Node node               = NL.item(0);
              NodeList NL1          = node.getChildNodes();
              Node node1               = NL1.item(0);
              String value          = node1.getNodeValue();my question is this: is the above code the ONLY way to get the value of the 'totalClaimsRead' node?
    It seems like there should be an easier/shorter way to get this, the current way seems
    very long and drawn out. this is my first experience working with JAXP, so i may be way
    off base. Please let me know. Any help is appreciated. Thanks

    Sure, you may ask... :-) (however, I may not always answer. LOL)
    Anyway... I don't have a 'real' good answer for your question, I want to
    say it is because the way your XML file is set-up. Let me show you an example...
    <totalClaimsRead>12345678910</totalClaimsRead>
    versus
    <totalClaimsRead total="12345678910"/>
    These 2 are the 'same' the second one where you have the line total="12..."
    is called an attribute. If your XML file is set-up as is, then your nodelist of
    getElementsByTagName("totalClaimsRead") would first be
    the 'totalClaimsRead', with a child node->and the value would be 1234...
    If you do the second method, your getElementsByTagName() would return
    only 1 node. item(0) but it would have an attribute (hasAttribute() returns true)
    you would then have to get the attribute, take it apart, look at the name/value.
    It might help your understanding if you can also print out/look at the nodeType
    (getNodeType()) and examine the javadocs for org.w3c.dom for Node.
    Hope this isn't as confusing as I made it out to be. Sometimes I just ramble on and on and on and on....

  • XML SCHEMA validation question

    i'm using jdk 1.4.2 and am trying to validate an xml document against an xml schema. i don't have any packages like xerces or apache and am trying to avoid having to use them. i've had a look at the jdk 1.5 api documentation, and it seems to have some new classes dedicated to xml validation using schemas that 1.4.2 does not have (e.g. the Schema class). my question is, is it possible to do xml validation against a schema only using jdk 1.4.2 and without the likes of the xerces and apache parser packages?
    any help much appreciated, thanks

    The tutorial on Schema Validation parses/validates with the SAXParserFactory. J2sdk 1.4.2 JAXP has an error in the implementation of the SAXParserFactory. Parse/validate with the DocumentBuilderFactory instead of the SAXParserFactory.
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX9.html

  • Do Apache servers not like DocumentBuilderFactory ?

    An exciting problem for all java geeks !
    Here is a very simple "Hello World" applet initializing a dumy instance of the DocumentBuilderFactory class: (XML DOM parser)
    // DBFBugApt.java
    import java.applet.Applet ;
    import java.awt.* ;
    import javax.xml.parsers.*;
    public class DBFBugApt extends Applet {
       public void init() {
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // May fail on some servers !
       public void paint (Graphics g)  {
            g.drawString("Hello world !", 25, 75);
    }Here is the listing of the DBFBugApt.html file displaying this applet:
    <html>
    <head>
    <title>DocumentBuilderFactory bug ?</title>
    </head>
    <body>
    <p>DBFBugApt says: (may fail when hosted on some servers !)</p>
    <p>
    <applet code="DBFBugApt.class" width="250" height="100">
    </applet>
    </p>
    </body>
    </html>This applet has been compiled with JDK 1.5.0_01 and deployed here: http://www.culand.ch/dev/DBFBugApt.html
    As you can see, it works fine displaying "Hello World !" as expected...
    The same DBFBugApt.class and DBFBugApt.html files have then been installed here: http://www.freewebs.com/softquipeut/DBFBugApt.html
    And surprise: this alternate deployment fail to initialise ! The applet throws a NoClassDefFoundError error during its initialisation on the following statement: DocumentBuilderFactory.newInstance();Find hereafter the java console log:
    java.lang.NoClassDefFoundError: IllegalName: <HTML><title>FreeWebs - Page Not Found</title>
         at java.lang.ClassLoader.preDefineClass(Unknown Source)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
         at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
         at javax.xml.parsers.FactoryFinder.find(Unknown Source)
         at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
         at DBFBugApt.init(DBFBugApt.java:13)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    The question I'm trying to answer for one week without getting any logical explanation is WHY ???
    The most remarkable difference between this two hosting web servers is the following:
    My personal web site http://www.culand.ch is hosted on a Cobalt web server while www.freewebs.com sites are hosted on Apache servers.
    For different reasons, I suspect all Apache web servers not to support hosting applets performing such DocumentBuilderFactory.newInstance() statement.
    Or said differently: JRE 1.5.0_01 implementation of the DocumentBuilderFactory class does not support to be invoked by an applet hosted on an Apache server !!!
    Is that a bug of the JRE 1.5.0_01 or a misconfiguration of the www.freewebs.com Apache web servers ?
    If you have an available Apache Web server, you can help me to decide this by installing this applet on your server and letting me know if it works or not.
    DBFBugApt.class, DBFBugApt.html (and the source file DBGBugApt.java too) can all be downloaded from each of the two given web servers.
    If this is confirmed to be related to the Apache web servers only, and no misconfiguration of the web server can be found, I will report this as a JRE bug to Sun !
    Thank you to help me solving this !
    And I'm offering 10 Dollar Duke reward for a solution because I'm tired of this *@!$%! problem...
    Thanks again to all of you who will answer to this thread.
    P.F. Culand

    The issue is not with the type of server, but with
    the specific configuration of the freewebs server.
    The DBF tries to load a file
    "META-INF/services/javax.xml.parsers.DocumentBuilderFa
    ctory" from the classpath, which, in this case, is
    the directory on your server. The freewebs server
    does not return a HTTP 404 error for a non-existing
    resource like a proper little webserver, but instead
    returns a HTTP 200 and a (human-readable) error page,
    which the DBF tries to parse, resulting in the error.
    Note that this is NOT Apache default behaviour, any
    server can be configured thus, although it violates
    the HTTP protocol.
    2 possible solutions:
    - configure the freewebs server properly
    - pack your app into a jar fileSince the first solution is not in my hand I opted for the 2nd one:
    It seems not to work, but I may have done something wrong in packing my applet into a jar file... (not very experimented in that).
    So here is what I did:
    I made the jar file by executing the following batch file:
    set JavaDir=C:\Program Files\Java\Jdk1.5.0_01\
    set ClassPath=.;%JavaDir%lib\classes.zip;%JavaDir%lib\
    "%JavaDir%bin\jar" cvf DBFBugApt.jar DBFBugApt.classI modified the DBFBugApt.html file by adding an archive attribute to the applet tag that way:
    <html>
    <head>
    <title>DocumentBuilderFactory bug ?</title>
    </head>
    <body>
    <p>DBFBugApt says: (may fail when hosted on some servers !)</p>
    <p>
    <applet archive="DBFBugApt.jar" code="DBFBugApt.class" width="250" height="100">
    </applet>
    </p>
    </body>
    </html>I deleted the old DBFBugApt.class
    I first tried to display the new html file from my local directory with the MSIE browser... It worked.
    I uploaded the new jar and html files on the working Cobalt server on my personal web site: http://www.culand.ch/dev/DBFBugApt.html and deleted the old class file. Then I tested it... It worked.
    Finally I uploaded them the same way on the freewebs server (http://www.freewebs.com/softquipeut/DBFBugApt.html) and deleted the old class file too. Then I tested it... DOES NOT WORK !
    The loading of the applet is much slower than before and in hangs notinited like before... The console log is the following: (exactly the same than before)
    java.lang.NoClassDefFoundError: IllegalName: <HTML><title>FreeWebs - Page Not Found</title>
         at java.lang.ClassLoader.preDefineClass(Unknown Source)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
         at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
         at javax.xml.parsers.FactoryFinder.find(Unknown Source)
         at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
         at DBFBugApt.init(DBFBugApt.java:13)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)Did I make something wrong ?
    Why do you thing that packing the applet into a jar file would solve the problem ?
    Any suggestion ?
    It is driving me to despear...!
    Thanks for your help, the thread stays open.
    P.F. Culand

  • Question on thread safety with Sevlet action method

    I have an application that runs well but seems to have trouble with multiple users and I suspect that there is some thread safety issue involved.
    It is a Struts application and I have all of my execute methods of the Acton classes are all synchronized which I thought would take care of any cross user issues but it does not seem to have done that.
    The Action classes do have some instance variables which may be the problem as well as possibly a few utility string classes with static methods that are not synchornized. I keep some db connection cached in the session object but this should not be shared between users.
    My question is, with the execute method synchronized how or where could I be getting crosstalk between users (each with their own sessions)?
    I was thinking of packaging my Action class as seperate object with the actual Action class just allocate what I need (messages and locale) and pass them through a freshly instantiated "old action class". That should solve any instance variable cross talk.
    I am assuming that any local variables in the execute method would not have any exposure as they should be thread specific and allocated on the runtime stack for that thread call.
    Am I missing anything important?
    Thanks in advance
    ---John Putnam

         * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder}
         * using the currently configured parameters.
        public DocumentBuilder newDocumentBuilder()
            throws ParserConfigurationException
            /** Check that if a Schema has been specified that neither of the schema properties have been set. */
            if (grammar != null && attributes != null) {
                if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_LANGUAGE)) {
                    throw new ParserConfigurationException(
                            SAXMessageFormatter.formatMessage(null,
                            "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_LANGUAGE}));
                else if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_SOURCE)) {
                    throw new ParserConfigurationException(
                            SAXMessageFormatter.formatMessage(null,
                            "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_SOURCE}));               
            try {
                return new DocumentBuilderImpl(this, attributes, features, fSecureProcess);
            } catch (SAXException se) {
                // Handles both SAXNotSupportedException, SAXNotRecognizedException
                throw new ParserConfigurationException(se.getMessage());
        }It appears to be thread-safe. The 'attributes' and 'features' instances variables are hashtables, which are synchronized. Unless you are modifying DocumentBuilderFactory itself in another thread (say, changing whether it is namespace aware), I do not see any issues with a simple call to newDocumentBuilder().
    - Saish

  • Implementing interfaces question

    I have a really vague question about interfaces....can't really figure out how this works...I know that interfaces only have method definitions and the implementing classes should define those methods.
    I am trying to use a DOM parser to parse an XML document. The org.w3c.dom package gives you a list of interfaces like Node, NodeList, Document etc to work on.
    Assume that i have the following code in my class:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse(invoiceXML);
    NodeList itemList = doc.GetElementsByTagName("item");
    Here is what I dont understand...doc is of type Document which is an interface. How can you call the method of an interface directly in the 4th line? I thought we are only supposed to call methods on the implementing class...the problem is I dont see an implementing class here...does the builder.parse(invoiceXML) return a Document interface or an object that implements the Document interface? If 'doc' is actually an object that implements the Document interface then it makes sense here...but then will all the methods be automatically implemented in the object created by the api?

    Here is what I dont understand...doc is of type Document which is an interface. Yes.
    How can you call the method of an interface directly in the 4th line? How? Just like that.
    I thought we are only supposed to call methods on the implementing class...Methods are applied to objects, not classes.
    the problem is I dont see an implementing class here...And you don't need to. Do you need to open up your DVD player and look inside in order to push "play"?
    does the builder.parse(invoiceXML) return a Document interface or an object that implements the Document interface? Methods don't return interfaces. They return references to objects (or primitive values).
    If 'doc' is actually an object that implements the Document interface then it makes sense here...Eureka!
    but then will all the methods be automatically implemented in the object created by the api?"Automatically" is not how to think about it. The Document interface was implemented by some class, the details of which aren't important. What's important is that if you have a reference to an object of type Document, you can apply Document methods to it, according to the API for Document.

  • Database Connection design question

    Hello, I have a design question. Awhile back I needed to create a database connection to SQL Server, so I created a class to do it
    import java.sql.*;
    import java.io.*;
    import java.net.MalformedURLException;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class SQLServerConnection
         private static Connection connection = null;
         public SQLServerConnection(String user, String password, String dbName) throws java.sql.SQLException
              getDBConnection(user, password, dbName);
         public SQLServerConnection(String configFileName) throws java.sql.SQLException
              getDBConnection(configFileName);
         private void getDBConnection(String user, String password, String dbName) throws java.sql.SQLException
             DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
             connection = DriverManager.getConnection(
                  "jdbc:microsoft:sqlserver:" + dbName, user, password);              
         private void getDBConnection(String configFileName) throws java.sql.SQLException
              String user;
              String password;
              String dbName;
              try
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = factory.newDocumentBuilder();
                   Document doc = db.parse(configFileName);
                   doc.getDocumentElement().normalize();
                   // get the configuration information
                   password = getConfigParameter("password", doc);
                   user = getConfigParameter("username", doc);
                   dbName = getConfigParameter("databasename", doc);
                   getDBConnection(user, password, dbName);
              catch (MalformedURLException murle)
                   System.out.println("Unable to connect to: " + configFileName + " -- " + murle);
                   System.exit(1);
              catch (FileNotFoundException fnfe)
                   System.out.println("Configuration file " + configFileName + " not found.");
                   System.exit(1);
              catch (IOException ioe)
                   System.out.println("IOException: " + ioe);
                   System.exit(1);
              catch (javax.xml.parsers.ParserConfigurationException pce)
                   System.out.println ("Parser Configuration Error: " + pce);
              catch (SAXException saxe)
                   System.out.println ("SAXException: " + saxe);
         private String getConfigParameter(String paramName, org.w3c.dom.Document doc)
              NodeList nl = doc.getElementsByTagName(paramName);
              if(nl != null)
                   Node n = null;
                   for (int i = 0; i < nl.getLength(); i++)
                        n = nl.item(i);          
                        if(n.hasChildNodes())
                             NodeList children = n.getChildNodes();
                             return ((Node)children.item(0)).getNodeValue();
              else
                   System.out.println ("nl is null");
              return "";          
         public void setCatalog(String catalogName) throws java.sql.SQLException
              connection.setCatalog(catalogName);
         public Connection getConnection()
              return connection;
         public void closeConnection()
              try
                   connection.close();
              catch(java.sql.SQLException sqle)
                   System.err.println ("SQL Server Connection failed to close: " + sqle);
    }Later on, I needed to do the same thing for MySQL, so I created a class for that, MySQLServerConnection which is exactly the same as above, except for:
    private void getDBConnection(String user, String password, String dbName) throws java.sql.SQLException
              try
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   connection = DriverManager.getConnection(dbName, user, password);     
              catch(java.lang.ClassNotFoundException cnfe)
                   System.out.println (cnfe);
              catch(java.lang.InstantiationException ie)
                   System.out.println (ie);
              catch(java.lang.IllegalAccessException iae)
                   System.out.println (iae);
         }Later, on, I did the same thing with OracleServerConnection. My question is, I know this is probably not optimal code. For example, I didn't originally have a close connection method, so I had to go in and code one for all 3. I'm assuming that an interface would be a good idea so that if I have to code another database connection class I make sure and include all of the appropriate methods. I'm also assuming that it would have been smart to have a master class, maybe something like DatabaseConnection and extended these classes from that. Am I on the right track? Totally offbase?

    @nclow - I will work on trying the Factory Pattern for this over the weekend and post when I finish to see what you think.
    @abillconsl - just to make sure I understand, you're saying that I just try to connect and it will cycle through the different database connection possibilities and connect when it finds the right one? If it fails all 3, log an appropriate message. One question I have about this is, I thought I was being object oriented by separating the different types of db connections (Oracle, SQL Server, MySql) into different classes. Am I missing the point of OOP by what I was/am trying to accomplish? Going overboard? Also, does your way try and connect to all 3 even if I connected to one already?
    Thx, Grantarchy
    Edited by: grantarchy on May 9, 2008 9:50 PM

  • DocumentBuilderFactory and TransformerFactory

    I saw some coding like this:*
    factory = DocumentBuilderFactory.newInstance();
    builder = factory.newDocumentBuilder();
    Document doc = builder.newDocument();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    t.setOutputProperty("encoding","UTF-8");
    t.transform(new DOMSource(doc),new StreamResult(baos)); String xmlString = new String(baos.toByteArray(), "utf8");
    My questions are:*
    1) Does the doc (Document)
    contains the such header as:
    *<?xml version="1.0" ?>*
    2) Must the doc object host an XML string, or it can contain any type string(i.e., not necessarily an XML string)?
    3) What is the purpose of using the transformer to transform the doc as:
    t.transform(new DOMSource(*doc*),new StreamResult(*baos*));
    4) Does the Transformer add the header <?xml version="1.0" ?> to the baos object?
    Thanks
    Scott
    Edited by: scottjsn on Jan 11, 2008 3:58 PM

    I saw some coding like this:*
    factory = DocumentBuilderFactory.newInstance();
    builder = factory.newDocumentBuilder();
    Document doc = builder.newDocument();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    t.setOutputProperty("encoding","UTF-8");
    t.transform(new DOMSource(doc),new StreamResult(baos)); String xmlString = new String(baos.toByteArray(), "utf8");
    My questions are:*
    1) Does the doc (Document)
    contains the such header as:
    *<?xml version="1.0" ?>*
    2) Must the doc object host an XML string, or it can contain any type string(i.e., not necessarily an XML string)?
    3) What is the purpose of using the transformer to transform the doc as:
    t.transform(new DOMSource(*doc*),new StreamResult(*baos*));
    4) Does the Transformer add the header <?xml version="1.0" ?> to the baos object?
    Thanks
    Scott
    Edited by: scottjsn on Jan 11, 2008 3:58 PM

  • Questions on Print Quote report

    Hi,
    I'm fairly new to Oracle Quoting and trying to get familiar with it. I have a few questions and would appreciate if anyone answers them
    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    Thanks and Appreciate your patience
    -PC

    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    I think I posted it in one of the threads2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    Yes, your understanding is correct.3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    No, there is no conc program getting called, you can directly call a report in a browser window, Oracle reports server will execute the report and send the HTTP response to the browser.4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    This is detailed in many threads.Thanks
    Tapash

  • Satellite P300D-10v - Question about warranty

    HI EVERYBODY
    I have these overheating problems with my laptop Satellite P300D-10v.
    I did everything I could do to fix it without any success..
    I get the latest update of the bios from Toshiba. I cleaned my lap with compressed air first and then disassembled it all and cleaned it better.(it was really clean insight though...)
    BUT unfortunately the problem still exists...
    So i made a research on the internet and I found out that most of Toshiba owners have the same exactly problem with their laptop.
    Well i guess this is a Toshiba bug for many years now.
    Its a really nice lap, cool sound (the best in laptop ever) BUT......
    So I wanted to make a question. As i am still under warranty, can i return this laptop and get my money back or change it with a different one????
    If any body knows PLS let me know.
    chears
    Thanks in advance

    Hi
    I have already found you other threads.
    Regarding the warranty question;
    If there is something wrong with the hardware then the ASP in your country should be able to help you.
    The warranty should cover every reparation or replacement.
    But I read that you have disasembled the laptop at your own hand... hmmm if you have disasembled the notebook then your warrany is not valid anymore :(
    I think this should be clear for you that you can lose the warrany if you disasemble the laptop!
    By the way: you have to speak with the notebook dealer where you have purchased this notebook if you want to return the notebook
    The Toshiba ASP can repair and fix the notebook but you will not get money from ASP.
    Greets

  • Question regarding NULL and forms

    Hi all, i have a survey that im working on that will be sent via email.
    I'm having an issue though. if i have a multiple choice question, and the user only selects one of the choices, all the unselected choices return as NULL. is there a way i can filter out anytihng that says "NULL" so it only shows the selected options?
    thanks.
    here is the page that retrieves all the data. thanks
    <body>
    <p>1) Is this your first visit to xxxxxxx? <b><%=request.getParameter("stepone") %></b>
    </p>
    <p> </p>
    <p>2) How did You Learn About xxxxxxx?</p>
    <p><b><%=request.getParameter("steptwoOne") %></b>
      <br>
        <b><%=request.getParameter("steptwoTwo") %></b>
      <br>
        <b><%=request.getParameter("steptwoThree") %></b>
      <br>
        <b><%=request.getParameter("steptwoFour") %></b>
      <br>
        <b><%=request.getParameter("steptwoOther") %></b>
    </p>
    <p> </p>
    <p>3) What was your main reason for visiting xxxxx?</p>
    <p><b><%=request.getParameter("stepthreeOne") %></b>
        <br>
          <b><%=request.getParameter("stepthreeTwo") %></b>
        <br>
          <b><%=request.getParameter("stepthreeThree") %></b>
        <br>
          <b><%=request.getParameter("stepthreeFour") %></b>
        <br>
          <b><%=request.getParameter("stepthreeOther") %></b>
    </p>
    <p>4) did you find the information you were looking for on this site?</p>
    <p><b><%=request.getParameter("stepfour") %>
    <br>
    <b><%=request.getParameter("stepfourOther") %></b>
    </b></p>
    <p>5) Do you plan on using this website in the future?</p>
    <p><b><%=request.getParameter("stepfive") %></b></p>
    <p>6) What is your gender</p>
    <p><b><%=request.getParameter("stepsix") %></b></p>
    <p>7) What is your age group</p>
    <p><b><%=request.getParameter("stepseven") %></b></p>
    8) Would you like to take a moment and tell us how we can improve your experience on xxxxxxxxxx?
    <p><b><%=request.getParameter("stepeightFeedback") %></b></p>

    i was messing around and came up with this. it doesnt remove the null, but if it is null it adds ABC beside it. so i think i might be getting close. i just need to figure out how to replace the null.
    code]
    <b><%=request.getParameter("steptwoFour") %></b>
         <% if (request.getParameter("steptwoFour") == null ) {
         %>
         <% out.print("abc"); %>
         <% }
         %>

  • Anyone know how to remove Overdrive books from my iphone that have been transferred from my computer? They do not show up on itunes. I see a lot of answers to this question but they all are based on being able to see the books in iTunes.

    How do I remove Overdrive books from the library that were downloaded onto my computer then transferred to my iphone? The problem is that they do not show up in iTunes.
    I see this question asked a lot when I google, but they always give answers that assumes you can find the books in iTunes either under the books tab, or the audio books tab or in the music. They do not show up anywhere for me. They do not remove from the app like the ones I downloaded directly onto my iphone.the related archived article does not answer it either.  I even asked a guy working at an apple store and he could not help either.   Anybody...?
    Thanks!

    there is an app called daisydisk on mac app store which will help you see exactly where the memory is focused and consumed try using that app and see which folders are using more memory

  • Basic question

    Hello, i have a basic question. if i have defined 2 fields in a cube or a dso:
    Name Quantity
    and from the external flat file i get some characters for my quantity field. would my load fail?  for standard dso and for write optimized?
    NOTE: quantity field is a keyfigure defined as numeric.
    and the load coming in has "VIKPATEL" for Quantity field and not numbers.
    thanks

    Hi Vik,
    Yes, the load will fail.
    May be you coud first load this data into BW (into PSA) and set both fields as characters fields. Then you can create DSO, do transformation from this PSA to the DSO, and put your logic as to what do you want to do with those Quantity that is not number (e.g. convert to 0, or 'Not assgined', etc).
    You can use transfer rule, or a clean up ABAP code in the start routine.
    Hope this helps.

  • Mid 2010 15" i5 Battery Calibration Questions

    Hi, I have a mid 2010 15" MacBook Pro 2.4GHz i5.
    Question 1: I didn't calibrate my battery when I first got my MacBook Pro (it didn't say in the manual that I had to). I've had it for about a month and am doing a calibration today, is that okay? I hope I haven't damaged my battery? The calibration is only to help the battery meter provide an accurate reading of how much life it has remaining, right?
    Question 2: After reading Apple's calibration guide, I decided to set the MacBook Pro to never go to sleep (in Energy Saver System Preference) and leave it on overnight so it would run out of power and go to sleep, then I'd leave it in that state for at least 5 hours before charging it. When I woke up, the light on the front wasn't illuminated. It usually pulsates when in Sleep. Expectedly, it wouldn't wake when pressing buttons on the keyboard. So, what's happened? Is this Safe Sleep? I didn't see any "Your Mac is on reserve battery and will shut down" dialogues or anything similar, as I was asleep! I've left it in this state while I'm at work and will charge it this afternoon. Was my described method okay for calibration or should I have done something different?
    Question 3: Does it matter how quickly you drain your battery when doing a calibration? i.e is it okay to drain it quickly (by running HD video, Photo Booth with effects etc) or slowly (by leaving it idle or running light apps)?
    Thanks.
    Message was edited by: Fresh J

    Fresh J:
    A1. You're fine calibrating the battery now. You might have gotten more accurate readings during the first month if you'd done it sooner, but no harm has been done.
    A2. Your machine has NOT shut down; it has done exactly what it was supposed to do. When the power became critically low, it first wrote the contents of RAM to the hard drive, then went to sleep. When the battery was completely drained some time later, the MBP went into hibernation and the slepp light stopped pulsing and turned off. In that state the machine was using no power at all, but the contents of your RAM were still saved. Once the AC adapter was connected, a press of the power button would cause those contents to be reloaded, and the machine would pick up again exactly where you left off. It is not necessary to wait for the battery to be fully charged before using the machine on AC power, but do leave the AC adapter connected for at least two hours after the battery is fully charged. Nothing that you say you've done was wrong, and nothing that you say has happened was wrong.
    A3. No, it does not matter.

Maybe you are looking for

  • Sap Scripts-printing the text in a single line

    In Sap Scripts I would like to have my text in a single line. For that I have used the extended line (=) tag. But It is not working. Can anyone help me how can I achieve this. Actually how many characters I can put in a single line. I think it is 72.

  • The name of the security certificate is invalid or does not match the name of the site error?

    I am looking for some help folks. We are in a Outlook 2007/Exchange2010/Windows2008R2 environment. When users open Outlook off the network, and occasionally on the network, they get the error The name of the security certificate is invalid or does no

  • Volume erase failed: Media kit reports not enough space on device

    I was having problems with the external drive where I store my Time Machine backups, so I tried plugging and unplugging the drive (per earlier advice, and something that had worked in the past), but could not mount the drive. I ran Disk Utility and t

  • Retrieving Contact List

    My three year old Samsung Knack just crashed, it will not power up or boot up.  I went to a Wireless Zone store and purchased a Motorola Barrage because I seek just a basic phone.  My problem is that I am not able to download or retrieve my contact l

  • Function module CS_BOM_EXPL_MAT_V2 Documentation

    I cannot find any documentation for function module CS_BOM_EXPL_MAT_V2.  It is a very powerful function module, however, it is not useful without documentation.  I know that it can do single level boms as well as multi level and a host of other thing