aspose file tools*
The moose likes XML and Related Technologies and the fly likes Please explain difference between inline and not inline XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Please explain difference between inline and not inline XML" Watch "Please explain difference between inline and not inline XML" New topic
Author

Please explain difference between inline and not inline XML

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi,

Could someone post some inline and not inline xml examples and explain the difference.

I'm using Simple to parse an xml file but the only way I could get it to work was to use the @ElementList(inline=true) annotation.

Here's my xml.
It does not look inline as I understand it.


Thanks,

Lou
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Lou

If your XML was not inlined, it would look like this:

Notice, the enclosing types parents and children for the lists.

BTW, I assumed you have pasted your XML incorrectly as:

is not valid XML.
Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi James,

It looks to me like not inline would have tags to "group" child elements, such and <parents> and <children> in your example.

I'm just getting started with xml so could you please tell me why mine is not valid? It was not a copy/paste error.

In trying to understand why it's invalid, or not well formed, I checked it at w3, w3schools, and xmlvalidation - all reported valid.

Thanks,

Lou
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5


I believe this is invalid as the name element has both a value (Parent 2) and child elements. It can't have both.

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Actually the XML hierarchy takes care of separating the two "name" elements.

However, it will cause programmer confusion later on.

Bill
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 507
    
    3
BTW, I assumed you have pasted your XML incorrectly as:

is not valid XML.

Whether it is a valid XML or not cannot be ascertain without a schema. It is though a perfectly well-formed XML. (The parent name element has a mixed content type, technically speaking if that helps.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please explain difference between inline and not inline XML