Using a xml parser with jbuilder

I'm using jbuilder and the required librairies I've just added require me to add an XML parser to the path. I've just downloaded one from www.apache.org.
How do I incorporate this parser into my project. I need to use the following packages but I'm not sure how I can put everything together.
If you understand what my problem is please help. Thanks , B.
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;

Go to tools | configure libraries.
click the new button on the left
Type in the name you want the library to be identified with (XML Parser or something)
Choose the location (this determines how many people and projects have access to the libraries)
Click the add button and find the *.jar files.
Ok back out of the dialogs
Now select the Project Properties (or default props to have the library available to all projects, not recommended tho)
Select the paths tab
Click Add and select the Library you added in the earlier steps.
If you have any probs, www.borland.com has heaps of stuff on configuring libraries

Similar Messages

  • HOW TO: Use the XML parser in Oracle 8.1.7

    I am trying to figure out how to use the xml parser provided in oracle 8.1.7. all i want to do is parse a xml report that is defined using a schema, and place the data into the proper tables. i am totally unfamiliar with the xml parser and how it works. i have done some reading on the subject, but seem to be getting some conflicting infromation about which utilites i need and how to invoke them. can someone please tell me what utilities i need, how to invoke them, and what i need to do to get a xml document to parse and insert to a table? I would greatly appreciate any help anybody could offer. thanks.

    You can parse the XML Document with XML Parser and place the data into database using XSU(XML SQL Utility).
    Both of these are included in XDK for Java at:
    http://otn.oracle.com/tech/xml/xdk_java
    The following document could also help:
    Oracle9i XML Developer's Guide--XDK [PDF] at http://otn.oracle.com/tech/xml/doc.html

  • Problem for using oracle xml parser v2 for 8.1.7

    My first posting was messed up. This is re-posting the same question.
    Problem for using oracle xml parser v2 for 8.1.7
    I have a sylesheet with
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">.
    It works fine if I refer this xsl file in xml file as follows:
    <?xml-stylesheet type="text/xsl" href="http://...../GN.xsl"?>.
    When I use this xsl in pl/sql package, I got
    ORA-20100: Error occurred while processing: XSL-1009: Attribute 'xsl:version' not found in 'xsl:stylesheet'.
    After I changed name space definition to
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> in xsl file, I got
    ORA-20100: Error occurred while processing: XSL-1019: Expected ']' instead of '$'.
    I am using xml parser v2 for 8.1.7
    Can anyone explain why it happens? What is the solution?
    Yi

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Element's dont have text content, they [b]contain text node children.
    So instead of trying to setNodeValue() on the element, construct a Text node and use the appendChild method on the element to append the text node as a child of the element.<HR></BLOCKQUOTE>
    Steve,
    We are also creating an XML DOM from java and are having trouble getting the tags created as we want. When we use XMLText it creates the tag as <tagName/>value rather than <tagName>value</tagName>. We want separate open and close tags. Any ideas?
    Lori

  • XML validation using Oracle XML parser v2

    Not sure if this is the right forum for this question as I didn't found any.
    I had a tough time trying to build an XMLSchema (Oracle XML Parser V2) object from the input schema having include/import. Actually I am working on a Java program to validate the input xml with input schema using Oracle XML parser v2 api.
    The issue is that the code doesn't work for schema that has some "include" in it. The code is working fine for the schema without any import/include. Here is the lines of code -
    XSDBuilder builder = new XSDBuilder();
    schema = builder.build(new InputSource(xsdReader));
    I am writing this in JDeveloper. The error is -
    oracle.xml.parser.schema.XSDException: Can not build schema 'http://www.fpml.org/2005/FpML-4-2' located at 'xsd\FpML42\xml\fpml-fx-4-2.xsd'
    I also tried creating the EntityResolver to specify the path of included schema. But that doesn't solves the problem.
    I am not sure whether parser is able to locate the included schema or not.The main schema and included schema are all in same folder. The included schema is perfectly fine and has no errors.
    Please help if you have encountered this issue and resolved it. I will really appreciate any pointers or clue to solve this issue.
    Thanks.

    Thanks for the reply. But it does not seem to be working. Am I missing something
    I put <TrxDate xsi:nil="true"/> but still getting error.
    Here's my xsd:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:element name="TrxDate" type="xsd:date" nillable="true" />
    XML:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ServiceRequest>
    <TrxDate nil="true"/>
    </ServiceRequest>

  • Parsing errors with CDATA tags using oracle xml parser v2

    I'm using the oracle.xml.parser.v2 parser to combine a
    generated xml document from a database with a static
    xsl file to produce html. Within the xml document, there
    are fairly large CDATA sections (500 lines) which happen
    to contain javaScript.
    Occasionally, I'm getting xml tags in the final html
    document! It seems that the oracle parser pukes
    on a certain type of data within a CDATA tag, and then
    replaces an angle bracket (<) of a tag with a #60. This
    can cause html tags being viewed in the document. At
    first, I thought the amount of JavaScript within the
    CDATA tag was too large for the parser to handle,
    because when I split it up into 2 or more parts the errors
    went away. But, re-arranging the JavaScript (String in the CDATA tag)
    can make the errors disappear. And, if I
    use the Saxon parser to manually combine the xsl with
    the xml, the output is fine. If anyone knows that this is
    a confirmed bug by Oracle, or any other relevant info on
    this, please let me know.

    Hi,
    Your lucky, i've just finished a project that used the oracle parser extensively.
    I think the problem may stem from your xsl. Although your cdata tags may be well formed, in the xsl you might need to escape the text again, this may mean that the xsl needs to print a further cdata tag around the data. This is because the parser (well the version I was using) strips the cdata tags before the transformation happens.
    This is the probably the cause of the nasty html output.

  • XML parser with document support

    Hi all,
    For a whole week now, I m still looking for a nice (but lite) XML parser for J2ME applications. Of course I found kXML 2 parser but I'm confused.
    kXML 2 implements the XmlPull API (xmlpull.org) so you can parse easly an XML file with functions as next(), ...
    BUT, I would like to deal with a Document Object Model (DOM) (like JDom for J2SE), with this I will be able to do some nice stuff like doc.getRoot().getElement....
    In kXML2 Javadoc I found something like this but apparently it doesnt work well (or I dont know how to use it).
    Do someone know this API ? http://kxml.sourceforge.net/kxml2/javadoc/
    I can't find any example on Internet, everybody seems to use it without DOM....
    Until someone give me an answer I will continue to use kXML2 without document object model :(
    thanks guys,

    just a search..in http://sourceforge.net/
    http://sourceforge.net/search/?type_of_search=soft&type_of_search=soft&words=dom+j2me

  • XML Parsing with XSL Performance lag

    Hi there
    I should qualify this post by saying I am fairly new to EJB's and have based the below on a Java Working with XML Tutorial I read.
    I have an EJB which is being developed to parse XML documents with an XSL stylesheet and return HTML for display. The code is working fine however there is a fairly hefty performance lag when using the EJB to generate the HTML as opposed to the straight HTML. I am getting an average response time of 95000ms using the EJB as opposed to 45000ms when viewing the straight HTML. The code I am using to do the parsing is :
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(dataFile);
    // Convert docs into StreamSource
    StreamSource stylesource = new StreamSource(styleSheet);
    StreamSource source = new StreamSource(dataFile);
    StringWriter strWrite = new StringWriter();
    StreamResult result = new StreamResult(strWrite);
    // Use a Transformer for output
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(stylesource);
    transformer.transform(source, result);
    There is then some error handling and the strWrite object is placed into an array to be returned.
    I am really looking to find out if the performance lag I am experiencing is normal or if there is anything I can do to improve the speed of the code.
    All comments and help is most appreciated.
    Cheers
    Justin.

    You should be able to increase performance by caching Templates objects in memory as a previous post suggested.
    Here is some untested code:public final class TransformerCache
         private static Map cache = new Vector();
         private TransformerCache(){}
         public static Transformer getTransformer( String filename )
              if( ! cache.containsKey( filename ) )
                   TransformerFactory tf = TransformerFactory.newInstance();
                   Templates template = tf.newTemplates( new StreamSource( filename ) );
                   cache.put( filename, template );     
              return ( ( Templates ) cache.get( filename ) ).newTransformer();
    }This aproach works in a clustered environment, just bear in ming that there will be an instance of the cache on each server instance (virtual machine).

  • Can we use javax.xml.parser API's from j2sdk kit?

    Hi All,
    I am new to this jaxp API's and my first doubt is Can I use the javax.xml.parser API which come bundled with j2sdk-1.4.1 or Should I install JWSDP-1.3 to get to javax.xml.parsers API?
    Thanks

    Hi,
    I am trying to read an xml file on Solaris.
    Can we not use doc.getElementById(String elementID) after deriving doc obejct ?
    Here is the code I am trying to use:
    try
    factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(false);
    File file = new File("/command/parse_doc.xml");
    doc = factory.newDocumentBuilder().parse(file); //upto here it works
    Element element = doc.getElementById("Topics");
    String name = element.getTagName(); //returns nothing but throws exception "null"
    }catch(Exception exe){
    out.println("Exception:" + exe.getMessage());}
    here I get no such element, and the try catch block exception also null.
    Is there something I am missing?
    DO I have to call doc.getDocumentElement() before I call get ElementBy ID() and if so why?
    Thanks.

  • How to use sax xml parser

    hi was wondering if someone could give me an example on how to use sax
    and a document handler and explain a bit

    to use sax parsers you need basically to extends handlerBase wich will force you to have the 3 following methods
    // imports for the sax portion of the manager,
    // the portion that will permit the interpretation of
    import com.sun.xml.parser.Resolver;
    import org.xml.sax.*;
    import org.xml.sax.helpers.ParserFactory;
    public class XMLManager extends HandlerBase
    private String currentElement = null; //current element name for parsing
    * Default constructor
    public XMLManager()
    /*SAX METHODS*/
    * This method is called when the SAX parser encounters an open element
    * tag. Must remember which element tag was just opened (so that the
    * characters(..) method can do something useful with the data that is
    * read by the parser.
    public void startElement(String name,AttributeList atts){
    if( name.equalsIgnoreCase("MY XML TAG NAME") )
    currentElement = "MY XML TAG NAME";
    //then do stuff for that type of tag
    * This method is called when the SAX parser encounters a close element
    * tag. If the message tag is closed it means the message is valid and ready
    * to be treated
    public void endElement(String name){
    currentElement = "";
    * This method is called when the SAX parser encounters #PCDATA or CDATA.
    * It is important to remember which element tag was just opened so that
    * this data can be put in the right object or variable.
    * Also the start index and length integer must be used to retrieve only
    * a portion of the data stored in the char[]
    * This section will only contain treatment for tags wich have content
    * between start and end tags
    public void characters(char ch[],int start,int length){
    //dont read ch[] , use the
    //range provided by the SAX parser.
    String value = new String(ch,start ,length);
    Once you have defined these 3 methods, define a method called for example parseIt(String mss) wich will contain the following code to parse the content of a string mss, a string containing xml data
    try
    //create an InputSource from the XML source received
    StringReader r = new StringReader(mss);
    InputSource is = new InputSource( r );
    //create a SAX parser using SAX interfaces and classes
    String parserClassName = "com.sun.xml.parser.Parser";
    org.xml.sax.Parser parser = org.xml.sax.helpers.ParserFactory.makeParser(parserClassName);
    //create document handler to do something useful
    //with the XML document being parsed by the parser.
    parser.setDocumentHandler(this);
    parser.parse(is);
    catch(Throwable t){System.out.println(t);t.printStackTrace();}
    you can't fail with this ;)

  • XML parsing with SQL/PL-SQL

    Hi,
    My question is about how can an XML message can be best parsed using SQL/PL-SQL.
    The scenario is as follow. The XML message is stored in a CLOB; only some of its data needs to be extracted; there are six different types of structures of XML; the size of each XML is about 50 lines (maximum depth level is 3); the data could be written in English or Greek or French or German or Russian; this is going to be done every hour and the parsing is going to be against 3,000 records approx.
    In the development, I need to take into consideration performance. We are using Oracle 10, but we could migrate to Oracle 11 if necessary.
    Apologies for this basic question but I have never done XML parsing in SQL/PL-SQL before.
    Thank you.
    PS I have copied this question to the XML forum.
    Edited by: user3112983 on May 19, 2010 3:30 PM
    Edited by: user3112983 on May 19, 2010 3:39 PM

    user3112983 wrote:
    The scenario is as follow. The XML message is stored in a CLOB; only some of its data needs to be extracted; there are six different types of structures of XML; the size of each XML is about 50 lines (maximum depth level is 3); the data could be written in English or Greek or French or German or Russian; this is going to be done every hour and the parsing is going to be against 3,000 records approx.Parsing is done using the XMLTYPE data type (object class) in Oracle.
    Something as follows:
    SQL> create table xml_doc( id number, doc clob );
    Table created.
    SQL>
    SQL> insert into xml_doc values( 1, '<root><row><name>John</name></row><row><name>Jack</name></row></root>' );
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> declare
      2          rawXml  xml_doc.doc%type;
      3          xml     xmltype;
      4  begin
      5          -- get the raw XML (as a CLOB)
      6          select doc into rawXml from xml_doc where id = 1;
      7
      8          -- parse it
      9          xml := new xmltype( rawXml );  
    10         -- process the XML...
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    SQL>The variable xml in the sample code is the XML DOM object. XML functions can be used against it (e.g. to extract values in a tabular row and column structure).
    Note that the CLOB needs to contain a valid XML. An XML containing XML fragments is not valid and cannot be parsed. E.g.
    SQL> declare
      2          xml     xmltype;
      3  begin
      4          -- attemp to parse fragments
      5          xml := new xmltype( '<row><name>John</name></row>  <data><column>Name</column></data>' );
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00245: extra data after end of document
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 301
    ORA-06512: at line 5This XML contains 2 fragments. A row structure and a data structure. It is not a valid XML and as such cannot be parsed. If a root tag is used to encapsulate these 2 fragments, then it will be a valid XML structure.
    In the development, I need to take into consideration performance. We are using Oracle 10, but we could migrate to Oracle 11 if necessary.Have not run into any XML performance problems specifically - and am using it extensively. Even large XMLs (10's of 1000's of elements) parse pretty fast.

  • XML parsing with DOM

    I'm using xerces to parse an XML file and am running in to trouble. Do you have to parse child nodes before attributes? I do this in every node except for one called "table" in my parser. However, I have an abstract class called "Table" that is subclassed by Table1D and Table2D, and I need to parse the attributes to know which to instantiate.
    The problem is, I have a child node called scale. For some reason, scale is being parsed as if it were a table.
    Here is a look at my unmarshallTable method. Ignore the lack of exception handling.
    private Table unmarshallTable(Node tableNode) {
         Table table;
            if (unmarshallAttribute(tableNode, "type", "unknown").equals("3D")) {
                table = new Table3D();
            } else if (unmarshallAttribute(tableNode, "type", "unknown").equals("2D")) {
            } else {
                //exception
                return null;
            table.setName(unmarshallAttribute(tableNode, "name", "unknown"));
            if (table.getType().equals("2D")) {           
                ((Table2D)table).setFlipX(Boolean.parseBoolean(unmarshallAttribute(tableNode, "flipx", "unknown")));
         Node n;
         NodeList nodes = tableNode.getChildNodes();
         for (int i = 0; i < nodes.getLength(); i++) {
             n = nodes.item(i);
             if (n.getNodeType() == Node.ELEMENT_NODE) {
              if (tableNode.getNodeName().equals("table")) {
                  if (table.getType().equals("2D")) {
                            if (unmarshallTable(n).getType().equals("Static Y Axis")) {
                                ((Table2D)table).setStaticYAxis((Table1D)unmarshallTable(n));
                        }  else if (table.getType().equals("3D")) {
                            if (unmarshallTable(n).getType().equals("X Axis")) {
                                ((Table3D)table).setXAxis((Table1D)unmarshallTable(n));
                            } else if (unmarshallTable(n).getType().equals("Y Axis")) {
                                ((Table3D)table).setYAxis((Table1D)unmarshallTable(n));
                    } else if (tableNode.getNodeName().equals("scaling")) {
                        table.setScale(unmarshallScale(n));
              } else {
                  // unexpected element in Article
             } else {
              // unexpected node-type in Article
         return table;
        }  

    Doh! I got it.
    if (tableNode.getNodeName().equals("table")) {
    should be
    if (n.getNodeName().equals("table")) {                                                                                                                                                                                                                                   

  • How to "use" a xml file with a script?

    Hey Guys!
    I use the normal Button with the send-option to send the xml file to an url.
    My question is how it's possible to work in a php-script with the xml data out of the formular?
    Thanks for help.
    LG
    Adrian

    Hi,
    I need to read a XML document with StringReade class.
    My aplication receives an absolute path but this
    doesn't work:
    StringReader oStringReader =
    new StringReader(c:\java\libros.xml);
    However it works with:
    StringReader oStringReader =
    new StringReader("<?xml version="1.0" e......");
    ie, with the whole document as a String, but I need
    to do it as the frist way.
    Thankstake a look at this link:
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/2a_echo.html

  • Is it possible to configure CF10 or CF11 to use Xerces XML parser instead of Saxon XML parser?

    Could anyone tell me if it is possible to configure CF10 or CF 11 to use the older Xerces XML parser instead of the Saxon XML parser.
    I am in the process of migrating a website from CF8 to CF11. Several sections rely on XML transformation, which no longer work in CF11. After investigating the problem it seems to be that the Saxon Parser is more strict, causing these errors.

    Well I guess Parsers would be better solution. As u said u need to insert node at specific location.
    so now u have to decide which parser u need to choose according to u r requirmnet. DOM or SAX maily.
    Both has adv and di-advs.
    ...yogesh

  • Use of XML parser to read/parse xml stored in DB as CLOB

    Hello,
    I am new to XML technology. I have xml data stored in DB as
    CLOB. I need to parse this data to retrieve VALUE fro certain
    tags. I would greatly appreciate any help. Any examples that
    manipulate xml data stored in DB can be of extreme help.
    DesiDBA

    As you use Oracle 9.0.1. We suggest you use XMLType instead of
    CLOB to store your XML documents.
    You can use xmlType.extract() to get the elements within the
    XMLDocuments.
    Please refer to our Oracle9i XML Demo for examples.
    http://otn.oracle.com/tech/xml/xdk_sample/xdkdemo_faq.html
    For Instructions:
    http://ws5.olab.oracle.com/faqdemo/source/instruction.xsql?
    pagename=ins_xmltype
    Or you have to do the SQL query to get XML documents and parse
    each document and extract the content yourself using XML Parser
    for PL/SQL.
    Thanks.

  • Libs to link when using C XML parser

    Can anyone explain why this work:
    LIB =-lcore8 -lnls8 -lcore8 -lnls8 -lcore8
    but not this:
    LIB =-lcore8 -lnls8
    It causes link errors.
    They are the libraries distributed with the Oracle C XML parser.
    null

    Thank you for your answer! It is good to know how it works particularly because we have had a lot of problems with this parser.
    null

Maybe you are looking for

  • Error while generation of the Authorization object (

    Hi Gurus, I have created a Authorization object Z_CCTR3 for 0costcenter authorization. but getting following error while generation of the Authorization object (type is Flat authorization) "Error occurred when reading the data from DataStore object Z

  • Account 'Contra account: Acquisition value' could not be found in ASKB

    Hi SAP experts 1. First we have created new asset with reference old assets in As01 2. After that we have transfer all asset from old to new asset with in the company code in the ABUMN  T.code in the month on 01.04.2010 3. After that we have run the

  • Need a List of Files on Application Server WITH "Last Changed Date".

    Experts: I'm currently using FM 'SUBST_GET_FILE_LIST' but it does not return the date which I need because I'm working on something that needs to build an internal table of the files on the server with the oldest file on top (which means I need to so

  • Jpegs 'missing' in edit mode

    Since upgrading to iPhoto 08 I have found a couple of problems. This one is the worst; Some jpegs show when browsing but will not display (their RAW versions will be okay). All of their information is there & their files are in the right place but iP

  • Does anyone know if replacement adaptors for ipod docks are available suitable for latest nano?

    I have just got a replacement ipod and it's the latest 6th gen little square one with a clip on the back. This means it doesn't fit my JBL dock anymore - it's too fat.  JBL say they will send me a new set of adaptors but were uncertain that this new