Author: anil.saldhana(a)jboss.com
Date: 2010-10-22 21:14:53 -0400 (Fri, 22 Oct 2010)
New Revision: 502
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/AbstractParser.java
Log:
the event filter should return CharacterEvent also
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/AbstractParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/AbstractParser.java 2010-10-21
14:12:51 UTC (rev 501)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/AbstractParser.java 2010-10-23
01:14:53 UTC (rev 502)
@@ -27,6 +27,7 @@
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Characters;
import javax.xml.stream.events.XMLEvent;
import org.picketlink.identity.federation.core.exceptions.ParsingException;
@@ -53,7 +54,7 @@
throw new IllegalArgumentException( " Input Stream is null " );
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
- //XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(xmlSource);
+
XMLEventReader xmlEventReader = StaxParserUtil.getXMLEventReader( configStream );
try
@@ -62,8 +63,24 @@
{
public boolean accept(XMLEvent xmlEvent)
{
- return xmlEvent.isStartElement() || xmlEvent.isEndElement();
+ //We are going to disregard characters that are new line and whitespace
+ if( xmlEvent.isCharacters() )
+ {
+ Characters chars = xmlEvent.asCharacters();
+ String data = chars.getData();
+ data = valid( data ) ? data.trim() : null;
+ return valid( data );
+ }
+ else
+ {
+ return xmlEvent.isStartElement() || xmlEvent.isEndElement();
+ }
}
+
+ private boolean valid( String str )
+ {
+ return str != null && str.length() > 0;
+ }
});
}
catch (XMLStreamException e)
Show replies by date