This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I need to define XSD for this XML. I used value as complex type . but when i use value as complex type i am not able to parse the string value from Value in JAXB. I am getting a object only. If i declare value as simple type(String) i am not able to read the filename.what should i do..please help.
The schema 1.0 of w3c may not be expressive enough to fulfill seemingly an implicit condition that you've in mind, namely, if it has a non-whitespace text child (like "some string" in the first two datapoint), the element filename must be absent and conversely if filename element is present there must not be any non-whitespace non-negligible text node as its sibling. The best the schema can do is this.
I am using JAXB parser. i changed the schema as per your suggestion. Now i am able to read only normal string. I am not able to read the content inside the file name.. Do i have to use two XSD?
Joined: Jan 18, 2011
Do i have to use two XSD?
No. But as an aside, to use two xsd? in what sense?
Now i am able to read only normal string. I am not able to read the content inside the file name..
There may not be only one way to read correctly everything, but there sure are many ways to not be able to read the content inside the file name... If you want help, show a scaled down sample of how you do it. The xsd component I posted is capable of validating the value element for sure: only it is allowing slight more structure than your sample xml care to show - but sample is a sample, it is not supposed to be exhaustive or tacitly disallow everything not appeared in the sample. If you stick to your sample xml, it certainly won't blow up.