Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2011, 11:56 AM
Registered User
 
Join Date: Jan 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validating Input XML

I am trying to do a simple validation on input xml that ant will take and use xsl to transform. Basically I want to be able to do a check to see if the input xml is empty or not and if it is an empty file which can happen every now and then have it moved to an error directory.

I was hoping that this could be achieved purely using ant and maybe the exec task, but it is seeming more likely that I will need to write a shell script to accomplish my task and then just call it from ant.

Any hope that I can get this done without writing a separate script?

Thanks
 
Old January 5th, 2011, 12:01 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

An XML document is never empty, it has at least one element, the root element. That is a well-formedness requirement so you do not even need a schema respectively a validating parser to check that.
I don't see how ant, an exec task or a shell script relates to XSLT, the topic of this forum.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old January 5th, 2011, 12:51 PM
Registered User
 
Join Date: Jan 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is it empty if there is nothing in it? thanks for the response, it was very helpful.
 
Old January 5th, 2011, 12:56 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

If there is really no markup at all in your input file then it is not a well-formed XML document and any XML parser will complain that there is no root element. There needs to be at least one element, the root element for your input file to be successfully parsed as XML and to be passed on to the XSLT processor.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old January 5th, 2011, 12:59 PM
Registered User
 
Join Date: Jan 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, i understand this concept. i am trying to implement a check because periodically empty "xml" files are supplied as input to ant and the transformation fails because of this. i would like to prevent these errors by implementing a check before-hand.

mods, go ahead and move or delete this or whatever you please.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 Validating User Input Don Hurlbert BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 August 18th, 2010 02:42 PM
Validating Input from a Datasheet using VBA digby_dog Access VBA 1 October 6th, 2008 10:35 AM
validating input bukky VBScript 1 April 1st, 2004 04:30 AM
validating user input hosefo81 Javascript How-To 12 March 3rd, 2004 09:32 AM
Validating user input stu9820 VB.NET 2002/2003 Basics 2 January 15th, 2004 12:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.