Solved

Convert DTD to XML Schema using XML spy

Posted on 2009-05-05
32
1,489 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
Comment Utility
Can you post the DTD?
0
 
LVL 10

Author Comment

by:aman0711
Comment Utility
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
Comment Utility
Everytime i try to convert this using XML spy,

   its giving me errors like "_" not expected
0
 
LVL 86

Expert Comment

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

Author Comment

by:aman0711
Comment Utility
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
Comment Utility
Please ignore the tag <DP_TXN_MEASUREMENTS> for now. I havent put that in DTD yet

0
 
LVL 86

Expert Comment

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

Author Comment

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

Assisted Solution

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

Author Comment

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

Accepted Solution

by:
CEHJ earned 250 total points
Comment Utility
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
Comment Utility
You should be able to do that in XMLSpy too
0
 
LVL 10

Author Comment

by:aman0711
Comment Utility
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
Comment Utility
>>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
Comment Utility
>> 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
Comment Utility
>>XML is correct...

OK. You could attach that as a file in that case
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 10

Author Comment

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

Expert Comment

by:CEHJ
Comment Utility
OK. It's in my profile
0
 
LVL 10

Author Comment

by:aman0711
Comment Utility
Did you get it CEHJ?
0
 
LVL 92

Expert Comment

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

0
 
LVL 10

Author Comment

by:aman0711
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I suspect CEHJ has never actually used xmlbeans :)

0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:-)
0
 

Expert Comment

by:ModernMatt
Comment Utility
Data replaced per member request.

ModernMatt
EE Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mongodb hierarchy 2 33
endX challenge 2 48
Java - Why doesn't this JFrame work 3 14
maven project error 5 17
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now