Win a copy of liveProject: Build an ML Recommender System this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

can I set SAXFactory.setValidation (true) without a DTD or schema ?

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can I set SAXFactory.setValidation(true) without a DTD or schema ? I set it to true because I thought this way the white space will be ignored automatically. Plus I don't have a DTD or schema and it still works fine.

So, can I assume that I can set SAXFactory.setValidation(true) without a DTD or schema ?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The white space cannot be ignored automatically if you don't have a schema or a DTD. So the reply is No you can use this flag without a schema.

Best regards,

A.Brillant
EditiX - XML Editor & XSLT Debugger
http://www.editix.com
 
Artemesia Lakener
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by alexandre brillant:
The white space cannot be ignored automatically if you don't have a schema or a DTD. So the reply is No you can use this flag without a schema.

Best regards,

A.Brillant
EditiX - XML Editor & XSLT Debugger
http://www.editix.com



As a follow-up question, actually I find that when I don't have a schema or DTD, the white space is *not* picked up by the ignorableWhiteSpace, it is actually picked up by "characters()" method. Am I right ? So what I have to do is to manipulate it in the character() method (like truncating them). Is it the right approach ?
 
alexandre brillant
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For me no this is not a good approach but this is a possible one. May I know if you use a big document ? In another case a DTD or a W3C Schema is required.

Also check your parser properties, there's may be a solution inside. For Xerces there's a lot of properties and I wouldn't be surprised to find your need. -> http://xml.apache.org

You have the following feature for Xerces :

http://apache.org/xml/features/dom/include-ignorable-whitespace

Best regards,

A.Brillant
EditiX - XML Editor and XSLT Debugger
http://www.editix.com
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic