Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate empty elements against schema 1

Status
Not open for further replies.

KL1

Programmer
Joined
Mar 9, 2004
Messages
6
Location
GB
I have an xml file that will initially contain empty elements. When validating this against the schema it does not validate for the reason ' XSD-2025: (Error) Invalid text '' in element: 'DATE_APPLIC_RECD'.

I have tried the elements as <DATE_APPLIC_RECD/> and also <DATE_APPLIC_RECD></DATE_APPLIC_RECD> and in the schema the element has been set as nullable true.

Any help in how to do this would be appreciated.

Thanks
Karen [ponytails2]

 
What is the minLength set at in the schema for that element?

The default is 0 (if that attribute isn't in the schema).

If it's set above that, then that's the minimum length of a value for that element, and you'll have to supply something.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Thanks for that, it has worked for elements declared as strings, however 2 of the elements are dates and 1 is a decimal. Can it be done for these or is best practice to make these elements optional in the file?

Karen
[ponytails2]
 
You can't have an empty element for dates (a weakness of the XSD type system)

What most people do to represent an empty date is use "0000-00-00T00:00:00" for the value.

Not sure about decimal, but I suspect you'll need to use a similar answer.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Thanks again. Will get onto the client who passes the file and ensure they do this.

Karen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top