Solved

Convert DTD to XML Schema using XML spy

Posted on 2009-05-05
32
1,515 Views
Last Modified: 2012-05-06
Hi experts,
                 I have a DTD that I want to convert into XML schema, So that I can use it with XMLBeans.
                Can someone please help me out with using XML spy for this purpose?
0
Comment
Question by:aman0711
  • 14
  • 12
  • 5
  • +1
32 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24306569
Can you post the DTD?
0
 
LVL 10

Author Comment

by:aman0711
ID: 24306859
hi CEHJ,
 
                 Here is the DTD

< ! ELEMENT T1   ( T1D?  ,  T1E?  )  >
< ! ELEMENT_T1D  ( AG1+  , S1+ ,  P1*  )  >
< ! ATTLIST T1E  ag_id   CDATA #REQUIRED  >  recommended 
< ! ELEMENT AG1  EMPTY >
< ! ATTLIST AG1    a_id        CDATA   #REQUIRED  >  required ag1 meta table
< ! ATTLIST AG1    des     CDATA   #REQUIRED  >  recommended, ag1 meta table
< ! ATTLIST AG1    weight    CDATA   #REQUIRED  >  note  deprecated field
< ! ATTLIST AG1   id    CDATA   #REQUIRED  >  recommended, ag1 meta table
< ! ATTLIST AG1   net     CDATA   #REQUIRED  >  recommended, ag1 meta table
< ! ATTLIST AG1   ins    CDATA   #REQUIRED   >  required ag1 meta table
< ! ATTLIST AG1   loc    CDATA   #IMPLIED  >  recommended, ag1 meta table
 
 
< ! ELEMENT P1  EMPTY  >
< ! ATTLIST P1   pr_id   CDATA   #REQUIRED  >  recommended, p1 meta data
< ! ATTLIST P1   pr_name   CDATA   #REQUIRED  >  recommended, p1 meta data
< ! ATTLIST P1   a_type   CDATA   #REQUIRED  >  recommended, p1 meta data
< ! ATTLIST P1   a_sub_type   CDATA   #REQUIRED  >  recommended, p1 meta data
 
 
< ! ATTLIST S1  ( PAGE_META_DATA+ )  >  recommended, p1 meta data
< ! ATTLIST S1  s_id   CDATA  #REQUIRED  > 
< ! ATTLIST S1  s_alias   CDATA  #REQUIRED  > required m1 meta table
< ! ATTLIST S1  count   CDATA  #REQUIRED  > recommended m1 meta table
< ! ATTLIST S1  sub   CDATA  #REQUIRED  > recommended,  m1 meta table
 
< ! ELEMENT PA1  EMPTY  >
< ! ATTLIST PA1   seq          CDATA  #REQUIRED  > recommended,  m1 meta table
< ! ATTLIST PA1   page_num        CDATA  #REQUIRED  > recommended,  m1 meta table

Open in new window

0
 
LVL 10

Author Comment

by:aman0711
ID: 24306870
Everytime i try to convert this using XML spy,

   its giving me errors like "_" not expected
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 86

Expert Comment

by:CEHJ
ID: 24306914
And it could be useful to post an actual instance of an xml file
0
 
LVL 10

Author Comment

by:aman0711
ID: 24306927
Here it is CEHj

<_DATA_>
     <T1 agreement_id="99999">
          <AG1 aid="1" in_id="3" plc="ccc" des="Dummy" reg="abcd" ip="121.0.0.1" net="xyz" weight="1" city="loren" />
          <S1A s_id="5" short="Some string" pages="2" service="DUM">
                <P1 page_alias="Some String1" page_seq="1" />
                <P1 page_alias="Some String2" page_seq="2" /> 
          </S1>
          <P1A type="95" name="Some string" acctype="String" der="String" _id="33333" /> 
     </DATA>
 
     <_T1>
          <T1 ag1="4" slot="5" datetime="2020-NOV-17 " target="1" aginst="4" profile="0">
              <TX1 de_m="53" element="4" tr_level="0" estimate="32" errors="1" user="3" resp="733" /> 
              <TX2 page_seq="1">
                  <TX2_P1 de_m="338" connect="2" first="32" ser="949" remain="20" first="107" system="0" request="0" look="1" start="0" estimate="442" /> 
                  <TX_P2 element="53" page="23233" /> 
                  <TX_P3 content="0" /> 
                  <TX_P4 page="1">
                       <TX_P4_1 record="1">
                            <TX_P4_1 first="170" system="0" connect="2" delta="0" del="1" element_delta="132" remain="20" />
                            <TX_P4_1 id="6133" element="0" request="332" text="http://www.samplename.com" content="51" header="1187" address="121.0.0.1" object="/acc/" content_bytes="4000" /> 
                            <TX_P4_1 status="200" /> 
                       </TX_P4_1>
                  </TX_P4>
              </TX2>
           </T1>
     </_T1>

Open in new window

0
 
LVL 10

Author Comment

by:aman0711
ID: 24306932
Please ignore the tag <DP_TXN_MEASUREMENTS> for now. I havent put that in DTD yet

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24307272
OK. Please don't post it until the dtd validates together with the xml
0
 
LVL 10

Author Comment

by:aman0711
ID: 24307340
Hmm... Ok , I will post the complete DTD
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 250 total points
ID: 24307359
Yes, only when it validates with xml
0
 
LVL 10

Author Comment

by:aman0711
ID: 24307407
CEHJ, is there a technique to validate it with the XML?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 24307464
Just parse it in Java and set validation to true. There's absolutely no point in trying to generate a schema until you've got a valid dtd
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24307472
You should be able to do that in XMLSpy too
0
 
LVL 10

Author Comment

by:aman0711
ID: 24307501
ok CEHJ... I am trying with XML spy... Actually trying to get DTD and SChema from the XML file iteself.
but the file size is 160mb and XMLspy is running out of memory
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 250 total points
ID: 24307563
>>Actually trying to get DTD and SChema from the XML file iteself.

That will only work of course, if a valid DTD can be inferred, so the xml has already to be correct. So far, i haven't seen anything posted that looks correct
0
 
LVL 10

Author Comment

by:aman0711
ID: 24307613
>> so the xml has already to be correct

XML is correct... Actually I am trying to load the Actual XML file in XML spy
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24307677
>>XML is correct...

OK. You could attach that as a file in that case
0
 
LVL 10

Author Comment

by:aman0711
ID: 24307738
CEHJ, can i instead email you to your personal email?
? coz its proprietary
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24307898
OK. It's in my profile
0
 
LVL 10

Author Comment

by:aman0711
ID: 24307995
Did you get it CEHJ?
0
 
LVL 92

Expert Comment

by:objects
ID: 24309596
What are you using xmlbeans exactly. And why use a dtd?

0
 
LVL 10

Author Comment

by:aman0711
ID: 24309606
lol to get that table built out of that XML file.

Objects can i send you the XML file , along with table that we are expecting out of that. At least the requirement will clear up then?
I already sent the file to CEHJ as well, but I guess he is not online anymore
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 24309652
far better technologies for that these days, xmlbeans is a bit dated and only really suited to limited applications. We stopped using it years ago.
For example xml that you already have a valid xsd for
0
 
LVL 10

Author Comment

by:aman0711
ID: 24309660
I am really confused here... what to do and what not to do :-(

Can you have a look at my XML then suggest your best possible way?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 24309677
I already have, I'm a bit confused why you changed approachs when you were close to have it finished.

0
 
LVL 10

Author Comment

by:aman0711
ID: 24309687
yeah that time I had it coded quite... ok m gonna start again with that code and request you for your help...
and will try to generate the DTD and schema too..
wow.. I am so Lost :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24309689
>>I already sent the file to CEHJ as well, but I guess he is not online anymore

I am now. My isp rejected the file. I sent you another address to try
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 24309700
and you probably won't be able to generate a schema anyway (not one that any use), you need to write the schema yourself to get anything decent.

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24309704
There's no need to get lost. And there's no need to write much code either - most xml->bean mapping technologies will do it for you
0
 
LVL 10

Author Comment

by:aman0711
ID: 24309722
I sent the file to your new email again CEHJ.

I take both of you as my teachers.... please somehow get me out of this trouble :)
0
 
LVL 92

Expert Comment

by:objects
ID: 24309743
I suspect CEHJ has never actually used xmlbeans :)

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24357738
:-)
0
 

Expert Comment

by:ModernMatt
ID: 25855926
Data replaced per member request.

ModernMatt
EE Moderator
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Restore security prompts not working 10 107
JSON  parse help 7 50
Java syntax, or is it Selenium 6 37
Java Inheritance super keyword use 8 30
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question