DTD's and getElementById

Hi folks...
Im getting myself in too deep here ... I wish to build a DOM object containing NodeElements I add ... I need to find these elements by getElementById .. and I keep getting null exceptions when using that method.
I know that the DOM recommendation says you have to define ID's on elements ... and I tried to use a DTD Ive made myself.
..but I cant figure out how !!
This is the code I have experimented with:
class XML {
     public static void main(String[] args) {
          try {
               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
               DocumentBuilder b = factory.newDocumentBuilder();
               factory.setNamespaceAware(true);
               factory.setValidating(true);
               DOMImplementation dom = b.getDOMImplementation();
               DocumentType doctype = dom.createDocumentType("root", "test", "file:///test.dtd");
               System.out.println(doctype.getNotations().getLength());
               Document doc = dom.createDocument("", "root", doctype);
               Element elem2 = doc.createElement("person");
               Attr id = doc.createAttribute("ID");
               id.setValue("test");
               elem2.setAttributeNode(id);
               doc.appendChild(elem);
               doc.getDocumentElement().appendChild(elem2);
               System.out.println(doc.getElementById("test"));
          } catch(Exception e) {
               System.out.println("error: " + e.getMessage() + " " + e.getStackTrace() + " " + e.getCause());
..the doctype doesn't apply to the document ... why? .. Ive tried without the file:// .. notation too - and getElementById keeps returning null..
Anybody got a answer ??? Ive looked through numerous questions in this Forum...I just still don't get it
tnx in advance.

True but remarkably unhelpful. I did a grep across the JDK docs and the associated W3 docs last night; there doesn't seem to be any mechanism for defining the ID. Perhaps they didn't implement it.
This can be implemented by the user... just traverse through the tree (assuming using DOM) until you find an element with attribute "ID" matching the value you want, or you could build a B-tree using SAX or DOM to the same end. But what a pain, and hardly optimized the way the library function presumably should be.

Similar Messages

  • DTD's and namespace

    Hi,
    According to a number of threads on this forum it is not possible to import and use DTD's with namespaces in it. These posts are rather old. So, is this still the situation?
    If yes,
    What's the best way to go on with DTD's with namespace?
    When I convert the DTD into XSD using Stylus the XSD is not recognized by XI after importing it as a External Definition.
    Best regards
    Ron
    Message was edited by: Ron van der Sterren

    Hi Ron
    On service.sap.com , SAP solutions / Netweaver / NW in detail / process integration / XI / Media Library / documentation you find some excel file that indicate the current subset of an open standard ( WDSL / DTD etc..) supported by SAP according to the SP level.
    But I think it hasn't changed yet.
    When you imported as XSD, did you try to choose 'from all unreferenced global elements '
    rgds
    Dirk

  • XML Comparison without DTD & XSD and able to return XPath of the Diff Node

    Dear All,
    I am new xml concept in java.
    First xml can have n of nodes and second xml can have n of the node.
    The node is new to second xml when compare to first xml.It has to go change list.
    1. My job is to compare 2 xml document and return the XPath of the Nodes.
    2. Both xml do not have any association like XSD,DTD and XSLT.
    3. I am looking for java api to find/return xpath of the node.
    Please help me.
    Saravanan.P

    Don't know if there's a method for this in the default XML parsing interface of Java (JAXP). I never came across a method which would return an XPath expression based on a Node and a Document. Only the other way around: return the Node(s) based on a Document and an XPath expression. Maybe some Java XML framework like XStream or an Apache XML framework have this functionality. It would be possible (not really nice though) to create such a method yourself. Based on a Document and a Node as input you could iterate through the parent elements until you reach the root Node and return the path. You would need to take into account that a Node can be part of a NodeList, so you have to retrieve the index of the Node in the list too.
    Ronald

  • Relation between transactions and DTD's

    Hi,
    Is there any relation between transaction, transaction subtypes with DTD's.
    This is the case of 3rd party integration. I want to send an inbound message to the oracle xml gateway. This will be directly enqueued into generic queue - ECX_INQUEUE through AQ api's.
    But for exposing the DTD's and transactions, I am not able to find any relation between them ?
    Can anyone throw some light on this .....

    Same question here.....
    For the Buyer/Seller Sample in C:\orabpel\samples\tutorials\109.CorrelationSets, I found that the sample still works after I deleted the Correlation Set. So, what is the use of Correlation Set in this sample?

  • How To Generate Objects From XML and DTD?

    Are there tools to generate objects from dtd's and xml files?
    If this is not possible for some reason: is there a tool to generate classes from a dtd?
    I can not find the "XML Java Class Generator" (from oracle) anymore.

    XMLBeans
    There are other solutions, but I know this one is pretty good.

  • Pausing swfs and audio in a browser when the tab is out of focus

    I'm trying to code my flash file so that the html will pause all swfs AND audio when the tab is out of foucs.  I found this code on http://frontenddeveloper.net/wiki/index.php?title=JavaScript_and_VBScript_Injection_in_Act ionScript_3 and it works,but not completely. It only pauses the movie clips that are in the Flash file and not any that are exteranlly loaded with audio included.
    How can I adjust it to pause the externally loaded swfs that are loaded to a mc within my main movie clip and the audio OR what should I use in place of this code?  Someone mentioned on a different post that I needed to use a window.onblur funcition, but they didn't give details.
    import flash.display.MovieClip;
    import flash.utils.setTimeout;
    // This is a more "safe than sorry" setting, since multiple domains
    // have entry into my site. Can be removed or hardcoded if you feel
    // secure or insecure, as you see fit.
    flash.system.Security.allowDomain("*");
    // Throw any errors around to make sure somebody actually gets them.
    ExternalInterface.marshallExceptions = true;
    // This is not the most ideal way to toggle animations on and off, but
    // it's thorough, generic, and simple. Iterate all movieclips within
    // clip, shutting them down each in turn. A better, but much more tedious
    // method would be to target specific clips using dotpath notation, telling
    // each in turn to turn off or on depending on what we need.
    // BUT this is just a demo, and what we're really interested in is the
    // event-handling mechanism that actually calls this routine, and not the
    // routine itself.
    function toggleAllClips(doAnim, clip) {
    if ( clip is MovieClip) {
      if (doAnim) {
       clip.play();
      } else {
       clip.stop();
      for (var i = 0; i<clip.numChildren; i++) {
       toggleAllClips(doAnim, clip.getChildAt(i));
    function animOn(e:*=null) {
    toggleAllClips(true, this.mainMC);
    function animOff(e:*=null) {
    toggleAllClips(false, this.mainMC);
    function injectPrep(e:*=null) {
    try {
      ExternalInterface.addCallback("jsanimOn", animOn);
      ExternalInterface.addCallback("jsanimOff", animOff);
    } catch (e) {
      trace(e);
    function injectListeners(e:*=null) {
    try {
      // Object/Embed ID of this movie needs to be inserted into the
      // JavaScript before we actually wrap and send it to the browser:
      var jsfix=js.toString().replace(/xxx/g, ExternalInterface.objectID);
      ExternalInterface.call(jsfix);
    } catch (e) {
      trace(e);
    // Using timeouts ensures the movie is actually done loading before
    // these fire, helping compatibility for a few browser versions.
    setTimeout(injectPrep,0);
    setTimeout(injectListeners,100);
    JAVASCRIPTS
    JavaScript needs to be wrapped in a tag, a cdata, and a closure
    function in order to be wrapped up and sent to the browser.
    Note that an ActionScript function will replace all instances
    of "xxx" with the actual ID used for this SWF.
    We're battling some major bugs and crossbrowser idiosyncrasies
    here:
    1) In Internet Explorer the 'onblur' event is implemented
        incorrectly (as opposed to Firefox/Mozilla browsers). It is
        wrongly fired when focus is switched between HTML elements
        *inside* a window. As a result, we have to use onfocusout
        instead of onblur, and keep track of which element is active.
        If we focusout and the active element is not the previous
        active element, then we haven't actually "blurred" and dont
        want to trigger Flash.
    2) Firefox has problems interpreting both getElementById and
        document["swf"] when dealing with "twicebaked" object/embeds.
        Adobe's method of finding the swf fails to address the fact
        that document["swf"] sometimes returns an array in this
        situation rather than an object ref, and getElementById
        sometimes confuses name and id.
    3) When a window is created in Firefox, it doesn't actually have
        "focus" (event though it appears to) and therefore won't "blur"
        unless you actually click in it first, i.e if you open up a
        window, then immediately send it to the background, it never
        gets the command to halt the flash. So we have to explicitly
        focus the blasted thing to get it to work properly.
    4) Because of irregularities caused by Ajax, the way browsers shut
        down, and other factors, there's a good chance our swf won't
        be there when a blur (or focusout) event occurs. Therefore we
        need an explicit check within the event handler itself.
    5) Finally, we want to wrap everything inside a wrapper-closure
        function, to keep everything safe from being stepped on. Lucky
        us, we have to do this anyways to get everything to fit inside
        a single ExternalInterface.call event.
    var js:XML = <script><![CDATA[
    ( function() {
      var active_element; // tracker for ie fix;
      var bIsMSIE = false;
      // Modified version of Adobe's code resolves a bug in FF:
      function getSWF(movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
          return window[movieName];
        } else {
          // Resolves a bug in FF where an array is sometimes returned instead of a
          // single object when using a nested Object/Embed.
          if(document[movieName].length != undefined){
            return document[movieName][1];
          return document[movieName];
      // Need to check for swf each time we try this because the swf may actually be gone
      // because of ajax or a window closure event. Prevents error dialog from popping up.
      // Future release should check for this condition and then remove the calling event
      // so it doesn't keep triggering.
      function animOff(){
        if (bIsMSIE && (active_element != document.activeElement)) {
          active_element = document.activeElement;
        } else {
          var logoThang = getSWF("xxx");
          if(logoThang){logoThang.jsanimOff();}
      function animOn(){
        if (bIsMSIE && (active_element != document.activeElement)) {
          active_element = document.activeElement;
        } else {
          var logoThang = getSWF("xxx");
          if(logoThang){logoThang.jsanimOn();}
      // Add the listeners. Hear ye, here ye.
      if (typeof window.addEventListener !== "undefined") {
        // Firefox, Mozilla, et al.
        window.addEventListener("blur", animOff, false);
        window.addEventListener("focus", animOn, false);
      } else if (typeof window.attachEvent !== "undefined") {
        // Internet Explorer
        bIsMSIE = true;
        window.attachEvent("onfocus", animOn);
    // Another bug: window.onblur ALWAYS fires in IE, so
    // we have to keep track of what we're clicking using
    // another method:
    active_element = document.activeElement;
    document.attachEvent("onfocusout", animOff);
      // Necessary to trigger toggling in FF if the page hasn't actually been clicked in and the page
      // is sent to the background. Can be commented out if necessary, e.g. if you don't want the page
      // popping to the top or want focus to remain somewhere else like a form field.
      window.focus();
    ]]></script>;

    I added this code and it removes the externally loaded swfs.  I don't want that, I want them to pause and then resume when the tab is back in foucs.  Also, the main code restarts the main movie clip upon refocusing too.
    Added code:
    function toggleAllLoaders(doAnim, loader) {
    if ( loader is Loader) {
      if (doAnim) {
       loader.play();
      } else {
       loader.stop();
      for (var i = 0; i<loader.numChildren; i++) {
       toggleAllLoaders(doAnim, loader.getChildAt(i));
    I added the new function to all of the places that had the "toggleAllClips" function.

  • When running a scenario from Unix ( $ prompt)it cant found the DTD for xml

    Dear All,
    I have created an interface that extracts xml messages from JMS queue ( OC4J) successfully. After extracting the message from JMS queue, the interface parse the message and put into an oracle database.
    After when I have created a scenario from the above Interface and tried to run the scenario from $ promt in unix using startscen.sh, it is giving following error message.
    # call the configuration setup file--- Mandatory for running ODI scenario
    . $ODI_HOME/bin/odiparams.sh;
    # Call the scenario for getting Message from JMS queue
    . $ODI_HOME/bin/startscen.sh PKG_JMS_XML 001 GLOBAL "-v=5" | tee out_$$.txt;
    The error I am getting as below
    03/09/2009 05:09:40 PM(main): SnpExpTxt.getObjectLst : :
    [FirstDate:2009-03-09 17:09:40.0
    FirstUser:SUNOPSIS AGENT
    IndChange:null
    IntVersion:null
    ITxt:5194100
    LastDate:2009-03-09 17:09:40.0
    LastUser:SUNOPSIS AGENT
    Txt:0 : 08001 : java.sql.SQLException: Cannot load connection class because of underlying exception: 'java.sql.SQLException: No DTD found and no XML file provided: the XML schema cannot be created'.
    java.sql.SQLException: Cannot load connection class bec
    TxtOrd:0, FirstDate:2009-03-09 17:09:40.0
    FirstUser:SUNOPSIS AGENT
    IndChange:null
    IntVersion:null
    ITxt:5194100
    LastDate:2009-03-09 17:09:40.0
    LastUser:SUNOPSIS AGENT
    Txt:ause of underlying exception: 'java.sql.SQLException: No DTD found and no XML file provided: the XML schema cannot be created'.
         at com.sunopsis.jdbc.driver.JMSXMLDriver.connect(JMSXMLDriver.java)
         at com.sunopsis.sql.SnpsConnection.u(SnpsConnection.
    TxtOrd:1, FirstDate:2009-03-09 17:09:40.0
    FirstUser:SUNOPSIS AGENT
    IndChange:null
    IntVersion:null
    ITxt:5194100
    LastDate:2009-03-09 17:09:40.0
    LastUser:SUNOPSIS AGENT
    Txt:java)
         at com.sunopsis.sql.SnpsConnection.c(SnpsConnection.java)
         at com.sunopsis.sql.i.run(i.java)
    TxtOrd:2]
    Anybody please help ?
    regards
    Umapada

    Hello,
    Try to remove and recreate your package and scenario, I had the same issue and solved doing it.
    It seems for me that the package cannot update its contents, for example, if you change something in your interface, you must recreate your package and scenario to update the changes.
    What ODI version do you use? If you use an old version, try to update to ODI 10.1.3.5
    Regards,
    Wallace Galvão
    São Paulo - Brazil

  • Problem when trying to load an XML document with DTD or XML SCHEMA

    Hello
    I have tried to load an XML document in Data Services, and I created the xsd file and Dtd file. (With altova xml spy software automatically) to import into SAP Data Services 3.2. .
    In Data Services I created the dtd import file DTD and then called the XML file from the DTD (the xml file is validated vs the dtd file), and I could not read the xml correctly because it tells me that an ELEMENT called <item> expected joiners who did not come in the structure of import (dtd), but if the xml.
    I understand that the document root is the label: CUSTOMER_FULL_2014, the data flow is as follows:CARGA_XML_CUSTOMER |
    Turns out the joiners element is used to separate the xml elements are repeated, but is used at different levels. My idea is that the design will dtd second, or something I'm missing or is incorrectly stated.
    Thank you.
    xml
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    <?xml version="1.0" encoding="utf-8"?>
    <CUSTOMER_FULL_2014>
      <item>
      <CUST_NO>202222</CUST_NO>
      <ADDRESS>
      <item>
      <SHIP_TO>202222</SHIP_TO>
      <NAME1>Henley.</NAME1>
      <STREET>Vitacura #40</STREET>
      <CITY>LIMA</CITY>
      </item>
      </ADDRESS>
      <EQUIPMENT>
      <item>
      <EQUI_NO>81623</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>81633</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>81993</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82003</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82013</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82103</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82113</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>581203</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>900003-EMER</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>9000033-STOCK</EQUI_NO>
      </item>
      </EQUIPMENT>
      <STORAGE_LOC>
      <item>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      </item>
      <item>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 henley</DESCRIPTION>
      </item>
      </STORAGE_LOC>
      </item>
      <item>
      <CUST_NO>2007933434343</CUST_NO>
      <ADDRESS>
      <item>
      <SHIP_TO>2007933434343</SHIP_TO>
      <NAME1>Campos de Almacenaje SA</NAME1>
      <STREET>Calacoto2, Calle 1</STREET>
      <HOUSE_NO>Piso 1</HOUSE_NO>
      <CITY>La Paz</CITY>
      </item>
      </ADDRESS>
      <EQUIPMENT>
      <item>
      <EQUI_NO>90000-EMER</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>90000333-STOCK</EQUI_NO>
      </item>
      </EQUIPMENT>
      <STORAGE_LOC>
      <item>
      <STOR_LOC_NO>00012</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      </item>
      <item>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 henley</DESCRIPTION>
      </item>
      </STORAGE_LOC>
      </item>
      <item>
      <CUST_NO>200801333</CUST_NO>
      <ADDRESS>
      <item>
      <SHIP_TO>200801333</SHIP_TO>
      <NAME1>CONSTRUCTORA SA.</NAME1>
      <STREET>Ruta Panamericana Km 100</STREET>
      <CITY>San Antonio 23</CITY>
      </item>
      </ADDRESS>
      <EQUIPMENT>
      <item>
      <EQUI_NO>1507933</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>1509733</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>90000-EMER</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>90000333-STOCK</EQUI_NO>
      </item>
      </EQUIPMENT>
      <STORAGE_LOC>
      <item>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      </item>
      <item>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 henley</DESCRIPTION>
      </item>
      </STORAGE_LOC>
      </item>
    </CUSTOMER_FULL_2014>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ARCHIVO DTD CREADO (automáticamente con xml spy)
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- DTD generado con XMLSpy v2014 rel. 2 (x64) (http://www.altova.com) -->
    <!ELEMENT CITY (#PCDATA)>
    <!ELEMENT item ((SHIP_TO, NAME1, STREET, HOUSE_NO?, CITY) | (CUST_NO, ADDRESS, EQUIPMENT, STORAGE_LOC) | (STOR_LOC_NO, DESCRIPTION) | EQUI_NO)>
    <!ELEMENT NAME1 (#PCDATA)>
    <!ELEMENT STREET (#PCDATA)>
    <!ELEMENT ADDRESS (item)>
    <!ELEMENT CUST_NO (#PCDATA)>
    <!ELEMENT EQUI_NO (#PCDATA)>
    <!ELEMENT SHIP_TO (#PCDATA)>
    <!ELEMENT HOUSE_NO (#PCDATA)>
    <!ELEMENT EQUIPMENT (item+)>
    <!ELEMENT DESCRIPTION (#PCDATA)>
    <!ELEMENT STORAGE_LOC (item+)>
    <!ELEMENT STOR_LOC_NO (#PCDATA)>
    <!ELEMENT CUSTOMER_FULL_2014 (item+)>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    The error of MONITOR Data Services
    11676
    5184
    XML-240108
    11-04-2014 17:34:16
    |Data flow CARGA_XML_CUSTOMER|Reader READ MESSAGE customer OUTPUT(customer)
    11676
    5184
    XML-240108
    11-04-2014 17:34:16
    An element named <item> present in the XML data input does not exist in the XML format used to set up this XML source in data
    11676
    5184
    XML-240108
    11-04-2014 17:34:16
    flow <CARGA_XML_CUSTOMER>. Please validate your XML data.
    11676
    5184
    XML-240307
    11-04-2014 17:34:16
    |Data flow CARGA_XML_CUSTOMER|Reader READ MESSAGE customer OUTPUT(customer)
    11676
    5184
    XML-240307
    11-04-2014 17:34:16
    XML parser failed: See previously displayed error message.
    The Error from Monitor
    The metadata DTD
    Thanks
    Juan

    Hi Juan Juan,
    I generated a new XSD file using MS Visual Studio based on your XML file.
    The empty spaces in the source is replaced with <Null> in the target table.
    Here is the XSD:
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="CUSTOMER_FULL_20140207_033015_001">
            <xs:complexType>
                <xs:sequence>
                    <xs:choice maxOccurs="unbounded">
                        <xs:element name="CUST_NO" type="xs:unsignedInt" />
                        <xs:element name="ADDRESS">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="SHIP_TO" type="xs:unsignedInt" />
                                    <xs:element name="NAME1" type="xs:string" />
                                    <xs:element name="STREET" type="xs:string" />
                                    <xs:element minOccurs="0" name="HOUSE_NO" type="xs:string" />
                                    <xs:element name="CITY" type="xs:string" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                        <xs:element name="EQUIPMENT">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element maxOccurs="unbounded" name="EQUI_NO" type="xs:string" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                        <xs:element name="STORAGE_LOC">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:choice maxOccurs="unbounded">
                                        <xs:element name="STOR_LOC_NO" type="xs:unsignedByte" />
                                        <xs:element name="DESCRIPTION" type="xs:string" />
                                    </xs:choice>
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:choice>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>
    For Source XML
    <?xml version="1.0" encoding="utf-8"?>
    <CUSTOMER_FULL_20140207_033015_001>
      <CUST_NO>200530</CUST_NO>
      <ADDRESS>
      <SHIP_TO>903533</SHIP_TO>
      <NAME1>HENLEY - PART MAQUINARIAS S.A.</NAME1>
      <STREET>Dean Camilo # 148, San Carlos</STREET>
      <CITY>LIMA</CITY>
      </ADDRESS>
      <EQUIPMENT>
      <EQUI_NO>4442</EQUI_NO>
      <EQUI_NO>8163</EQUI_NO>
      <EQUI_NO>8199</EQUI_NO>
      <EQUI_NO>8200</EQUI_NO>
      <EQUI_NO>8201</EQUI_NO>
      <EQUI_NO>8210</EQUI_NO>
      <EQUI_NO>8211</EQUI_NO>
      <EQUI_NO>58120</EQUI_NO>
      <EQUI_NO>90000-EMERGENCY</EQUI_NO>
      <EQUI_NO>90000-STOCK</EQUI_NO>
      </EQUIPMENT>
      <STORAGE_LOC>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 HEN</DESCRIPTION>
      </STORAGE_LOC>
      <CUST_NO>200793</CUST_NO>
      <ADDRESS>
      <SHIP_TO>200793</SHIP_TO>
      <NAME1>Minera San Cristobal S.A.</NAME1>
      <STREET>Calacoto, Calle 90, Torre 2</STREET>
      <HOUSE_NO>Piso 5</HOUSE_NO>
      <CITY>La Paz</CITY>
      </ADDRESS>
      <EQUIPMENT>
      <EQUI_NO>90000-EMERGENCY</EQUI_NO>
      <EQUI_NO>90000-STOCK</EQUI_NO>
      </EQUIPMENT>
      <STORAGE_LOC>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 HEN</DESCRIPTION>
      </STORAGE_LOC>
      <CUST_NO>200801</CUST_NO>
      <ADDRESS>
      <SHIP_TO>200801</SHIP_TO>
      <NAME1>ISEMAR S.A.</NAME1>
      <STREET>Ruta Km 28.45</STREET>
      <CITY>Don Torcuato Paraguay</CITY>
      </ADDRESS>
      <EQUIPMENT>
      <EQUI_NO>15079</EQUI_NO>
      <EQUI_NO>15097</EQUI_NO>
      <EQUI_NO>90000-EMERGENCY</EQUI_NO>
      <EQUI_NO>90000-STOCK</EQUI_NO>
      </EQUIPMENT>
      <STORAGE_LOC>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 HEN</DESCRIPTION>
      </STORAGE_LOC>
    </CUSTOMER_FULL_20140207_033015_001>
    Output:
    Regards,
    Akhileshkiran.

  • Parse xml file with validating againat dtd

    i have a xlm file looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map SYSTEM "map.dtd">
    <map width="20" height="15" goal="25" name="eXtreme Labyrinth of Dooom">
    <random-item type='lantern' amount='5' />
    <random-item type='health' amount='10' />
    <tile x="14" y="0" type="wall">
    <renderhint>wall:rock,cracked</renderhint>
    </tile>
    <tile x="15" y="0" type="wall" />
    <tile x="16" y="0" type="floor">
    <renderhint>floor:marble,cracked</renderhint>
    </tile>
    <tile x="17" y="0" type="floor">
    <renderhint>floor:stone,rubble</renderhint>
    </tile>
    <tile x="18" y="0" type="floor" />
    <tile x="0" y="1" type="floor" />
    <tile x="1" y="1" type="floor" startlocation="1" />
    <tile x="2" y="1" type="floor" />
    <tile x="3" y="1" type="floor">
    <item type="treasure">Bar of Silver</item>
    <renderhint>floor:stone,blood</renderhint>
    </tile>
    <tile x="4" y="1" type="wall" />
    <tile x="5" y="1" type="wall" />
    <tile x="6" y="1" type="wall">
    <renderhint>wall:bricks,cracked</renderhint>
    </tile>
    </map>and a dtd document like:
    <!ELEMENT map (random-item+, tile+)>
    <!ATTLIST map
    width CDATA #REQUIRED
    height CDATA #REQUIRED
    goal CDATA #REQUIRED
    name CDATA #REQUIRED
    <!ELEMENT random-item EMPTY>
    <!ATTLIST random-item
    type (armour|health|sword|treasure|lantern) #REQUIRED
    amount CDATA #REQUIRED
    <!ELEMENT tile (item|renderhint)*>
    <!ATTLIST tile
    x CDATA #REQUIRED
    y CDATA #REQUIRED
    type (exit|floor|wall) #REQUIRED
    startlocation CDATA #IMPLIED
    <!ELEMENT item (#PCDATA)>
    <!ATTLIST item
    type (armour|health|sword|treasure|lantern) #REQUIRED
    <!ELEMENT renderhint (#PCDATA)>i need to validate the xml file against the dtd document and parse it to java using DOM.
    Can anyone give ma any suggestions on how to do it?
    thank you

    i have started my coding like:
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import java.io.*;
    class loadxml
        public static void main(String[] args)
         try {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setValidating(true);
              factory.setIgnoringElementContentWhitespace(true);
              DocumentBuilder parser = factory.newDocumentBuilder();
              Document doc = parser.parse(new File("hallways.xml"));
              loadxml load = new loadxml();
              load.parseNode(doc);
         } catch (ParserConfigurationException e) {
              e.printStackTrace();
         } catch (SAXException e) {
              e.printStackTrace();
         } catch (IOException e) {
              e.printStackTrace();
        public void parseNode (Node node) throws IOException
               // here is where i have problem with
    }since in my xml file, i have got ATTLIST, this ready confuses me when i try to coding it.
    Can anyone help me, please.
    Thank you.
    Edited by: mujingyue on Mar 12, 2008 3:10 PM

  • Deployment validation failing to load DTDs for Struts

    I created a fresh webapp that includes the Struts 1.2.2 binaries and got some errors when deploying on WebLogic8.1sp3. My guess is that I need to configure some proxy setting in weblogic.
    Sep 7, 2004 4:07:14 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactoryINFO: Tiles definition factory loaded for module ''.
    Sep 7, 2004 4:07:14 PM org.apache.struts.validator.ValidatorPlugIn initResources
    INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
    Sep 7, 2004 4:07:14 PM org.apache.struts.validator.ValidatorPlugIn initResources
    INFO: Loading validation rules file from '/WEB-INF/validation.xml'
    <Sep 7, 2004 4:07:14 PM CDT> <Warning> <Net> <BEA-000905> <Could not open connection with host: jakarta.apache.org and port: 80.>
    Sep 7, 2004 4:07:14 PM org.apache.struts.validator.ValidatorPlugIn init
    SEVERE: Tried all: '1' addresses, but could not connect over HTTP to server: 'jakarta.apache.org', port: '80'
    java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'jakarta.apache.org', port: '80'
    at weblogic.net.http.HttpClient.openServer(Ljava.lang.String;I)V(HttpClient.java:275)
    at weblogic.net.http.HttpClient.openServer()V(HttpClient.java:329)
    I copied the referenced .DTDs locally and after adding the full path to the local copies, things worked fine. Unfortunately this is just a big hack. I would like to know either:
    1. how to package the things so that a local copy of the DTDs that I include in a .ear file can be found, or
    2. how to configure proxy settings in weblogic so I can validate against remote DTDs.
    Any ideas?

    the exception seems to suggest that you cant connect to the outside world. Can you check if you can connect to the mentioned remote server from your deployment machine ?
    anand

  • XML/DTD to be converted to XSD

    Hi ,
    I have requirement that i am getting xml file as input which i need to read through inbound file adaptor and write another delimited file.
    The challenge i am facing is i am not able to transmit xml file to xsd file trough native format builder.
    Can you please provide solution for generating xsd file for xml files.
    Note: There is format type called "DTD to be converted to XSD" under native format builder wizard.Is it like that first we need to convert xml to DTD then XSD?
    If so can you please geve me small example of demonstrating these steps,because whenever i try with sample dtd file i am getting error: "No element found in DTD Specified"
    My sample file "note.dtd" is <?xml version="1.0"?>
    <!DOCTYPE note [
    <!ELEMENT note (to,from,heading,body)>
    <!ELEMENT to (#PCDATA)>
    <!ELEMENT from (#PCDATA)>
    <!ELEMENT heading (#PCDATA)>
    <!ELEMENT body (#PCDATA)>
    ]>
    <note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>Don't forget me this weekend</body>
    </note>
    Thanks in advance.

    U can use Document Editor tool to convert XML file to DTD. The steps are
    File-->Import-->Chose DTD from XML file option and give ur file as input-->It will convert ur XML file into ECS file-->File-->Export-->select XML DTD option and this will convert the ECS file to DTD file
    U can use BPEL to convert DTD file to XSD. The steps are
    Tools-->Convert DTD to XSD and give ur DTD file as Input-->It will convert ur DTD file to XSD file
    I hope it will help.
    Thanks,
    Saravana
    Edited by: user10635261 on Nov 20, 2008 9:41 AM

  • DOM Parser Configuration...how to switch off DTD validation?

    Hi all,
    I am developing some implementation code in Java using JBuilder2005, in which DOM3 parser is also being utilised. Now the question is how to switch off DTD validation (seems its default mode is 'on') so that no validation will be carried out at all even DTD declaration statement is presented in an input XML document?
    Many thanks in advance
    Frank

    First of all, thank you so much for responding, DrClap. =)
    setValidating(false) of the DocumentBuilderFactory instance, factory, does not work as expected; it still stubbornly try to seek the external DTD file and fires 'IOException' error in case of no such a DTD.
    To follow up the EntityResolver approach, I searched online for almost the whole afternoon but still could not figure out how to do it exactly. In particular, I found http://www.jdom.org/docs/faq.html#a0350, which tells a way doing it, but I got 'StringBufferInputStream is deprecated' error. Then I changed to
    new InputStream(new ByteArrayInputStream("".getBytes()))adapted from http://forum.java.sun.com/thread.jspa?threadID=572919&messageID=2842185. But another error occurs: 'java.io.InputStream is abstract; cannot be instantiated'. Furthermore, I have looked at many docs(tutorials, APIs...) on parser configuration, usage of EntityResolver/setEntityResolver()...but they turned out not helpful. Could you please give out more details on how to do this using EntityResolver?? Many many thanks...

  • Importing XML DTD in 10.1.2.0.0

    Hi,
    We are attempting to import Common Data Types using DTD's and experiencing some strange behaviour.
    I have defined my DTD as detailed in the user guides.
    <!ELEMENT account (cust_account_id,account_number,attribute_category, etc ... )>
    <!ELEMENT cust_account_id (#PCDATA)>
    <!ELEMENT account_number (#PCDATA)>
    <!ELEMENT attribute_category (#PCDATA)>
    etc ...
    The import step appears to work fine and at the end of this process the CDT attributes appear as required and expected.
    If we close iStudio and reopen, then attempt to edit the CDT we encounter an issue as it appears that account belongs to account beloings to account and so on .... i.e. we seem to get into an infinite loop.
    Has anyone experienced/resolved this issue before?
    Thanks,
    Michael.

    I have identified a workaround.
    CDT -> New; Import XML - choose relevant dtd, e.g. account.dtd
    CDT created ... but type = account.
    Re-import account.dtd - get a second account in CDT - this time the type = account2.
    Delete first account entry. Then Save.
    The CDT is available for use - no recursive loop.
    This sill doesnt explain why we are unable to import successfully at first attempt however.

  • ANN: New XDK release for 9.0.2B and 9.0.1.1.0A available

    New XDK Releases for 9.0.2B Beta Version and 9.0.1.1.0A Procudtion Version are online at:
    http://technet.oracle.com/tech/xml/xdkhome.html
    What's new:
    - Oracle9i XDK for C and C++ released on Linux
    - Oracle TransX Utility Aids loading data and text.These release is part of the XDK for Java 9.0.2 Beta.
    - Oracle SOAP APIs added to the XDK for Java
    Support for the SOAP services have been added to the XDK for Java 9.0.1.1.0A Production.
    - XML Schema Processor for Java supports both LAX Mode and STRICT Mode Validation
    The XML Schema Processor for Java now supports both LAX Mode and STRICT
    Mode Validation. Compared with STRICT Mode where every element from the root on down is required to be defined and validated, LAX Mode Schema validation provides developers the ability to limit the XML Schema
    validation to the subsections of the XML document.
    This will simplify XML Schema definitions and the validation process by skipping the ignorable content. Furthermore, with LAX mode, developers can divide their XML documents into small fragments and carry out the XML Schema validation in a parallel or progressive way. This results, in a much more flexible and productive schema validation process.
    - SAX2 Extension support in the Java XML Parser
    The XML Parser for Java now supports two new handlers - LexicalHandler and DeclHandler.
    XML documents now can be parsed through Oracle XML Parser SAX APIs with full access
    to the DTD declarations and the lexical items like comments and CDATA sections.
    This ensures that the complete content model is preserved.
    - JAXP 1.1 supports is now added to the XDK for Java
    - New Differ Bean in the XDK for JavaBeans
    A new bean has been added the the JavaBean XDK which analyses the differences between to XML documents and outputs the XSL sytlesheet that will convert one into the
    other. This is extremely useful when converting an XML document retrieved from a SQL query into an xHTML page on the web.
    Stylesheets can now be automaticly created for use in XSQL pages.
    - XML Compression now supported in the Java XML Parser
    Now developers can take advantage of a compressed XML stream when serializing their DOM and SAX outputs. This new functionality significantly reduces the size without losing any information. Both DOM and SAX compressed streams are fully compatible and the SAX stream can be used to generate a
    corresponding DOM tree. These compressed streams can also be stored in Oracle as a CLOB for efficient storage and retrieval.

    bump up for east cost.

  • Use external DTD in 11g

    Hi,
    I try to parse an XML file within a CLOB column. In Oracle 9i and 10g the code work, but in 11 I get a lot of errors.
    First I got
    ORA-31020: Der Vorgang ist nicht zulässig, Ursache: For security reasons, ftp and http access over XDB repository is not allowed on server side (-31020)
    The XML file contains a reference to an external DTD, which is accessible per HTTP on a remote webserver.
    As I have understood, I have to register all my DTDs within the Oracle Database. I found
    dbms_xmlschema.registerURI()
    to do the job. This is very unpractical, because there are a lot of DTDs, which can be referenced by the XML-CLOBs. So I have to register all the DTDs manually.
    Normally the XML generator adds the matching DTD reference and so I can validate the XML with the parser without any knowledge about the type of the DTD.
    To figure out the problem I read a lot of documents on severyl websites. I have tried
    select HTTPURITYPE('http://mywebserver.domain/schema/mydtd-v1.0.dtd').getCLob() from dual;
    to load the DTD content. Surprise, surprise I got a lot of ACL errors. To solve that, I have added some network acls. At the moment the statement above
    returns my DTD within a CLOB now, so it seems, that I can load the external file from the remote webserver.
    Back to registerURI():
    dbms_xmlschema.registerURI(
          schemaURL => 'http://mywebserver.domain/schema/mydtd-v1.0.dtd',
          schemaDocUri => 'http://mywebserver.domain/schema/mydtd-v1.0.dtd',
          local => false);
    returns now (error messages in German)
    ORA-31011: XML-Parsing nicht erfolgreich
    ORA-19202: Fehler bei XML-Verarbeitung
    LPX-00247: Ungültige Dokument-Typ-Deklaration (DTD)
    Error at line 5
    aufgetreten
    ORA-06512: in "XDB.DBMS_XMLSCHEMA_INT", Zeile 20
    ORA-06512: in "XDB.DBMS_XMLSCHEMA", Zeile 199
    ORA-06512: in Zeile 12
    The same error occurs on
    dbms_xmlschema.registerschema(
          schemaURL => 'http://mywebserver.domain/schema/mydtd-v1.0.dtd',
          schemaDoc => HTTPURITYPE('http://mywebserver.domain/schema/mydtd-v1.0.dtd').getCLob()
    How I can get more information about the underlying error? I have tried to enable tracing for some XDB events, but in the udump directory
    exist only old files. I think, the DTD is correct, also the reference within the XML CLOB (because it works on the old database instances).
    It seems to be a security or character-set(?) issue.
    Any ideas?
    Thanks a lot
    Andre

    As I have understood, I have to register all my DTDs within the Oracle Database.
    Not exactly.
    DBMS_XMLSchema procedures deal with XML schemas, not DTDs.
    You can have Oracle resolve the DTD by loading it into the XML DB repository at the same uri referenced by the XML file.
    Or, if you don't actually need to use those DTDs to validate XML documents, you can also disable DTD validation altogether at session or instance level.

Maybe you are looking for

  • Bluetooth on Macbook Pro dead in Leopard

    When I first booted into Leopard after an upgrade installation, my bluetooth mighty mouse worked fine. I did a software updated and restarted at which time the mighty mouse failed to work. I have tried the following: Safe boot Turning mouse off and o

  • Safari crashes on MAC OS 10.4.11

    hello!! i would like to ask some help.  my safari has been crashing when i open certain websites, most especially if its youtube.  it has also been crashing on gmail and even apple support at times.  i cannot reinstall flash player because as soon as

  • Can I label individual photos in iphoto

    Can I individually label photos in iphoto?

  • "Optimising Photos for iPod" Does this affect photos in iPhoto Library?

    Hi, I have a question regarding syncing pictures which are stored in my iPhoto library with my iPod touch. I notice when I sync photos I get a message that iTunes is "optimising photos for iPod" 1) Does this mean that 'quality' of the photos is reduc

  • BC Set

    Dear's During BC Set creation we are facing problem of "no data content". While saving BC Set showing Yellow legend. Information message getting regarding the Language problem. Language setting in the SCPR3 checked.. Regards, Kedar