Trouble parsing DTD

I'm trying to parse a DTD with Java using the code below. Using the XMLParser the parsing works fine, but when I try to use the DOMParser nothing works, I end up with the errors like
"XML-0230: (Error) Illegal change of encoding: from UCS-2 to Unicode.
XML-0192: (Fatal Error) Unexpected text in DTD."
I've tried to change the encoding and remove the "unexpected" text, but I always end up with another error.
I could use the XMLParser, but when I try to generate classes with the oracle.xml.classgen.ClassGenerator, the method generator.generate(dtd, doctype_name) requires the dtd to be of type oracle.xml.parser.v2.DTD whilst the xmlParser.getDoctype() returns a DTD of type oracle.xml.parser.DTD. I don't understand how to convert one type to the other.
Even worse, if I change the DTD the slightest, i e remove one single comment, the parsing fails. The parser starts complaining of illegal change of encoding.
I'm posting a small snippet of the DTD. This snippet is hasn't been possible to parse for me due to all the errors. However, if I parse the whole DTD with the XMLParser it works fine. The whole DTD is too big to post.
Java code:
oracle.xml.parser.XMLParser xmlParser = new XMLParser();
xmlParser.parseDTD(fileToURL(dtdFile), rootName);
oracle.xml.parser.v2.DOMParser DOMParser domParser = new DOMParser();
domParser.setDebugMode(true);
domParser.setErrorStream(System.out);
domParser.setValidationMode(false);
domParser.parseDTD(fileToURL(dtdFile), rootName);
oracle.xml.parser.v2.DTD dtd_v2 =(oracle.xml.parser.v2.DTD)domParser.getDoctype();
oracle.xml.parser.DTD dtd_v1 = (oracle.xml.parser.DTD)xmlParser.getDoctype();
DTD file:
<?xml version="1.0" encoding="Unicode"?>
<!DOCTYPE DMP_xml_defs [
<!ELEMENT CompanyQuery CompEmployees CDATA>
<!ATTLIST CompanyQuery Employees CDATA>
<!ATTLIST CompanyQuery CompTurnover CDATA>
<!ATTLIST CompanyQuery SNI CDATA>
<!ATTLIST CompanyQuery SNILevel (1|2|3|4|5|6|)
<!ATTLIST CompanyQuery Heading CDATA>
<!ATTLIST CompanyQuery CompType CDATA>
]>

A DTD file is not an XML file, and not amenable to parsing with an XML parser. Parse a DTD with a DTD parser.
Wutka DTD Parser:http://www.wutka.com/dtdparser.html

Similar Messages

  • Can't convert oracle.xml.parser.DTD to oracle.xml.parser.v2.DTD.

    I am getting the following Error while trying
    to compile the SampleMain.java file(Generating an XML document from a given Employee.dtd).
    I have set my classpath to use xmlparser.jar.
    D:\XMls>javac SampleMain.java
    SampleMain.java:65: Can't convert oracle.xml.parser.DTD to oracle.xml.parser.v2.DTD.
    main(java.l
    ang.String[]).
    generator.generate(dtd, doctype_name);

    Would you check the java parser version you are using? If using java parser V2, the normal lib name is xmlparserv2.jar.
    null

  • Dom can't parse dtd reference in xml file

    Hi all,
    I am trying to parse a xml file (hibernate mapping file *.hbm.xml) using DOM. But itis getting timeout errorwhile parsing due to the external dtd reference in the xml file.
    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >I understand that the program is trying to access the document and is not being able to do so. But I don't have any clue to solve this problem. I don't want to remove the reference from the xml file.
    The following method is trying to parse the xml file:
    public void parseXML(String file) {
            factory = DocumentBuilderFactory.newInstance();
            System.out.println(file);
             try {
                 builder = factory.newDocumentBuilder();
                 document = builder.parse(file);
                 Element docEle = document.getDocumentElement();
                 NodeList n1 = docEle.getElementsByTagName("class");
                for(int i = 0; i < n1.getLength(); i++) {
                       Element e1 = (Element) n1.item(i);
                       String nm = e1.getAttribute("name");
                     System.out.println(nm);
            } catch(Exception e) {
                throw new RuntimeException(e);
        }Please help me on this....I am at no end....Please let me know if there is any method so that the parser will overlook this reference and will parse the xml file....or any other sort of solution....
    Thanks in advance...
    Anir

    Can you provide a working sample?  Upload to Onedrive and share it with us.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Taglib problem : can't parse DTD ?

    Hi,
    I'm running Tomcat 4.0.1.
    I'm trying to use the custom tags, but the tomcat server outputs an XML parsing error : 'Element type "tlibversion" must be declared'.
    It looks like tomcat is unable to read the DTD of my tld file (if I change the DTD url, nothing changes)...
    Here is my tld file :
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
         "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.2</jspversion>
    <shortname>first</shortname>
    <uri></uri>
    <info>A simple tab library for the examples</info>
    <tag>
    <name>hello</name>
    <tagclass>tags.CheckAddMessageTag</tagclass>
    <bodycontent>empty</bodycontent>
    <info>Say Hi</info>
    </tag>
    </taglib>
    Thank you for your help...
    Xavier Bugaud

    I think the issue is that your tld specifies the 1.2 DTD but then gives the 1.1 tag names such as "tlibversion" and "jspversion" instead of "tlib-version", "jsp-version". Either use the 1.1 DTD or change the tag names.

  • Getting incorrect err message while parsing DTD

    Hi,
    When I try to parse the DTD given below, the DomParser reports a
    SAXException
    <!ELEMENT DataArea (Workers)>
    <!ELEMENT Workers (Worker*)>
    <!ELEMENT Worker (Age?,Lodging?,Skills?)>
    <!ATTLIST Worker
    WorkerName CDATA #REQUIRED>
    <!ELEMENT WorkerName (#PCDATA)>
    <!ELEMENT Age (#PCDATA)>
    <!ELEMENT Lodging (#PCDATA)>
    <!ELEMENT Skills (Skill*)>
    <!ELEMENT Skill (SkillName,Ability?,Description*)>
    <!ELEMENT SkillName (#PCDATA)>
    <!ELEMENT Ability (#PCDATA)>
    <!ELEMENT Description EMPTY>
    <!ATTLIST Description
    SkillDescription CDATA #IMPLICIT>
    <!ELEMENT SkillDescription (#PCDATA)>
    This is the exception
    Attribute value should start with quote.
    at oracle.xml.parser.v2.XMLError.flushErrors
    (XMLError.java:201)
    at oracle.xml.parser.v2.XMLError.error(XMLError.java:107)
    at oracle.xml.parser.v2.XMLError.error(XMLError.java:145)
    at
    oracle.xml.parser.v2.NonValidatingParser.parseAttrValue
    (NonValidatingParser.java:1156)
    at oracle.xml.parser.v2.ValidatingParser.parseAttlistDecl
    (ValidatingParser.java:297)
    at
    oracle.xml.parser.v2.NonValidatingParser.parseMarkupDecl
    (NonValidatingParser.java:454)
    at oracle.xml.parser.v2.NonValidatingParser.parseDTD
    (NonValidatingParser.java:166)
    at oracle.xml.parser.v2.DOMParser.parseDTD
    (DOMParser.java:282)
    at oracle.apps.ero.xml.XmlPseudoDom.readCanonicalXmlv2
    (XmlPseudoDom.java:804)
    at
    oracle.apps.ero.xml.test.XmlFrameworkTester.testXmlPseudoDom
    (XmlFrameworkTester.java:137)
    at oracle.apps.ero.xml.test.XmlFrameworkTester.main
    (XmlFrameworkTester.java:21)
    The code snippet that causes this exception is given below.
    DOMParser dp=new DOMParser();
    dp.setValidationMode(true);
    String dtd=getDTD(rootVO);
    Diagnostic.println("Attempting to Validate inbound xml
    against DTD:\n"+dtd);
    try
    dp.parseDTD(new StringReader(dtd),XML_ROOT_ELEMENT_NAME);
    Is this behaviour a known bug? Is there any known workaround?
    null

    Keki Burjorjee (Oracle) (guest) wrote:
    : Hi,
    : When I try to parse the DTD given below, the DomParser reports
    a
    : SAXException
    : <!ELEMENT DataArea (Workers)>
    : <!ELEMENT Workers (Worker*)>
    : <!ELEMENT Worker (Age?,Lodging?,Skills?)>
    : <!ATTLIST Worker
    : WorkerName CDATA #REQUIRED>
    : <!ELEMENT WorkerName (#PCDATA)>
    : <!ELEMENT Age (#PCDATA)>
    : <!ELEMENT Lodging (#PCDATA)>
    : <!ELEMENT Skills (Skill*)>
    : <!ELEMENT Skill (SkillName,Ability?,Description*)>
    : <!ELEMENT SkillName (#PCDATA)>
    : <!ELEMENT Ability (#PCDATA)>
    : <!ELEMENT Description EMPTY>
    : <!ATTLIST Description
    : SkillDescription CDATA #IMPLICIT>
    : <!ELEMENT SkillDescription (#PCDATA)>
    : This is the exception
    : Attribute value should start with quote.
    : at oracle.xml.parser.v2.XMLError.flushErrors
    : (XMLError.java:201)
    : at oracle.xml.parser.v2.XMLError.error(XMLError.java:107)
    : at oracle.xml.parser.v2.XMLError.error(XMLError.java:145)
    : at
    : oracle.xml.parser.v2.NonValidatingParser.parseAttrValue
    : (NonValidatingParser.java:1156)
    : at oracle.xml.parser.v2.ValidatingParser.parseAttlistDecl
    : (ValidatingParser.java:297)
    : at
    : oracle.xml.parser.v2.NonValidatingParser.parseMarkupDecl
    : (NonValidatingParser.java:454)
    : at oracle.xml.parser.v2.NonValidatingParser.parseDTD
    : (NonValidatingParser.java:166)
    : at oracle.xml.parser.v2.DOMParser.parseDTD
    : (DOMParser.java:282)
    : at oracle.apps.ero.xml.XmlPseudoDom.readCanonicalXmlv2
    : (XmlPseudoDom.java:804)
    : at
    : oracle.apps.ero.xml.test.XmlFrameworkTester.testXmlPseudoDom
    : (XmlFrameworkTester.java:137)
    : at oracle.apps.ero.xml.test.XmlFrameworkTester.main
    : (XmlFrameworkTester.java:21)
    : The code snippet that causes this exception is given below.
    : DOMParser dp=new DOMParser();
    : dp.setValidationMode(true);
    : String dtd=getDTD(rootVO);
    : Diagnostic.println("Attempting to Validate inbound xml
    : against DTD:\n"+dtd);
    : try
    : dp.parseDTD(new StringReader(dtd),XML_ROOT_ELEMENT_NAME);
    : Is this behaviour a known bug? Is there any known workaround?
    The reason for the error is a problem in your DTD. You should
    have <!ELEMENT Worker(Workername, Age?, Lodging?, Skills?)>
    instead of only <!ELEMENT Worker(Age?, Lodging?, Skills?)>.
    Further down, it's similar for !ELEMENT Skill, in which
    SkillDescription should be added.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • External entity reference while parsing DTD

    I am using Oracle 8.1.7 to parse a DTD using xmlparser in PL/SQL.
    My DTD references external entities. Now the question is how to let the parser know the location of these external entities.
    setBaseURL and setBaseDir doe not seem to work. I have to tell the parser to look for all necessary entities in a particular folder. Can somebody answer with a sample code for this problem.
    Any Idea' would be highly appreciated.
    Regards,
    Prakash

    Hey Niels...
    That *shouldn't* be happening if you're using an unmodified FM8 install .. especially with creating a new file. It sounds like something has gone awry in your install. This will often happen if the doctype declaration in the XML file is defined as a system resource rather than with a public ID (but that shouldn't be happening unless you're creating the file with another editor or using a file created by someone else).
    Some things to check ..
    - Open the DITA > Options dialog .. is "DITA-Topic-FM" selected as the "Topic application"?
    - When you open a file from disk, do you select "DITA-Topic-FM" as the structure application? (You may not get an option to do so .. that's OK.)
    - Choose .. Structure Tools > Edit Application Definitions .. locate the XMLApplication node that is labeled "DITA-Topic-FM" .. below that you'll see entries for Template, DTD, and Read/write rules. Check that the files specifed actually exist at the locations specified (note that "$STRUCTDIR" maps to the FrameMaker/Structure/ folder).
    - Have you installed FrameMaker in a "nonstandard" location?
    I may be missing something obvious, but this is probably a good start.
    Cheers,
    ...scott

  • Trouble parsing string

    I need to parse strings in the format "City State
    Abbreviation Zipcode" (ie "Glenview, IL 60062") to seperate them as
    their own variables. Problem is that sometimes there is a comma
    after city, sometimes not, so I've resorted to REfind to seperate
    the string. Here's the snippet, "city" is the entire string I
    mentioned above. The problem is that the refind I use seems to be
    returning 0. I'm trying to find the two capital letters that
    designate the state abbeviation.
    <cfif city neq ''>
    <cfset crpos = refind("[:upper:][:upper:]",city) >
    <cfset zip = trim(right(city,len(city)-crpos))>
    <cfset citystate = trim(left(city,crpos)) >
    <cfset newpos = find("#chr(32)#",citystate) >
    <cfset state =
    trim(right(citystate,len(citystate)-newpos)) >
    <cfset actualcity =
    trim(left(citystate,len(citystate)-newPos)) >
    </cfif>

    I probably should mention some explaination about what the
    regular expression is doing:
    Note: Groups are RegExp statements surrounded by ()
    Group 1: Combination of Letters and Spaces (e.g. City Name)
    optional comma and (required) space
    Group 2: 2 Character upper case state code (State Code) (note
    - depending on your source, state codes may not always be upper
    case)
    (required) space
    Group 3: 5 digit string (e.g. Zip Code) (note - again,
    depending on your source, you may be getting 5 digit zip + 4 or
    even non-us zip codes that may involve alpha characters.)
    The replace function is using back references to refer to the
    text matched by group 1,2 and 3.

  • DTD Content Model Parse Tree

    Is there any documentation available that explains the Content Model Parse Tree for any simple DTD ? I am having trouble to understand the mnemonics (*, + etc.) while traversing a root node.

    Hi.
    You are saying that there are methods
    in the XDK for C that can access a parsed
    DTD structure and get information about
    ELEMENT tags in it. I haven't found any.
    Can you please tell me what these methods
    are? I need to get the ELEMENT information
    but all I can get are NOTATION and ENTITY
    tags.
    I would appriciate your help.
    Thank you,
    A. Volnov
    null

  • Getting DTD structure from Oracle DOMParser

    I am having trouble getting DTD structure from DOMParser after I parse the xml file with external DTD.
    When I do:
    xmlDOMParser.parse(new FileInputStream(xmlFile));
    XMLDocument xmlDoc=xmlDOMParser.getDocument();
    DTD docType=xmlDOMParser.getDoctype();
    NamedNodeMap nodeMap=docType.getElementDecls();
    the nodeMap is equal to null.
    I need to get the element structure of DTD, how can I do that?

    The below example is working fine for me
    create table t1
       as
        select object_id id, object_name text
          from all_objects;
    Create table t2
      as
      select t1.*, 0 session_id
        from t1
       where 1=0;
    CREATE OR REPLACE TYPE t2_type
    AS OBJECT (
      id         number,
      text       varchar2(30),
      session_id number
    create or replace type t2_tab_type
    as table of t2_type
    create or replace
      function parallel_pipelined( l_cursor in sys_refcursor )
      return t2_tab_type
      pipelined
      parallel_enable ( partition l_cursor by any )
      is
          l_session_id number;
          l_rec        t1%rowtype;
      begin
          select sid into l_session_id
            from v$mystat
           where rownum =1;
          loop
              fetch l_cursor into l_rec;
              exit when l_cursor%notfound;
              -- complex process here
              pipe row(t2_type(l_rec.id,l_rec.text,l_session_id));
          end loop;
          close l_cursor;
          return;
      end;
      /And its getting executed in parallel
    SQL> select DISTINCT session_id
      2    from table(parallel_pipelined
      3              (CURSOR(select /*+ parallel(t1) */ *
      4                        from t1 )
      5               ))
      6  ;
    SESSION_ID
           221
            76
            77
           241
           161
           152
           160
           302
           232
           313
            73
    SESSION_ID
           292
    12 rows selected.But why its getting disconnected in my scenario. ???

  • Pbm while importing a DTD

    Hi
    I have a strange pbm..XI throws a NULL Exception while activating an external DTD.
    The DTD simply contains
    [code]
    <!ENTITY % SEGMENTS SYSTEM "oagis_segments.dtd">
    %SEGMENTS;
    <!ENTITY % EXTENSIONS SYSTEM "oagis_extensions.dtd">
    %EXTENSIONS;
    [/code]
    The Error thrown in processing log is
    Activation of the change list canceled Check result for External Definition resources | http://xxxx.xx/xi/acc_invoice_receipt03: Document check found errors  Cause: Unable to recognize the loaded document as valid DTD  Error when parsing DTD document com.sap.aii.utilxi.dtd.api.DtdException: Wrong declaration: " %EXTENSIONS;"
    [code]
    Details
    Internal problem occurred (INTERNAL_PROBLEM)
    MESSAGE ID: com.sap.aii.utilxi.swing.framework.rb_exceptions.INTERNAL_PROBLEM
    STACKTRACE:
    com.sap.aii.utilxi.swing.framework.FrameworkException: Internal problem occurred
        at com.sap.aii.utilxi.swing.toolkit.ExceptionDialog.init(ExceptionDialog.java:116)
        at com.sap.aii.utilxi.swing.toolkit.ExceptionDialog.<init>(ExceptionDialog.java:93)
        at com.sap.aii.utilxi.swing.toolkit.Guitilities.showExceptionDialog(Guitilities.java:1137)
        at com.sap.aii.utilxi.swing.toolkit.Guitilities.showExceptionDialog(Guitilities.java:1125)
        at com.sap.aii.utilxi.swing.framework.Application.notifyFrameworkListeners(Application.java:412)
        at com.sap.aii.ib.gui.operations.SubmitCommand.revertChangelist(SubmitCommand.java:385)
        at com.sap.aii.ib.gui.operations.SubmitCommand.doMoveAndSubmit(SubmitCommand.java:374)
        at com.sap.aii.ib.gui.operations.SubmitCommand.doSubmitSingleOject(SubmitCommand.java:311)
        at com.sap.aii.ib.gui.operations.SubmitCommand.execute(SubmitCommand.java:169)
        at com.sap.aii.utilxi.swing.framework.ExecutionContext.execute(ExecutionContext.java:196)
        at com.sap.aii.utilxi.swing.framework.ExecutionContext.executeSafe(ExecutionContext.java:134)
        at com.sap.aii.utilxi.swing.framework.CommandAction.actionPerformed(CommandAction.java:69)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at com.sap.plaf.frog.FrogMenuItemUI$MenuDragMouseHandler.menuDragMouseReleased(FrogMenuItemUI.java:906)
        at javax.swing.JMenuItem.fireMenuDragMouseReleased(Unknown Source)
        at javax.swing.JMenuItem.processMenuDragMouseEvent(Unknown Source)
        at javax.swing.JMenuItem.processMouseEvent(Unknown Source)
        at javax.swing.MenuSelectionManager.processMouseEvent(Unknown Source)
        at com.sap.plaf.frog.FrogMenuItemUI$MouseInputHandler.mouseReleased(FrogMenuItemUI.java:835)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
    java.lang.NullPointerException
    STACKTRACE:
    java.lang.NullPointerException
        at com.sap.aii.ibrep.gui.interfaces.ExternalDefinitionController.genericFrameworkEvent(ExternalDefinitionController.java:92)
        at com.sap.aii.ib.gui.operations.SubmitCommand$3.notify(SubmitCommand.java:387)
        at com.sap.aii.utilxi.swing.framework.Application.notifyFrameworkListeners(Application.java:408)
        at com.sap.aii.ib.gui.operations.SubmitCommand.revertChangelist(SubmitCommand.java:385)
        at com.sap.aii.ib.gui.operations.SubmitCommand.doMoveAndSubmit(SubmitCommand.java:374)
        at com.sap.aii.ib.gui.operations.SubmitCommand.doSubmitSingleOject(SubmitCommand.java:311)
        at com.sap.aii.ib.gui.operations.SubmitCommand.execute(SubmitCommand.java:169)
        at com.sap.aii.utilxi.swing.framework.ExecutionContext.execute(ExecutionContext.java:196)
        at com.sap.aii.utilxi.swing.framework.ExecutionContext.executeSafe(ExecutionContext.java:134)
        at com.sap.aii.utilxi.swing.framework.CommandAction.actionPerformed(CommandAction.java:69)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at com.sap.plaf.frog.FrogMenuItemUI$MenuDragMouseHandler.menuDragMouseReleased(FrogMenuItemUI.java:906)
        at javax.swing.JMenuItem.fireMenuDragMouseReleased(Unknown Source)
        at javax.swing.JMenuItem.processMenuDragMouseEvent(Unknown Source)
        at javax.swing.JMenuItem.processMouseEvent(Unknown Source)
        at javax.swing.MenuSelectionManager.processMouseEvent(Unknown Source)
        at com.sap.plaf.frog.FrogMenuItemUI$MouseInputHandler.mouseReleased(FrogMenuItemUI.java:835)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
    [/code]
    I have already imported and activated the reference DTDs mentioned..
    Any Clues!! Is this an XI bug??

    HI Stephan
    Thanks for the update on the SP.. I see quite a lot of issues with DTD imports..I have put one more query in another msg!!..
    I was wondering if SAP should provide a list of issues to look for in a DTD before importing so that we can readily validate every DTD against this WAtch for list!!

  • XML parsing problems

    I'm having trouble parsing the following XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ecurom>
    <roms>
       <rom base="WRXBASE">
          <romid>
             <xmlid>A4TF400E</xmlid>
             <internalidaddress>200</internalidaddress>
             <internalidstring>A4TF400E</internalidstring>
             <caseid>AH792</caseid>
             <ecuid>1234567890</ecuid>
             <market>USDM</market>
             <transmission>Manual</transmission>
             <year>2004</year>
             <flashmethod>wrx04</flashmethod>         
             <memmodel>unknown</memmodel>
          </romid>      
          <table name="Main Ignition" storageaddress="0x293EB">
             <table type="X Axis" storageaddress="0x293C9" />
             <table type="Y Axis" storageaddress="0x293AA" />
          </table>      
          <table name="Rev Limit" storageaddress="0x291C8">
             <table type="Static Y Axis" storageaddress="0x291C8" />
          </table>      
          <table type="1D" name="Injector Flow Scaling" storageaddress="0x286BB"/>
       </rom>   
          <rom>
             <romid>
                <xmlid>WRXBASE</xmlid>
                <make>Subaru</make>
                <model>Impreza</model>
                <submodel>WRX</submodel>
             </romid>
          <table type="3D" name="Main Ignition" category="Timing" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="16" sizey="15">
             <scaling units="degrees" expression="(x-57)*360/1024" format="#.00" increment="1" />
             <table type="X Axis" name="Engine Load" storagetype="uint16" endian="big" sizex="16">
                <scaling units="grams" expression="x/8192" format="0.00" increment="256" />
             </table>
             <table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="15">
                <scaling units="RPM" expression="x/256*50" format="#" increment="256" />
             </table>
             <description>"This is a map of base ignition values."</description>
          </table>      
          <table type="2D" name="Rev Limit" storagetype="uint16" endian="big" sizey="2">
             <scaling units="RPM" expression="x/256*50" format="#" increment="256" />
             <description>"RPM at which limiter turns on and off."</description>
             <table type="Static Y Axis" name="Condition" units="" sizey="2">
                <data>on</data>
                <data>off</data>
             </table>
          </table>      
          <table type="1D" name="Injector Flow Scaling" category="Fuel" storagetype="uint16" endian="big" sizey="1">
             <scaling units="cc" expression="2447960/x" format="#.00" increment="-17" />
             <description>"Injector flow rating in cc/min"</description>
          </table>
       </rom>       
    </roms>Here's a piece of my unmarshalling code:
        public Rom unmarshallXMLDefinition (Node rootNode, byte[] input) throws RomNotFoundException, XMLParseException {
            Node n;
            NodeList nodes = rootNode.getChildNodes();
            for (int i = 0; i < nodes.getLength(); i++) {
             n = nodes.item(i);
                System.out.println(n.getNodeName());
             if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("rom")) { 
                    Rom rom = unmarshallRom(n, new Rom());      
                    String ecuID = new String(input, rom.getRomID().getInternalIdAddress(), rom.getRomID().getXmlid().length());
                    System.out.println(rom.getRomID().getXmlid());
                    if (ecuID.equalsIgnoreCase(rom.getRomID().getXmlid())) return rom; 
            throw new RomNotFoundException();
        }  You can see the println in there -- I'm expecting it to print
    rom
    rom
    But instead it's printing
    #text
    rom
    I don't have a clue whats going on with the first node and I'm pretty confused. Am I missing something?

    I printed the value of the text node and it's a few
    whitespaces, like you said. I tried removing ALL of
    the whitespace from the XML and it's still doing the
    same thing.What do you get as value for the text node after you removed all the whitespace? A newline or the empty string?
    So I'm confused by 2 things. First, what is DOM
    interpreting as a text node? I can't find any reason
    it should be doing that. It should be doing that because there is a text node. Although they aren't typically mixed, an XML element can have any number of child and text nodes in any order. Either way, what you should do is ignore text nodes if you are only interested in the element nodes. I'm not sure but it may be possible to instruct the parser to ignore whitespaces.
    I have no idea why it isn't finding the other child nodes though...
    Second, why is it not
    parsing the second <rom> node? It's only finding the
    2 nodes, but one of them is the text node instead of
    both being rom element nodes.

  • JSTL - Problem parsing XML file w/ XML schema declarations

    I'm having trouble parsing an xml document that contains XML schema declarations in the root element. I've included 2 snippets, the XML files they're supposed to parse, and their output below. The first one works and the second one doesn't. Could someone please tell me why? I find it hard to believe that no one's run into this before.
    I'm running Tomcat 5.5 and I'm using JSP 2.0, jakarta standard taglibs jars (1.1.2), jdk 1.5.0_04, and the Xalan 2.7.0 jars.
    Here's the first snippet:
    <c:import url="/WEB-INF/config/schools.xml" var="xml" />
    <x:parse doc="${xml}" var="schoolList"/>
    There are <x:out select="count($schoolList//school)"/> schools in the file:<br/>
    <x:forEach select="$schoolList//school">
         <x:out select="name"/><br/>
    </x:forEach>it parses the following xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <schools>
         <school id="34033">
              <name>Tumwater Middle School</name>
              <district>Tumwater</district>
              <type>middle</type>
              <active>false</active>
         </school>
         <school id="17001">
              <name>Garfield High School</name>
              <district>Seattle</district>
              <type>high</type>
              <active>true</active>
         </school>
         <school id="00023">
              <name>Tigard High School</name>
              <district>Tigard-Tualatin</district>
              <type>high</type>
              <active>true</active>
         </school>
    </schools>and it outputs:
    There are 3 schools in the file:
    Tumwater Middle School
    Garfield High School
    Tigard High School-----------------------------------------
    The second snippet:
    <c:import url="/WEB-INF/config/schools2.xml" var="xml2" />
    <x:parse doc="${xml2}" var="schoolList2"/>
    There are <x:out select="count($schoolList2//school)"/> schools in the file:<br/>
    <x:forEach select="$schoolList2//school">
         <x:out select="name"/><br/>
    </x:forEach>parses this xml file (note the xml schema declarations):
    <?xml version="1.0" encoding="UTF-8"?>
    <schools xmlns="http://www.serenus.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.serenus.com schools.xsd">
         <school id="34033">
              <name>Tumwater Middle School</name>
              <district>Tumwater</district>
              <type>middle</type>
              <active>false</active>
         </school>
         <school id="17001">
              <name>Garfield High School</name>
              <district>Seattle</district>
              <type>high</type>
              <active>true</active>
         </school>
         <school id="00023">
              <name>Tigard High School</name>
              <district>Tigard-Tualatin</district>
              <type>high</type>
              <active>true</active>
         </school>
    </schools>and its output is:
    There are 0 schools in the file:That's it! No errors at all! I'm 100% certain the variable names, filenames, etc. are correct. I've looked everywhere for an existing answer to this problem, but I can't find one. Is this a known issue? Please help.
    -Ben

    Hi Ben,
    I got exactly the same problem and also could not find any solution.
    Did you find a way out for this problem meanwhile?
    Any help is welcome!

  • XML validation using XDK DOM/SAX Parser

    Hello,
    I am trying to validate xml against xsd using SAX/DOM parser, both the files are stored as CLOB column in the database. I have the requirement to report all the validation errors and based on some helpful advice/code from the earlier posts in this forum, I have used the following code to validate and report the errors.
    The code works fine but for large files it never goes beyond a certain number of errors i.e. getNumMessages() (XMLParseException) never returns value greater than 100 and thus limits the output of the validation errors. Any pointers to suggest change in code or an alternative will be extremely helpful.
    Datebase Version : Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED as package <package name>;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.sql.SQLException;
    import oracle.sql.CLOB;
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import org.w3c.dom.*;
    public class XMLSchemaVal
    public static String validate(CLOB xmlDoc, CLOB xsdDoc)
    throws Exception
    //Build Schema Object
    XSDBuilder builder = new XSDBuilder();
    Reader xsdInUnicodeFormat = xsdDoc.getCharacterStream();
    XMLSchema schemadoc = (XMLSchema)builder.build(xsdInUnicodeFormat, null);
    //Build XML Object
    Reader xmlInUnicodeFormat = xmlDoc.getCharacterStream();
    // Genereate the SAX
    SAXParser saxparser_doc = new SAXParser();
    // Set Schema Object for Validation
    saxparser_doc.setXMLSchema(schemadoc);
    saxparser_doc.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxparser_doc.setPreserveWhitespace (true);
    String returnValue;
    try {
    saxparser_doc.parse (xmlInUnicodeFormat);
    returnValue = "The input XML parsed without errors.\n";
    catch (XMLParseException se) {
    returnValue = "Parser Exception: ";
    for (int i=0 ; i < se.getNumMessages(); i++)
    returnValue += "<LN: " + se.getLineNumber(i) + ">: " + se.getMessage(i);
    //returnValue = "Parser Exception: " + se.getNumMessages();
    catch (Exception e) {
    returnValue = "NonParserException: " + e.getMessage();
    return returnValue;
    Function to call the above utility from PL/SQL
    CREATE OR REPLACE FUNCTION F_XMLSCHEMAVALIDATION (P_XML IN clob ,P_XSD IN clob) RETURN VARCHAR2 IS
    LANGUAGE JAVA NAME XMLSchemaVal.validate(oracle.sql.CLOB,oracle.sql.CLOB) return java.lang.String';
    Thanks.

    I have the same question. I have an external DTD. I wish to parse an xml file using XMLParser.xmlparse. If I first call XMLParser.xmlparseDTD and then call xmlparse with the XML_FLAG_VALIDATE will the xml automatically be validated against the previously parsed DTD? There is no DOCTYPE declaration in the xml file.
    The demo code on OTN for Java is great but has no relation to the code you would use in C++ (no set functions in C++).

  • Parsing Special Characters

    Hi,
    I'm parsing XML files using a DOM parser but I'm having trouble parsing superscripts. If a XML tag contains a value like 6 cm� the whole parser bombs. It reads the file then throws an error that says:
    org.xml.sax.SAXException: Fatal Error: URI=file:D:/Project1/DomParser/d2kfw0ya.xml Line=543: The element type "Observation_Value" must be terminated by the matching end-tag "</Observation_Value>".
    I tried using a replaceAll statement, strB.replaceAll("&#178", "cm2");, but that didn't work either.
    If I take out the superscript then everything works fine. I can't change how the XML is created because it is generated at another machineAny ideas on how to get around this?
    Thanks,
    -Matt

    Mmm, I just read your original post that said you aren't the one producing the XML. It is unfortunately common for people to produce XML files that don't declare their encodings correctly. In that case there are two things you need to do:
    1. Harass the producer of the XML to produce well-formed XML.
    And when that doesn't work,
    2. Write a small preprocessing program that fixes the encoding. Read the file in using an InputStreamReader that uses the actual encoding of the file, and rewrite it with an OutputStreamWriter that uses the encoding declared in the file, or UTF-8 if there is no encoding declaration.

  • Node Insertion - ensure validity against DTD

    I want to create a new XML document, insert elements one by one. How do I ensure that the element is insertable according to DTD specified (i.e. it is valid to insert the new element to the XML document)?
    Thank you

    You can use class com.ibm.xml.parser.DTD to load your DTD and use the getAppendableElements method. Then you can check if an element is in the appendable elements,...

Maybe you are looking for

  • ITunes no longer works

    So I've tried posting several times about this issue but it doesn't seem that other people are having this problem. iTunes crashes every time I attempt to open the store or use the match feature and it only seems to affect my Windows 8 machine. On my

  • NW 7.3:  (A)SCS/SCS/ERS  - use the same IP

    Hi, evaluation tests with SAP NW 7.3 show that the instances of (A)SCS and ERS just using the same IP (in previous release ASCS and SCS have their own IP; depending on the releases ERS request an IP or not for installation procedure). In a single hos

  • PDF Hyperlinks

    RH7 WebHelp Pro I have some PDF files in ../../../Images/PDFs/. The hyperlinks I have created work in View Selected Item but not when I View Primary Layout in Internet Explorer. I moved these files (within the project) from the top level folder to a

  • Troubles with attached libraries - Forms6i

    I'm working with Forms6i (6.0.8.8.0). I have some troubles with attached libraries. I have to modify an old forms project. All server elements are on the original server computer (database, sources, libraries , ect..). Now I installed on a new client

  • MB_UPDATE_INVENTORY_DOCUMENT

    Hi Gurus, what is this function module MB_UPDATE_INVENTORY_DOCUMENT used for and how to use it..I need to set the flag XLOEK = 'X' for the table ISEG. Can i do it using this fun.mod. Please Help.