SAX parser doesn't report IDREF type

I have been trying to create my first DTD:
<!ELEMENT Network (Node+, Link*)>
<!ELEMENT Node EMPTY>
<!ATTLIST Node
ID ID #REQUIRED
title CDATA #IMPLIED>
<!ELEMENT Link EMPTY>
<!ATTLIST Link
source IDREF #REQUIRED
dest IDREF #REQUIRED
title CDATA #IMPLIED>
and would expect that the source and dest attributes of the
Link element would have the type IDREF when being parsed with
the SAX parser. Using the SAXSample.java provided I get the
following output for a test network:
StartElement:Network
IgnorableWhiteSpace
StartElement:Node
ID(ID)=node1
title(CDATA)=test node
EndElement:Node
IgnorableWhiteSpace
StartElement:Node
ID(ID)=node2
title(CDATA)=another node
EndElement:Node
IgnorableWhiteSpace
StartElement:Link
source(CDATA)=node2
dest(CDATA)=node1
EndElement:Link
IgnorableWhiteSpace
StartElement:Link
source(CDATA)=node1
dest(CDATA)=node2
EndElement:Link
IgnorableWhiteSpace
EndElement:Network
This clearly shows source and dest reported as CDATA type. Not
exactly what's in the DTD.
Is this an undocumented feature (a.k.a. bug?)
Regards,
Gary Howard.
Smart Network Technology,
Nortel Networks, UK
null

Thanks for the replies, but I don't think we are quite connecting. I do eventually want to be able to validate an XML file against a schema (which I can't do either), but first I want to be able to validate the schema file itself; i.e. to confirm that the schema I designed is a valid schema file. As I understand it, it should be possible to tell the parser that the schema to validate against is the "schema for writing schemas", http://www.w3.org/Schema/schema.xsd (or whatever it is). That's where I'm getting stuck, that the parser doesn't recognize the elements for actually defining a schema.

Similar Messages

  • JDBC receiver adapter - Error processing request in sax parser

    Hello,
    I want to INSERT idoc data via JDBC adapter into a MS SQL database. After digging through SAP Help, numerous blogs and forum discussions on SDN and even posting an OSS message I still get the same error:
    'Error: TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)'
    When testing my mapping in the Integration Repository the resulting XML message is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Employee xmlns:ns0="http://prodrive.nl/xi/HRMasterdata/HRMD_A_2_d_bcommerp">
       <STATEMENT>
          <T_PD_Employees action="INSERT">
             <access>
                <KeyTag>00088888</KeyTag>
                <PerNo>00088888</PerNo>
             </access>
          </T_PD_Employees>
       </STATEMENT>
    </ns0:Employee>
    The connection to the database is fine, Sender adapter with a SELECT * works perfect.
    Can anyone help me solve this problem? I'm lost.
    Best regards,
    Roelof Jan Bouwknegt

    Hi Bhavesh,
    I have tried out the change you suggested. Without success. Message I get back is
    - 2006-12-28 10:34:08 CET: Error: TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)
    structure in testtool:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Employee xmlns:ns0="http://prodrive.nl/xi/HRMasterdata/HRMD_A_2_d_bcommerp">
       <STATEMENT>
          <T_PD_Employees action="INSERT">
             <ACCESS>
                <KEYTAG>00088888</KEYTAG>
                <PERNO>00088888</PERNO>
             </ACCESS>
          </T_PD_Employees>
       </STATEMENT>
    </ns0:Employee>
    Somehow the SAX  parser doesn't like the result of my mapping. Maybe there is something wrong with the structure cardinality. Let me describe what I have built:
    XSD:
    WA_T_PD_Employees - Complex Type
    > STATEMENT - Element - Occurence = 1
    >> T_PD_Employees - Element - Occurence = 1
    >>> STATEMENT - Attribute - Occurence = optional
    >>> access - Element - Occurence = 1..Unbounded
    Best regards Roelof Jan and thanks for your quick response

  • Fatal error XML-0121 in a valid XML file in v2 of SAX parser

    Attachments: "1|type=text/plain|desc=Logging of Fatal error using v2 of SAX parser |file=v2_loggin
    .txt|";"2|type=text/plain|desc=Logging of Fatal error using v2 of java SAX parser |17078|file=v2_l
    gging.txt|"
    Dear XML team,
    I am using the SAX parser version 2.0.2.4. When parsing a valid
    XML of approx. 3,5 Megabytes i get a fatal error XML-0121
    saying 'End tag does not match start tag
    <CORRESPONDENTIENAAM1>...'
    We checked the xml on the well formedness with tools like XML
    Spy and IE5. The XML is valid!
    We did some testing on the XML with the SAXSample class and we
    noticed that the error is related to the use of Entity
    References. When we removed the Entity Reference &apos; the XML
    was parsed correctly.
    We also noticed that if we cut the XML in two smaller parts it
    was also parsed correctly.
    I attached the output of the parser, as well as the output of
    the SAXSample class.
    I hope you can fix this problem!
    With kind regards,
    Rolf van Deursen.
    null

    Update: I have attempted to use xmlparserv2.jar dated 12/23/08 that is packaged with jDeveloper 11g preview, but am still receiving the same message.

  • Report Result error Sax parser returned an exception

    Hi,
    I'm using Oracle Business Intelligence 10.1.3.4.2.
    Recently I changed the BI instance to another server. So that I copied the reports from Old server to New server.
    Reports are working fine in new server. But while trying to modify that reports it is showing error
    "Sax parser returned an exception. Message: Invalid character (Unicode: 0x13), Entity publicId: , Entity systemId: , Line number: 1, Column number: 10737"
    Error Codes: UH6MBRBC:E6MUPJPH
    Regards,
    Satya

    Hi Satya,
    I am facing the same issue. but I am facing this issue with Mozilla Firefox browser only. If I modify same reports in internet explorer I don't get this error.  It seems this issue is with OBIEE 10g version only and Oracle has provided some patches on this in OBIEE 11g .
    You have posted this question long back. If you have got any solution for this then please let me know also.
    Thanks

  • Getting characters in a particular xml tag type during Sax parsing.

    How do I get the text within a certain XML tag using the parser. I can use the parser which will get me all the text in all the tags, but how do I get the ones I need only.
    For example:
    <channel id="south-east.bbc1.bbc.co.uk">
        <display-name lang="en">BBC1</display-name>
        <display-name>1</display-name>
      </channel>
      <programme start="20040217233500" stop="20040218000500 +0000" channel="south-east.bbc1.bbc.co.uk">
        <title lang="en">Film 2004 with Jonathan Ross</title>
      </programme>how do I get the text 'Film 2004 with Jonathan Ross' without getting the others?

    Well, the SAX parser just gives you the start/end tag
    information to a handler, right? So if you just use
    the SAX parser to get one item, then you could do it
    by running thru the entire XML file to get that item
    then get another item. Clearly this isn't the best
    way to do it.... The handler should put the data for
    the whole document into some data structure, or use
    DocumentBuilder to get a Document object. I see. Yes, that is not the way to use SAX. It's kind of an inside out way of doing things. If you using SAX you should know everything that you want before parsing and grab all of them in one fell swoop.
    If you want to get an in memory representation, the JDOM package is a whole lot eaiser to use than DOM.

  • SAX Parser ClassCastException

    Guidance on the issue described below would be appreciated.
    Product Oracle Containers for J2EE Product Version 10.0.3
    Platform Microsoft Windows
    HOW TO OVERRIDE PARSER IN 10.0.3 OAS 10G PREVIEW 2
    ### Provide the full build number for the OC4J version that you are running: ###
    Oracle Application Server Containers for J2EE 10g (10.0.3.0.0) - Developer
    Preview (build 040227.1923)
    ### Which type of OC4J installation are you running? ###
    standalone OC4J installation (from zip file)
    ### If this OC4J instance is 'standalone', where was it installed? ###
    it's own dedicated ORACLE_HOME
    ### Provide the exact text and location for any error seen in a log file: ###
    java
    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
    -Djavax.xml.parsers.TransformerFactory=org.apache.xalan.processor.TransformerFac
    toryImpl
    -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerF
    actoryImpl -Dorg.dom4j.verbose=true -DCRN_ROOT=f:\cognos\crn -jar oc4j.jar
    04/03/23 10:51:25 Node started with id=68984609063434
    04/03/23 10:51:44 log4j:WARN LogFileWatchdog: shutDownHierarchy
    04/03/23 10:51:44 log4j:WARN LogIPFControl - Unknown error during initialize
    04/03/23 10:51:44 log4j: Setting IPF internal debugging to true
    04/03/23 10:51:45 log4j:WARN No appenders could be found for logger
    (Audit.RTUsage.CAM.CRP.jcam).
    04/03/23 10:51:45 log4j:WARN Please initialize the log4j system properly.
    04/03/23 10:51:46 log4j: Log Server Port is: 9362
    04/03/23 10:51:46 log4j: Encoding set to: false
    04/03/23 10:51:46 log4j: Number of Server Worker Threads is: 10
    04/03/23 10:51:46 log4j: Encoding set to: false
    04/03/23 10:51:46 log4j: Relative file path set to:
    F:/cognos/crn/logs/crnserver.log
    04/03/23 10:51:46 log4j: Exception encountered while trying to convert
    configuration document into W3C Document.
    04/03/23 10:51:46 log4j:ERROR null
    04/03/23 10:51:47 Warning: Caught exception attempting to use JAXP to load a
    SAX XMLReader
    04/03/23 10:51:47 Warning: Exception was: java.lang.ClassCastException
    04/03/23 10:51:47 Warning: I will print the stack trace then carry on using the
    default SAX parser
    04/03/23 10:51:47 java.lang.ClassCastException
    04/03/23 10:51:47 at
    javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
    04/03/23 10:51:47 at
    org.dom4j.io.JAXPHelper.createXMLReader(JAXPHelper.java:34)
    04/03/23 10:51:47 at
    org.dom4j.io.SAXHelper.createXMLReaderViaJAXP(SAXHelper.java:80)
    04/03/23 10:51:47 at
    org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:49)
    04/03/23 10:51:47 at
    org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:528)
    04/03/23 10:51:47 at
    org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:411)
    04/03/23 10:51:47 at org.dom4j.io.SAXReader.read(SAXReader.java:277)
    04/03/23 10:51:47 at org.dom4j.io.SAXReader.read(SAXReader.java:201)
    04/03/23 10:51:47 at org.dom4j.io.SAXReader.read(SAXReader.java:190)
    04/03/23 10:51:47 at
    com.cognos.cclcfgapi.CCLStartupConfiguration.getConfigDoc
    (CCLStartupConfiguration.java:253)
    04/03/23 10:51:47 at
    com.cognos.cclcfgapi.CCLStartupConfiguration.getStartupConfigurationDocumen
    t(CCLStartupConfiguration.java:136)
    04/03/23 10:51:47 at
    com.cognos.cclcfgapi.CCLStartupConfiguration.getStartupConfigurationDocument
    (CCLStartupConfiguration.java:112)
    04/03/23 10:51:47 at
    com.cognos.cclcfgapi.CCLConfiguration.init(CCLConfiguration.java:209)
    04/03/23 10:51:47 at
    com.cognos.pogo.config.ConfigurationImpl.reconfigure(ConfigurationImpl.java:43)
    04/03/23 10:51:47 at
    com.cognos.pogo.services.DispatcherServices.startInititalServices(DispatcherServ
    ices.java:394)
    04/03/23 10:51:47 at
    com.cognos.pogo.transport.PogoServlet$PogoStartup.run(PogoServlet.java:499)
    04/03/23 10:51:47 at java.lang.Thread.run(Unknown Source)
    04/03/23 10:51:48 Oracle Application Server Containers for J2EE 10g
    (10.0.3.0.0) - Developer Preview initialized
    ### Describe in detail the problem you are having: ###
    Trying to override the parser used by our application and getting the error
    above in the console. I also have <web-app-class-loader
    search-local-classes-first="true" include-war-manifest-class-path="true" />
    set in the orion-web.xml for our application.
    I've tried various options on the command line, this seems to get the furthest
    but our app doesn't start.

    Thanks, I did try that as well.....
    E:\o10g\j2ee\home>java -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Dorg.xml.sax.driver=
    org.apache.xerces.parsers.SAXParser -Djavax.xml.parsers.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
    -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl -Xbootclasspath/a:e:\o10g\dom4j-1.
    4\dom4f-1.4\lib\tool\xerces.jar -DCRN_ROOT=f:\cognos\crn -jar oc4j.jar
    04/03/25 07:50:28 Node started with id=68984609063434
    04/03/25 07:50:35 setting transaction-timeout to:30000
    04/03/25 07:50:48 log4j:WARN LogFileWatchdog: shutDownHierarchy
    04/03/25 07:50:48 log4j:WARN LogIPFControl - Unknown error during initialize
    04/03/25 07:50:48 log4j: Setting IPF internal debugging to true
    04/03/25 07:50:49 log4j:WARN No appenders could be found for logger (Audit.RTUsage.CAM.CRP.jcam).
    04/03/25 07:50:49 log4j:WARN Please initialize the log4j system properly.
    04/03/25 07:50:50 log4j: Log Server Port is: 9362
    04/03/25 07:50:50 log4j: Encoding set to: false
    04/03/25 07:50:50 log4j: Number of Server Worker Threads is: 10
    04/03/25 07:50:50 log4j: Encoding set to: false
    04/03/25 07:50:50 log4j: Relative file path set to: F:/cognos/crn/logs/crnserver.log
    04/03/25 07:50:50 log4j: Exception encountered while trying to convert configuration document into W3C Document.
    04/03/25 07:50:50 log4j:ERROR null
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-7 JVM used memory: 8699568
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-8 JVM used memory: 8837624
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-9 JVM used memory: 8838480
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-10 JVM used memory: 8839536
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-11 JVM used memory: 8840392
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-12 JVM used memory: 8841248
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-13 JVM used memory: 8842304
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-14 JVM used memory: 8843160
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-15 JVM used memory: 8844016
    04/03/25 07:50:50 log4j: ***** Thread begin: Thread-16 JVM used memory: 8845072
    04/03/25 07:50:51 Warning: Error occurred using JAXP to load a SAXParser. Will use Aelfred instead
    04/03/25 07:50:52 Oracle Application Server Containers for J2EE 10g (10.0.3.0.0) - Developer Preview initialized

  • OBIEE Sax Parser Error in Firefox only?

    I was working on a report in Answers and came across the following error when trying to "Display" the results
    Sax parser returned an exception. Message: An exception occurred! Type:UnexpectedEOFException, Message:The end of input was not expected, Entity publicId: , Entity systemId: , Line number: 1, Column number: 1862
    The report, when viewed on a dashboard works perfectly fine, its ONLY when I try to "Display" the results in Answers I hit the above error.
    The interesting thing also is that I tried Internet Explorer, Google Chrome and Firefox
    ONLY Firefox is throwing this error.
    I am using the latest version of Firefox (ver 22)
    OBIEE is version 10.1.3.4.0
    Again, everything with the report works just great its just when I try to display the results in answers that it throws an error.

    I think my issue just got worse
    Now when I log into Answers and try to view the report I see the following error
    State: HY000. Code: 1736874543. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27005] Unresolved column
    The biggest issue I am noticing now is that my column names are actually changing!
    So when I first log into the report in Answers I see the columns being used are
    Type Animal
    Type Tree
    I click on "Display Results" which yields the above error
    Now when I click back to the columns view, the column names have changed to the following
    Adjusted Animal = Type
    High Yield Tree = Type
    The column names have totally changed
    I am now guessing there may be an error some where in the RPD, between the physical/presentation and business model layer.
    Any insight would be greatly appreciated!

  • I need help using a SAX parser

    Hello,
    I have a class that goes out to the web and retrieves an xml document w/o ever writing it to disk. I like to parse that object using SAX and a class that extends HandlerBase. Can any one show me how to parse an xml document that lives in memory rather than in a file? I've found many examples, but all of them assume you are reading from a file system. Any help is greatly appreciated.
    Here is the jist of my code :
    // Class 1 makes a request to another server based on some variable data. I've created a messenger object that handles all of the communications and returns the data in a DataInputStream
    XMLMessage xml = new XMLMessage();
    xml.createRequest(args[0],args[1],args[2]);
    XMLMessenger messenger = new XMLMessenger(xml.getDoc());
    DataInputStream dis = messenger.transferDocument();
    ResponseObj resp = new ResponseObj();
    resp.read(dis);
    System.out.println(resp.getvalue1() + "*" + resp.getvalue2()+ "*");
    // Class 2 is the ResponseObj and I want to use something similar to this read method, but
    // I can't get it to work with a data stream, instead of a string that represents a file.
    public void read(String filename) throws java.lang.Exception {
    Class c = Class.forName("com.ibm.xml.parser.SAXDriver");
         org.xml.sax.Parser parser = (org.xml.sax.Parser)c.newInstance();
         parser.setDocumentHandler(this);
         parser.parse(filename);

    Thanks for you help. I've modified my read() method to work like this :
    org.xml.sax.Parser parser = new com.ibm.xml.parser.SAXDriver();
    parser.setDocumentHandler(this);
    InputSource is = new InputSource(dis);
    parser.parse(is);
    This makes sense, but I'm still not getting any thing returned from the startElement(),characters(), or endElement() methods. It reports no errors, it just doesn't happen. Do you have any suggestions on how to debug this? I'm stumped, but really need to get this working.

  • Parser doesn't recognize schema namespace

    I've got the following bit of code:
                    org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
                    parser.setFeature("http://xml.org/sax/features/namespaces", true);
                    parser.setFeature("http://apache.org/xml/features/validation/schema", true);
                    parser.setFeature( "http://xml.org/sax/features/validation", true);
                    ErrorHandler handler = new MyErrorHandler();
                    parser.setErrorHandler(handler);
                    parser.parse(name);The schema file I want it to parse (and validate) is below. Its a simple example taken from the w3schools web site. I have almost no doubt the file is a valid schema file.
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.w3schools.com"
    xmlns="http://www.w3schools.com"
    elementFormDefault="qualified">
    <xs:element name="note">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="to" type="xs:string"/>
            <xs:element name="from" type="xs:string"/>
            <xs:element name="heading" type="xs:string"/>
            <xs:element name="body" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
    </xs:element>
    </xs:schema>Below are the first few errors generated. The real head scratcher is having no clue about the URI I gave it, and then suggesting the SAME one as what I really should use. Getting these parsers setup to do validation has been a major pain. Anyone know what I left out?
    Error at 5 : org.xml.sax.SAXParseException: General Schema Error: Grammar with uri: http://www.w3.org/2001/XMLSchema , can not be found; schema namespace may be wrong: Xerces supports schemas from the "http://www.w3.org/2001/XMLSchema" namespace or the instance document's namespace may not match the targetNamespace of the schema.
    Error at 5 : org.xml.sax.SAXParseException: Element type "xs:schema" must be declared.
    Error at 7 : org.xml.sax.SAXParseException: Element type "xs:element" must be declared.

    Thanks for the replies, but I don't think we are quite connecting. I do eventually want to be able to validate an XML file against a schema (which I can't do either), but first I want to be able to validate the schema file itself; i.e. to confirm that the schema I designed is a valid schema file. As I understand it, it should be possible to tell the parser that the schema to validate against is the "schema for writing schemas", http://www.w3.org/Schema/schema.xsd (or whatever it is). That's where I'm getting stuck, that the parser doesn't recognize the elements for actually defining a schema.

  • SAX parsing and loops problem

    Hi!
    I currently have an XML file which looks like this:
    <jel>
    <admin creation="Fri Nov 09 17:14:55 GMT 2007" xsdversion="1.0.0" version="1.0.0"/>
    &#8722;
         <jelclass superclass="Object" visibility="public" package="" superclassfulltype="java.lang.Object" fulltype="Player" type="Player">
    &#8722;
         <implements>
    <interface fulltype="java.awt.event.ActionListener" type="ActionListener"/>
    <interface fulltype="java.awt.event.KeyListener" type="KeyListener"/>
    </implements>
    &#8722;
         <methods>
    &#8722;
         <constructor visibility="public" name="Player">
    &#8722;
         <params>
    <param name="newProtocol" fulltype="NewProtocol" type="NewProtocol"/>
    <param name="x" fulltype="int" type="int"/>
    <param name="y" fulltype="int" type="int"/>
    </params>
    </constructor>
    &#8722;
         <method visibility="public" name="actionPerformed" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.ActionEvent" type="ActionEvent"/>
    </params>
    </method>
    &#8722;
         <method visibility="public" name="keyPressed" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.KeyEvent" type="KeyEvent"/>
    </params>
    </method>
    &#8722;
         <method visibility="public" name="keyReleased" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.KeyEvent" type="KeyEvent"/>
    </params>
    </method>
    &#8722;
         <method visibility="public" name="keyTyped" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.KeyEvent" type="KeyEvent"/>
    </params>
    </method>
    <method visibility="public" name="getX" fulltype="int" type="int"/>
    &#8722;
         <method visibility="public" name="setX" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="x" fulltype="int" type="int"/>
    </params>
    </method>
    <method visibility="public" name="getY" fulltype="int" type="int"/>
    &#8722;
         <method visibility="public" name="setY" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="y" fulltype="int" type="int"/>
    </params>
    </method>
    </methods>
    </jelclass>And I have SAX parsing code that looks like this:
    public class SaxParser{
          private HashSet <String>packageSet = new HashSet<String>();
          private ArrayList <String> classList = new ArrayList<String>();
          private ArrayList <String> packageList = new ArrayList<String>();
          private ArrayList <String> methodList = new ArrayList<String>();
          private Object[] packageNames;
          private HashMap <String, ArrayList> h = new HashMap <String, ArrayList>();
          public SaxParser()throws Exception{
              String fname = "eclipse/jel.xml";
             DefaultHandler handler = new DefaultHandler()
                 private int numberOfClasses = 0;
             public void startElement(String namespaceURI,String localName, String qname, Attributes attrs)
                  if(qname.equals("jelclass")) {
                       numberOfClasses ++;
                  for(int i = 0; i< attrs.getLength();i++){
                        if(attrs.getQName(i).equals("type")){
                             classList.add(attrs.getValue(i));
                             if(attrs.getQName(i).equals("package")){
                                  packageList.add(attrs.getValue(i));
                                  packageSet.add(attrs.getValue(i));
                  for(int i = 0; i< attrs.getLength();i++){
                       for(int j = 0; j < classList.size(); j++){
              if(attrs.getQName(i).equals("type") && attrs.getValue(i).equals(classList.get(j))){
                  if(qname.equals("method")){
                        if(attrs.getQName(i).equals("name")){
                                    h.put(classList.get(i), methodList.add(attrs.getValue(i));
                   packageNames = new String[packageSet.size()];
                  packageNames = packageSet.toArray();
             public void endElement(String namespaceURI,String localName, String qname){}};
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            saxParser.parse(new File(fname), handler);
         public int getPackageNumber(){
              return packageSet.size();
         public Object[] getPackageNames(){
              return packageNames;
         public ArrayList getPackageList(){
              return packageList;
         public ArrayList getClassList(){
              return classList;
         public ArrayList getMethodList(){
              return methodList;
          public static void main(String[] args)throws Exception{
               new SaxParser();
    }I am currently pulling out the package names, pulling out the classnames and then mapping these in a separate class - this works because the class and package names are declared in the same line, so if a package name appears in the package list 7 times, i know this package has 7 classes, and therefore i count the first 7 classes out of an array of all the classes and know that these are the right 7 for that package. However, the methods are a bit different:
    What I would like to do is to: for every class make a hashmap which maps the class name onto an arraylist of the methods, but i think i'm getting confused with my for loops. Or even just keep a tally of how many methods each class has, then I can work it out as i did with the packages -> classes.
    Does anyone know where im going wrong, or have any ideas at all?
    Thank you for your time,
    beccy
    :)

    I don't know if stacks are specifically mentioned in any SAX documentation.
    Basically, SAX sends you a stream of XML elements (open and close tags, characters, etc.), but it doesn't know anything about the underlying XML structure. You have to add that part (usually -- sometimes when writing a SAX application, you don't really care about the XML structure). XML structure is a tree.
    If you've ever written a recursive function that spans a tree, you'll have an idea what to do. You can use a stack to keep track of where you are in the tree. For example, if you open tag A, then you're "in" the A element for subsequent content in that document; if you then open tag B, you're in the B element; but when you close the B tag, you need the stack to tell you that now you're back in the A element.
    You may not need stacks, but it's likely. Find a good tutorial about SAX that mentions stacks and you'll be fine.
    Edited by: paulcw on Nov 14, 2007 4:09 PM

  • Lenovo System Update 5.03 on T430u doesn't report software updates

    On my T430u Lenovo System Update 5.03 running on windows 8.1doen't find any update even though updates are available. More technical details about the problem are reported in my previous thread.
    I'm really pleased if someone can help me.
    Thanks,
    Denis.
    Solved!
    Go to Solution.

    Hi Mithun,
    The problem still persist.
    I've just reinstalled all components:
    - .NET Framework 3.5 SP1
    - Lenovo System Update 5.03.008 (systemupdate503-2013-10-31.exe)
    - Related Patch "Patch module for Lenovo System Update" (sushortcutfix01.exe)
    - Executing DesktopToastsForCriticalUpdates (look at the screenshot) it reports available updates
    - Executing Lenovo System Update it doesn't report any updates to install.
    In logs directory of Lenovo System Update installation directory (C:\Program Files (x86)\Lenovo\System Update\logs) I can extract the same error:
    Info    2014-01-20 , 12.04.56
        in Tvsu.Engine.Process.HelloProcess.DownloadUDF(String helloClientLevel)
        Message: The UDF will be downloaded from: https://download.lenovo.com/ibmdl/pub/pc/pccbbs/agent/SSClientCommon/HelloLevel_9_08_00.xml
    Info    2014-01-20 , 12.04.56
        in Tvsu.Engine.Process.HelloProcess.DownloadUDF(String helloClientLevel)
        Message: The UDF will be downloaded to-> C:\ProgramData\Lenovo\SystemUpdate\session\system\SSClientCommon\HelloLevel_9_08_00.xml
    Info    2014-01-20 , 12.04.56
        in Tvsukernel.CustomControls.Step.<>c__DisplayClass7.<set_Image>b__6()
        Message: Setting PROCESSING status.
    Severe    2014-01-20 , 12.04.56
        in Tvsu.Engine.Process.HelloProcess.Start()
        Message: Error reading C:\ProgramData\Lenovo\SystemUpdate\session\system\SSClientCommon\HelloLevel_9_08_00.xml, this XML file is not well-formed
        Exception:
            Message: Elemento radice mancante.
            Type: System.Xml.XmlException
               in System.Xml.XmlTextReaderImpl.Throw(Exception e)
       in System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       in System.Xml.XmlTextReaderImpl.Read()
       in System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)
       in System.Xml.XPath.XPathDocument..ctor(TextReader textReader)
       in Tvsu.Engine.Process.HelloProcess.ParseUDF(String udfPath)
       in Tvsu.Engine.Process.HelloProcess.Start()
    - The File: C:\ProgramData\Lenovo\SystemUpdate\session\system\SSClientCommon\HelloLevel_9_08_00.xml
    it's an empty file (0 KB).
    Can you help me?
    Is there a place where I can attach all log files ?
    Best regards,
    Denis.

  • How to deal with empty tags in a SAX Parser

    Hi,
    I hope someone can help me with the problem I am having!
    Basically, I have written an xml-editor application. When an XML file is selected, I parse the file with a SAX parser and save the start and end locations of all the tags and character data. This enables me to display the xml file with the tags all nicely formatted with pretty colours. Truly it is a Joy To Behold. However, I have a problem with tags in this form:
    <package name="boo"/>
    because the SAX parser treats them like this:
    <package name = boo>
    </package>
    for various complex reasons the latter is unaccetable so my question is: Is there some fiendishly clever method to detect tags of this type as they occur, so that I can treat them accordingly?
    Thanks,
    Chris

    I have spent some time on googling for code doing this, but found nothing better, than I had to write in by myself.
    So, it would be something like this. Enjoy :)
    package comd;
    import org.xml.sax.helpers.DefaultHandler;
    import org.xml.sax.SAXException;
    import org.xml.sax.Attributes;
    import java.util.Stack;
    import java.util.Enumeration;
    public class EmptyTagsHandler extends DefaultHandler {
         private StringBuilder xmlBuilder;
         private Stack<XmlElement> elementStack;
         private String processedXml;
         private class XmlElement{
              private String name;
              private boolean isEmpty = true;
              public XmlElement(String name) {
                   this.name = name;
              public void setNotEmpty(){
                   isEmpty = false;
         public EmptyTagsHandler(){
              xmlBuilder = new StringBuilder();
              elementStack = new Stack();
         private String getElementXPath(){
              StringBuilder builder = new StringBuilder();
              for (Enumeration en=elementStack.elements();en.hasMoreElements();){
                   builder.append(en.nextElement());
                   builder.append("/");
              return builder.toString();
         public String getXml(){
              return processedXml;
         public void startDocument() throws SAXException {
              xmlBuilder = new StringBuilder();
              elementStack.clear();
              processedXml = null;
         public void endDocument() throws SAXException {
              processedXml = xmlBuilder.toString();
         public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
              if (!elementStack.empty()) {
                   XmlElement elem = elementStack.peek();
                   elem.setNotEmpty();
              xmlBuilder.append("<");
              xmlBuilder.append(qName);
              for (int i=0; i<attributes.getLength();i++){
                   xmlBuilder.append(" ");
                   xmlBuilder.append(attributes.getQName(i));
                   xmlBuilder.append("=");
                   xmlBuilder.append(attributes.getValue(i));
              xmlBuilder.append(">");
              elementStack.push(new XmlElement(qName));
         public void endElement(String uri, String localName, String qName) throws SAXException {
              XmlElement elem = elementStack.peek();
              if (elem.isEmpty) {
                   xmlBuilder.insert(xmlBuilder.length()-1, "/");
              } else {
                   xmlBuilder.append("</");
                   xmlBuilder.append(qName);
                   xmlBuilder.append(">");
              elementStack.pop();
         public void characters(char ch[], int start, int length) throws SAXException {
              if (!elementStack.empty()) {
                   XmlElement elem = elementStack.peek();
                   elem.setNotEmpty();
              String str = new String(ch, start, length);
              xmlBuilder.append(str);
         public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
              String str = new String(ch, start, length);
              xmlBuilder.append(str);
    }

  • Xml sax parser

    Hi all,
    I am newbie to xml. I am using SAX parser for parsing xml documents. I have to write a code which parses all types of xsd files(including which can contain inline , referenced or both). Can anyone help / guide me how to code a generic xsd parser??
    Thanks in advance,

    An XSD file is an XML file, so you can parse it using sax.
    See :
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/2a_echo.html
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/work/Echo02.java
    See also:
    http://www.oracle.com/technology/tech/xml/xdk/doc/production/java/doc/java/javadoc/oracle/xml/parser/schema/XMLSchema.html#getXMLSchemaNodeTable

  • Error processing request in sax parser  No 'action' attribute found in XML

    Hi All,
            I am doing a FILE to JDBC Scenario.  I just want to send a data from file to Sql Db table. For this I have written a stored procedure to insert the row in a table.
    This is the message mapping for FILE to JDBC ….
    Sender                                                                   Receiver
    *FILESENDER_MT  1..1    FILESENDER_DT     * SPRECEIVER_MT    1..1
        .NO                    1..1    xsd:string                    * Statement           1..1   string
        .Name                1..1    xsd:string                      *user_PROC       1..1                                                                               
    action            1..1required
                                                                                *No                                                                               
    isInput        1..1  string
                                                                                    type           1..1  string
                                                                                *Name
                                                                                    isInput        1..1  string
                                                                                    type           1..1  string 
    Mapped Values....
    Statement is mapped with <b>FILESENDER_MT</b>
    action attribute is mapped with "<b>EXECUTE</b>" Constant
    No is mapped with <b>NO</b>
    Name is mapped with <b>Name</b>
    for both isInput is mapped with <b>TRUE</b>
    for both type is mapped with <b>CHAR</b>
    Here is the my stored procedure.....
    CREATE PROCEDURE [dbo].[user_PROC]
    @NO char(10),  @Name char(10)  AS
    insert into FILE2JDBC values('a','ab')
    GO
    when i run this stored procedure in Sql directly it was executed successfully....
    I have checked In SXMB_MONI status is showing green...
    xml messages from SXMB_MONI ....
    this is the message from payloads of Inbound Message
    <PRE> <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:FILESENDER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
      <NO>111</NO>
      <NAME>murthy</NAME>
      </ns0:FILESENDER_MT></PRE>
    this is the message from payloads of Request Message Mapping
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:SPRECEIVER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
    - <Statement>
    - <user_PROC>
      <action>EXECUTE</action>
    - <NO>
      <isInput>TRUE</isInput>
      <type>CHAR</type>
      </NO>
    - <Name>
      <isInput>TRUE</isInput>
      <type>CHAR</type>
      </Name>
      </user_PROC>
      </Statement>
      </ns0:SPRECEIVER_MT>
    this is the error showing in runtime workbench>component monitoring->communication channel monitoring-->Receiver Communication Channel....
    <b>Error while parsing or executing XML-SQL document: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)</b>
    Can any body tell me whether the problem is in Mapping or in Data Type Structure..
    Please resolve this issue....
    Thanks in Advance,
    Murthy.

    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:SPRECEIVER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
    - <Statement>
    <b>- <user_PROC>
    <action>EXECUTE</action></b>
    - <NO>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </NO>
    - <Name>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </Name>
    </user_PROC>
    </Statement>
    </ns0:SPRECEIVER_MT>
    The Action should be a Attribute of Element user_Proc as,
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:SPRECEIVER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
    - <Statement>
    <b>- <user_PROC action="Execute"></b>- <NO>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </NO>
    - <Name>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </Name>
    </user_PROC>
    </Statement>
    </ns0:SPRECEIVER_MT>
    Likewise isInput and Type should be Attributes and not Elements .
    Regards
    Bhavesh

  • SAX Parser

    I am using the sax parser provided by the package javax.xml.parsers to parse an XML file. It works fine as long as I have an XML file which has English characters. When I use it for parsing a file which has Korean characters in it, the parser fails to recognize them.
    It used to throw an error "Line too long" on reading the Korean characters. Then I added an XML directive encoding="EUC-KR" and now it reads the file but does not recognize the characters correctly. It reads all the korean characters as question marks ('??').
    Any pointers on what can be done to fix this problem.
    Thanks,
    RahulJ

    Hi,
    We've got a very similar problem. I'm parsing with SAX and DOM but the MS special characters keep appearing as ? or ??.
    If the encoding is not specified in the XML file there are Parser Exceptions. If I set the encoding to "JISAutoDetect", "JIS", "MS932", "Cp1250 to Cp1258" or "ISO8859-1" then there are no exceptions but the stray characters still appear as ?s.
    I managed to display the left and the right quotation marks in a servlet by setting the response Content Type to "text/html; charset=Shift_JIS" and the encoding="Cp1252" in the XML file. But I still have problems with the rest of the characters.
    What kind of output do you use? Do you display in a web page or you just write to a file?
    Thanks,
    Ross

Maybe you are looking for

  • AUTOMATIC PO DURING GR

    Hi, I have done the customization for automatic PO during GR. The system is creating a purchase order with the Info record price. Now my question is:  Since the cost of the item is totally fluctuating is it technically possible to enter the cost duri

  • Graded bands on photo prints - HP 7520 Photosmart

    Hi, I'm experienceing a problem printing photos with my new (less than 1 month old) 7520.  All my photos are printing with perpendicular bands (equivalent to the appearence when printing in draft mode) no matter what settings I choose. To prevent the

  • How can I limit the addition of the effects only on my guit

    hei,people I am trying to record my guitar while a song is reproduced at the same time. I use the Sound Blaster Recorder and eveything seems to work fine. The problem occurs when I want to add some effects on my guitar sound. When I try to add sth, t

  • Phone turned off and won't turn back on

    Hi, my z1 recently switched itself off without warning and now won't switch back on. I have tried to reset it with the power+volume up method, and also the red button under the sim flap. Also, when the charger is connected the notification led flashe

  • Using Digi 002 rack with FCP

    Does anyone have experience with using a Pro Tools Digi 002 rack with Final Cut? I'm having some trouble making it work. I just want to be able to use during editing for audio output. The 002 shows up as viable device in audio/video setup, however, F