Author: anil.saldhana(a)jboss.com
Date: 2010-11-02 16:00:09 -0400 (Tue, 02 Nov 2010)
New Revision: 511
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java
Log:
add method that can bypass an xml element block such as xml dsig
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java 2010-10-25
16:46:42 UTC (rev 510)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java 2010-11-02
20:00:09 UTC (rev 511)
@@ -25,7 +25,7 @@
import javax.xml.stream.Location;
import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.EndElement;
@@ -41,8 +41,27 @@
* @since Feb 8, 2010
*/
public class StaxParserUtil
-{
+{
/**
+ * Bypass an entire XML element block from startElement to endElement
+ * @param xmlEventReader
+ * @param tag Tag of the XML element that we need to bypass
+ * @throws ParsingException
+ */
+ public static void bypassElementBlock( XMLEventReader xmlEventReader, String tag )
throws ParsingException
+ {
+ while ( xmlEventReader.hasNext() )
+ {
+ EndElement endElement = getNextEndElement( xmlEventReader );
+ if( endElement == null )
+ return;
+
+ if( StaxParserUtil.matches( endElement , tag ) )
+ return;
+ }
+ }
+
+ /**
* Given an {@code Attribute}, get its trimmed value
* @param attribute
* @return