A generic XML DTD

Hi
     I am a newbie to XML and I have a question on XML/Java, hopefully, you guys would be able to give me some pointers to solve this problem.
     Here is the scenario. I need to design (might have to implement as well) a set of Java libraries that can retrieve data (basically, it's some kind of contents, it can be anything, more on this later) and base on the data I retrieved, I would generate a html file (which contains those contents and have the contents displayed).
     Those data (contents) I talked about earlier could be some news item, could be lottery results, could be a travel guide, could be anything. Those data would originally come from a XML file and then store into a database table. (or could just be in a file if there isn't much data). Either way, my programs should be able to read the data from the database/files and somehow "decrypt" it.
     Now, my problem is since the data could contain any kind of data, how do I define a DTD that is so generic that can treat all kinds of contents as the same. By that, I mean, e.g if it was a book review article, it might contain the book's name, the author, the review, the review date...etc, I would imagine that the DTD would contain tags like TITLE, AUTHOR, REVIEW DATE, REVIEW...etc. With all these data, they would be stored into a table, may be just a text field in that table. And then my programs would read from that field and break up those tags and display them accordingly (generate a html file) . But what if it is a lottery result, then the DTD that I defined earlier (for news) would not be applicable for the lottery result content. That means, in order to treat everything as just pure content, I can only have a tag, say content, and for the book review article, this tag would just wrap everything into itself (from the book's name, author....etc) and for the lottery results, the content tag would just contain the numbers. I must say, I have minimal XML knowledge, so please correct me if I am wrong here. But again, how would you define a DTD for such scenario? Is it possible to define such a DTD? Not to mention the style of the contents.......Please, I need help. THx
ForeverJava
anywhere else is a better place for XML forums?

You certainly could water down a DTD to handle all of the different types of events that you are encountering. At this point though the DTD becomes so permissive that it is almost of no use.
If you are using an XML parser to get at the data it will have to be well-formed. You might as well turn validation off, if the structure is so loose.
Can you apply a different DTD based on the type of request that is coming back? For example if it's lotto results apply lotto.dtd if it's scores apply scores.dtd, etc.
You could probably even wrap a root level around the entire document that is consistent and then require one of the data type (lotto, score, etc.) levels next and then proceed.
Hopefully some of this makes sense-
-Mike

Similar Messages

  • 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

  • Generic XML Parser for PL/SQL

    Is there a generic XML parser written in PL/SQL that does not
    rely on java that will run against a 7.3.4 database?
    If please let me know where I can locate it.
    Thanks,
    Tim
    null

    Tim (guest) wrote:
    : Is there a generic XML parser written in PL/SQL that does not
    : rely on java that will run against a 7.3.4 database?
    : If please let me know where I can locate it.
    : Thanks,
    : Tim
    There is not one currently but there are plans to provide the
    PL/SQL one on top of our C version. You can also check out the
    PLXML Utilities that have a limited version.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Generic xml writer

    We have a new client that we need to send multiple xml file's to and I want to create a generic xml writer so I can pass in the data along with mapping document an be able to create the nodes off of the mapping document, I hope this makes sense, so if anyone has any examples or can point me in the right direction I would appreciate it

    thevig wrote:
    can point me in the right directionDesign first. Program and test next. Ask questions here if you have specific problems.

  • Strip off markups of generic XML data with E4X

    I have a generic XML file:
    <nodes>
    <node1 att1='abc' att2='xyz'>
    <ele1> Hello </ele1>
    <ele2> Hi </ele2>
    </node1>
    </nodes>
    The tag and attribute names above can be anything. I need a
    generic method to strip off the XML markups and display the
    contents as:
    node1@att1: abc
    node1@att2: xyz
    node1.ele1: Hello
    node1.ele2: Hi
    How can E4X do this?

    e4x is for manipulating/navigating your xml. But you can use
    it inside a for/each loop to look at your xml nodes and extract the
    strings without the xml tags using toString().
    Search the help docs for "XML type conversion" and see the
    toString() method in action.

  • XML DTD - Table or Object

    Dear all,
    Do you have any guideline or good example to model db tables for nested Structure of XML DTD?
    How can I create table or objects for following XML DTD?
    <!ELEMENT book (title, author, Chapter*)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT author (#PCDATA)>
    <!ELEMENT Chapter (content, body?)>
    <!ELEMTNS content (#PCDATA)>
    <!ELEMENT body (#PCDATA)>
    null

    i hope that this exampel of nested table will help you
    create or replace type test1_obj as object (num1 number(4),num2 number(4));
    create type test1_obj_teble as table of test1_obj;
    create table test101(csec number(4),tnum number(4),ditals test1_obj_teble) nested table ditals store as test1_ditals;
    /

  • Discrepancy between weblogic-ejb-jar.xml DTD and documentation

    There seems to be a discrepancy between the DTD for the weblogic-ejb-jar.xml file
    and the WLS7 documentation: Which source of information should I treat as
    For example, the WLS7 documentation contains no information on the <idempotent-methods>
    element (and its child elements)
    (There is also a (larger) discrepancy between the weblogic-application.xml DTD and
    the docs - I will post that Q under application deployment)
    Regards,
    Nick

    Yep, I noticed it too. I used DTD, of course.
    "Nick Minutello" <[email protected]> wrote
    in message news:[email protected]..
    >
    >
    There seems to be a discrepancy between the DTD for theweblogic-ejb-jar.xml file
    and the WLS7 documentation: Which source of information should I treat as
    For example, the WLS7 documentation contains no information on the<idempotent-methods>
    element (and its child elements)
    (There is also a (larger) discrepancy between the weblogic-application.xmlDTD and
    the docs - I will post that Q under application deployment)
    Regards,
    Nick

  • Help needed with binary data in xml (dtd,xml inside)

    I am using the java xml sql utility. I am trying to load some info into a table.
    my.dtd:
    <!ELEMENT ROWSET (ROW*)>
    <!ELEMENT ROW (ID,JPEGS?)>
    <!ELEMENT ID (#PCDATA)>
    <!ELEMENT DESCRIPTION EMPTY>
    <!ATTLIST DESCRIPTION file ENTITY #REQUIRED>
    <!NOTATION INFOFILE SYSTEM "Files with binary data inside">
    <!ENTITY file1 SYSTEM "abc.jpg" NDATA INFOFILE>
    xml file:
    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE ROWSET SYSTEM "MY.DTD">
    <ROWSET>
    <ROW>
    <ID>1272</ID>
    <DESCRIPTION file="file1"/>
    </ROW>
    </ROWSET>
    I am using the insertXML method to do this. However, the only value that gets loaded is the ID. abc.jpg is in the same directory where I ran the java program.
    Thanks in advance.

    Sorry! wrong dtd. It should read this instead:
    my.dtd:
    <!ELEMENT ROWSET (ROW*)>
    <!ELEMENT ROW (ID,DESCRIPTION?)>
    <!ELEMENT ID (#PCDATA)>
    <!ELEMENT DESCRIPTION EMPTY>
    <!ATTLIST DESCRIPTION file ENTITY #REQUIRED>
    <!NOTATION INFOFILE SYSTEM "Files with binary data inside">
    <!ENTITY file1 SYSTEM "abc.jpg" NDATA INFOFILE>
    null

  • How to insert XML/dtd data into oracle db

    Hi,
    I have posted this question on couple
    sites and unfortunately I haven't received
    any response. Hopefully this time,
    someone can at least direct me to the
    website/document/sample codes which can provide me solutions of my question.
    My question is:
    Given a DTD, can the XML SQL Utility generate
    the database schema?
    I am trying to find out how the XML data can
    be loaded into the oracle database.
    Thanks in advance,
    Judy
    null

    A DTD does not contain enough information to do a good job at creating a database schema. It contains no datatype information, no field length information for starters, so a table created by a hypothetical DTD->to->Tables utility would be at best able to create a table with all VARCHAR2(4000) columns. Not that useful.
    My book contains lots of examples of techniques for loading XML data into Oracle, include lots of sample code and a whole chapter devoted to building a flexible "XMLLoader" utility for loading XML of arbitrary size into the database.
    Steve Muench
    Development Lead, Oracle XSQL Pages Framework
    Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
    Author, Building Oracle XML Applications
    null

  • Ejb-jar.xml DTD validation error?

    I am attempting to deploy a JAR on App Server 8 PE. The application does not contain any EJBs but I understand that the ejb-jar.xml descriptor is still needed. I am running the app server on Windows XP.
    My issue is as follows:
    I understand that the root element for the ejb-jar.xml file (<ejb-jar>) is required. Since I have no EJBs, I should be able to leave this root element blank (as I have in previoius successful deployments to earlier versions of Sun App Server). When I attempt to deploy, I receive the following DTD Validation error via the admin console:
    The content of element type "ejb-jar" is incomplete, it must match "(description?,display-name?,small-icon?,large-icon?,enterprise-beans,relationships?,assembly-descriptor?,ejb-client-jar?)".
    Am I missing something?
    My ejb-jar.xml file looks like:
    <!DOCTYPE ejb-jar PUBLIC
         "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
         "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    </ejb-jar>
    Many thanks in advance to any assistance...

    I am attempting to deploy a JAR on App Server 8 PE.
    The application does not contain any EJBs but I
    I understand that the ejb-jar.xml descriptor is still
    needed. I am running the app server on Windows XP.
    My issue is as follows:
    I understand that the root element for the
    ejb-jar.xml file (<ejb-jar>) is required. Since I
    have no EJBs, I should be able to leave this root
    element blank (as I have in previoius successful
    deployments to earlier versions of Sun App Server).
    When I attempt to deploy, I receive the following
    g DTD Validation error via the admin console:
    The content of element type "ejb-jar" is incomplete,
    it must match
    "(description?,display-name?,small-icon?,large-icon?,e
    nterprise-beans,relationships?,assembly-descriptor?,ej
    b-client-jar?)".
    Am I missing something?
    My ejb-jar.xml file looks like:
    <!DOCTYPE ejb-jar PUBLIC
    "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
    s 2.0//EN"
         "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    </ejb-jar>
    Many thanks in advance to any assistance...I hav tried this and it is working
    <?xml version="1.0" encoding="UTF-8" ?>
    <ejb-jar
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
    version="2.1">

  • 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.

  • FORMS6 - XML/DTD Sample Code???

    Dear Sirs:
    we are still developing FORMS 6 application. We would like to generate XML documents according to the definition contained in DTD files - a technology we still don't know.
    Do You know whether sample PL/SQL code dealing with XML and DTDs is available somewhere?
    Many Thanks
    Cesare Brizio
    Delta Informatica
    [email protected]

    Thank You for Your indications.
    I will examine the documentation about the XML DEVELOPERS KIT.
    I am not sure whether it works also with FORMS 6i, the elderly release we are still using. Presently, I must evaluate whether a viable FORMS 6i - based solution exists. If this is not the case, we will have to migrate to Forms 9i.
    Thanks.

  • Generic XML Structure solution/suggestions

    Hi,
    I am pretty new to XML, so looking for some suggestions.
    I want to create an XML structure for following data.
    I have Product P1, and Product P2
    P1 has following fields: F1,F2,F3,F4
    P2 has following fields:F0,F1, F3, F4, F5,F6
    You see both the products have some common fields and some extra fields.
    I want to make one XML structure (common to P1 and P2)that defines(tag value pair) both.
    I dont want something like say: If type == P1 then F5 and F6 field is null.
    It should not be defined for P1.
    lly F0 and F2 should not be defined for P2.
    Can anyone help me to define some common structure to accomplish this.

    Unless I'm missing something, what you want to do is set up the structure something like:
    <!element products(product*) >
    <!element product(f0*, f1*, f2*, f3*, f4* , f5*, f6*) >
    <!element f0 (#CDATA) >
    <!element f1 (#CDATA) >
    <!element f2 (#CDATA) >
    <!element f3 (#CDATA) >
    <!element f4 (#CDATA) >
    <!element f5 (#CDATA) >
    <!element f6 (#CDATA) >
    Obviously this changes depending on how often the data can recur and type of data, but this will give you an idea of DTD setup. Using schema would also give you the ability to define field length and such. Find a good DTD reference guide either online or from a book and it will give examples of the different recurring notations (*, + and the like). Hope this helps.

  • Web-services.xml, dtd or xml schema?

    Hi there!
    I'm just curious to know whether there exists any dtd or schema
    for wls 7.x web-services.xml file?
    The diagram in
    http://e-docs.bea.com/wls/docs70/webserv/wsp.html#1001373
    shows one order for the contents of the web-service element,
    whereas the examples reflect another (being types,
    type-mapping, components, operations).
    Why are the example web-services.xml not tagged with the
    information of the location of the schema?
    Of course building web-services.xml manually is not the first
    thing to try, but since the contents are documented and since
    it gives the best control over the process, it makes sense.

    Hello,
    There's not one. The primary vision for the web-services.xml file
    was/is to be a linkage between wsdl/soap and the j2ee environment. It
    was not intended to be a starting point for building an application, but
    a semi-private intermediary.
    HTHs,
    Bruce
    Toni Nykanen wrote:
    >
    Hi there!
    I'm just curious to know whether there exists any dtd or schema
    for wls 7.x web-services.xml file?
    The diagram in
    http://e-docs.bea.com/wls/docs70/webserv/wsp.html#1001373
    shows one order for the contents of the web-service element,
    whereas the examples reflect another (being types,
    type-mapping, components, operations).
    Why are the example web-services.xml not tagged with the
    information of the location of the schema?
    Of course building web-services.xml manually is not the first
    thing to try, but since the contents are documented and since
    it gives the best control over the process, it makes sense.

  • XML DTD Validation

    Hello,
    In my application I need to perform some XML validation against an DTD file.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Properties SYSTEM "MyFile.dtd">
    <Properties>
    <Property name="a" value="a1"/>
    </Properties> Both XML file and the DTD are located in the same folder.
    What I need, is to perform the XML validation against the DTD file from another location(more precisely, a DTD located in my application's jar) instead of the DTD from the same folder as XML file.
    The reason for this is because the remote DTD file is most probably outdated.
    This is how I do the validation curentlly:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    builder.setErrorHandler(new org.xml.sax.ErrorHandler()
    Document xmlDocument = builder.parse(destinationXMLFile.toURI().toString());
    DOMSource source = new DOMSource(xmlDocument);
    StreamResult result = new StreamResult(System.out);
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "MyFile.dtd");
    transformer.transform(source, result);Someone any idea?
    Thanks,
    johnny

    Unusual but if you need this way your application just must to implement EntityResolver that always points to resource DTD.
    []s

Maybe you are looking for

  • My Safari keeps quitting when i try to open it

    I was using Safari 8.0.2 on my Macbook Air 2013 (OS X Yosemite) and suddenly, safari quitted and subsequently when I try and open Safari, a message just pops up and says "Safari quit unexpectedly". There's an option that says "Reopen" but when I clic

  • How do i get two ipods on one computer

    Ok How can I share songs with two ipods on one computer!!! Help PLEASE !!!!!!!!!1

  • How do I use location based Reminders when my address does not show up in Apple Maps?

    I currently live overseas and Apple maps does not have any street names listed in my neighborhood.  I have tried dropping a pin on my house and adding it to contacts, but it just takes me back to the center of town which is about 5 miles from my hous

  • Another perl module packager

    CPANPLUS::Dist::Arch is a CPANPLUS backend to automatically package modules as you install them.  I started it several months ago and mess around with it every once and awhile.  I had made it because CPANPLUS::Dist::Pacman (or maybe I should say cpan

  • Promblem in opening file through scripting?

    I want to open a file in photoshop through javascript but i dont know how to specify path of the file in the script. I'm a mac user and new to scripting.........Pls help!!!!