• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Legal XML

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am developing an alternate XSD Parser and would like to know if the below given xml files are legal or not.
Thanks



Similarly,


Thank you in advance..!
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do the existing parsers think about those?

Although, without a schema, where does XSD come into play?
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:What do the existing parsers think about those?

Although, without a schema, where does XSD come into play?



All I want to know is if the given XML structure valid. That is, in one of them, there is a parent node called Catalogue which has a child node called Catalogue. In the next one, there's another parent called Film who has a child node called Film. Would this be illegal syntax according to XML standards set by W3C? Please forget the XSD, Schema or the parsers..!
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it was illegal, shouldn't a parser tell you that real quick? Much quicker, in fact, than waiting for an answer in a forum?
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:If it was illegal, shouldn't a parser tell you that real quick? Much quicker, in fact, than waiting for an answer in a forum?



Mate,
My parser isn't developed fully. I am not using any other parsers as well. All I need to know is if it is conventional to have the same names for both the parent and child elements in an XML body.
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have Java installed, then you have an XML parser installed; check out the JAXP API in the javax.xml package.

No, it is not conventional, if for no other reason than that it is confusing. But it is well-formed XML; validity does not come into play, as there is no schema.
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:If you have Java installed, then you have an XML parser installed; check out the JAXP API in the javax.xml package.

No, it is not conventional, if for no other reason than that it is confusing. But it is well-formed XML; validity does not come into play, as there is no schema.



Ooh..! Got your point. Thank you very much..!
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's certainly valid XML. Just think of XHTML - it's common to have <div> tags within a <div> tag.
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:It's certainly valid XML. Just think of XHTML - it's common to have <div> tags within a <div> tag.



OK. That's all I needed to know as the validation against a rule can be specified in the schema.
Thank you all for the help..!
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:It's certainly valid XML.


Gotta disagree with that phrasing - "valid" in XML Jargon means "it validates against a schema", be that XSD, DTD or Relax-NG. Since there is no schema in play here, it can't be said to be valid. But it is well-formed, i.e. it conforms to the rules of how XML documents are structured.
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:

Matthew Brown wrote:It's certainly valid XML.


Gotta disagree with that phrasing - "valid" in XML Jargon means "it validates against a schema", be that XSD, DTD or Relax-NG. Since there is no schema in play here, it can't be said to be valid. But it is well-formed, i.e. it conforms to the rules of how XML documents are structured.



Thank You Ulf and Matthew..! That's all I needed to know if it was well formed by definition or not.
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic