• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML and DTD

 
Ranch Hand
Posts: 45
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Below is my understanding about 2 points about XML.Please correct me if am wrnog.

1) Normally xml has its DTD which defines the structure that an XML should have.This ensures the xml is not violating any syntaxes.
Validating xml against DTD is done when the xml is parsed by any parser(DOM,SAX etc.,)

2) In XML, the DTD location is mentioned as www.xx.com --> how does the parser validates if the DTD resides in some other server and it there is no internet connection in the pc, the parser is ran.


Thanks.

Regards
Senthil Kumar Sekar
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[1]
>Normally xml has its DTD which defines the structure that an XML should have.
I am not sure where do you get that idea. But you say "normally", and it puts enough safety net on the validity of the statement. "Abnormally" might swing the balance far off the other way, but I would say "normally xml does not have its DTD...".
>This ensures the xml is not violating any syntaxes.
DTD is quite incapable to ensure the xml not violating "any syntaxes" (whatever it means).
>Validating xml against DTD is done when the xml is parsed by any parser(DOM,SAX etc.,)
It can be done when, but it can be not doing it when, neither. "by any parse" is an undue optimism. Not every parser is a validating parser.

[2]
>In XML, the DTD location is mentioned as www.xx.com --> how does the parser validates if the DTD resides in some other server
It will fetch it if so required. And the location is not necessarily mentioned as www.xx.com.
>and it [sic, if] there is no internet connection in the pc, the parser is ran.
If the fetching requires internet connect and there is lacking, it will be a runtime error if no measure is taken to guard against.
 
Senthil Kumar Sekar
Ranch Hand
Posts: 45
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam not getting your point Tsu.

Let me put my understand.please let me knw if am wrong.

1. DTD and XSD are used to define the structure of an XML.
2. Certain parsers will be able to validate the syntax if setValdating(true)

If DTD in another server

For instance hibernate mapping xml has this

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"

I guess the dtd for mapping is available in another server.
But still iam able to run the application without any prob.
1. Does this requires an internet connection?
2. Validating the xml blocks is not done in Hibernate ?

Can you make me to understand more clear?

Thanks.

Regards
Senthil Kumar Sekar
 
g tsuji
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>1. Does this requires an internet connection?
On the face of it, this requires an internet connection. But you're using a framework that comes with its xml parser. If you use the xml parser that comes with hibernate, it would have EntityResolving mechanism built into it and it would use thereby a local copy of it in hibernate2.jar or hibernate3.jar versioning accordingly. If you use xml parser that comes with any other packages, in particular, such as from the jre, you would see the need clearer. And then, you can write your own resolver to redirect to the local copy for the purpose.

>2. Validating the xml blocks is not done in Hibernate ?
As said, and nothing to add.

If you put forward statements in general terms, be careful to spell out all the specificity, otherwise, you learn from the wrong experience and it is difficult to unlearn...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic