• 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

Parsing a XML document for one particular element in XSD

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have an XSD similar to the following lines.



where <XYZ> is the following.
<XYZ> has more elements, but I have pasted a crisp version in this thread. There can be a sequence of 'Child' elements in the XML file.



I am able to validate the XML file for this XSD. I am able to parse the FileInformation, User and ChildrenCount.
The legacy system I am working with some how picks up every child from the XML File. It presents the child as a String to me. I have to parse the child using the <xs:element name="Child"> and create a unmarshalled java object.
I have access to the XSD as File or urlOfXSD. The output should be of java type Child, an equivalent of Child element.
The following code does not understand the child string for the reason that it understands only the root element of an XSD. So I get a error as in the last of this thread.





My question is how to parse a string using a child element of an XSD? How to access the child element from urlOfXsd or XSD File ?

Thanks,
Rajesh
 
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

My question is how to parse a string using a child element of an XSD? How to access the child element from urlOfXsd or XSD File ?


It is not clear whether you mean you want to unmarshal an xsd document or whether you want to unmarshal an instance of xml documents defined by such xsd.

The legacy system I am working with some how picks up every child from the XML File. It presents the child as a String to me. I have to parse the child using the <xs:element name="Child"> and create a unmarshalled java object.


You have to present an example of "child as a String". This will also clear up the ambiguity of the previous quote.
reply
    Bookmark Topic Watch Topic
  • New Topic