Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old January 5th, 2011, 12:01 PM
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
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
Reply With Quote
  #3 (permalink)  
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.
Reply With Quote
  #4 (permalink)  
Old January 5th, 2011, 12:56 PM
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
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
Reply With Quote
  #5 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:12 PM.


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