Author: kwright
Date: Sat Feb 9 17:37:04 2013
New Revision: 1444401
URL: http://svn.apache.org/r1444401
Log:
Hook up the pass-through calls to XMLParsingContext
Modified:
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/TagParseState.java
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/XMLFuzzyHierarchicalParseState.java
Modified:
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/TagParseState.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/TagParseState.java?rev=1444401&r1=1444400&r2=1444401&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/TagParseState.java
(original)
+++
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/TagParseState.java
Sat Feb 9 17:37:04 2013
@@ -825,6 +825,8 @@ public class TagParseState extends Singl
if (ampBuffer.length() == 0 || (ampBuffer.length() == 1 &&
ampBuffer.charAt(0) == ';'))
{
// Length is zero; probably a mistake, so just output the whole thing
+ if (noteNormalCharacter('&'))
+ return true;
if (dumpValues(ampBuffer.toString()))
return true;
return false;
Modified:
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/XMLFuzzyHierarchicalParseState.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/XMLFuzzyHierarchicalParseState.java?rev=1444401&r1=1444400&r2=1444401&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/XMLFuzzyHierarchicalParseState.java
(original)
+++
manifoldcf/branches/CONNECTORS-633/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/XMLFuzzyHierarchicalParseState.java
Sat Feb 9 17:37:04 2013
@@ -43,7 +43,11 @@ public class XMLFuzzyHierarchicalParseSt
{
/** The current context */
protected XMLParsingContext currentContext = null;
-
+ /** The current value buffer */
+ protected StringBuilder characterBuffer = new StringBuilder();
+ /** Whether we're capturing escaped characters */
+ protected boolean captureEscaped = false;
+
/** Constructor.
*/
public XMLFuzzyHierarchicalParseState(boolean lowerCaseAttributes, boolean
lowerCaseTags,
@@ -78,7 +82,14 @@ public class XMLFuzzyHierarchicalParseSt
protected boolean noteTagEx(String tagName, String nameSpace, String
localName, Map<String,String> attributes)
throws ManifoldCFException
{
- // MHL
+ if (characterBuffer.length() > 0)
+ {
+ if (currentContext != null)
+ currentContext.characters(characterBuffer.toString());
+ characterBuffer.setLength(0);
+ }
+ if (currentContext != null)
+ currentContext.startElement(nameSpace,localName,tagName,attributes);
return false;
}
@@ -88,7 +99,14 @@ public class XMLFuzzyHierarchicalParseSt
protected boolean noteEndTagEx(String tagName, String nameSpace, String
localName)
throws ManifoldCFException
{
- // MHL
+ if (characterBuffer.length() > 0)
+ {
+ if (currentContext != null)
+ currentContext.characters(characterBuffer.toString());
+ characterBuffer.setLength(0);
+ }
+ if (currentContext != null)
+ currentContext.endElement(nameSpace,localName,tagName);
return false;
}
@@ -100,17 +118,19 @@ public class XMLFuzzyHierarchicalParseSt
protected boolean noteNormalCharacter(char thisChar)
throws ManifoldCFException
{
- // MHL
+ characterBuffer.append(thisChar);
return false;
}
/** New version of the noteEscapedTag method.
*@return true to halt further processing.
*/
+ @Override
protected boolean noteEscapedEx(String token)
throws ManifoldCFException
{
- // MHL
+ if (token.toLowerCase(Locale.ROOT).equals("cdata"))
+ captureEscaped = true;
return false;
}
@@ -123,7 +143,8 @@ public class XMLFuzzyHierarchicalParseSt
protected boolean noteEscapedCharacter(char thisChar)
throws ManifoldCFException
{
- // MHL
+ if (captureEscaped)
+ characterBuffer.append(thisChar);
return false;
}
@@ -134,8 +155,23 @@ public class XMLFuzzyHierarchicalParseSt
protected boolean noteEndEscaped()
throws ManifoldCFException
{
- // MHL
+ captureEscaped = false;
return false;
}
+ /** Called at the end of everything.
+ */
+ @Override
+ public void finishUp()
+ throws ManifoldCFException
+ {
+ if (characterBuffer.length() > 0)
+ {
+ if (currentContext != null)
+ currentContext.characters(characterBuffer.toString());
+ characterBuffer.setLength(0);
+ }
+ super.finishUp();
+ }
+
}