Author: thorsten
Date: Wed Sep 24 03:35:33 2008
New Revision: 698511
URL: http://svn.apache.org/viewvc?rev=698511&view=rev
Log:
Removing debug code. Removing dom flag since I will provide a xmlStructure
implementation that is based on AXIOM. Some projects that may uses xpath rarely
and normally only two different (like in html) can use the StAX based one. If a
project needs more flexibility they can use the AXIOM one. I ended up writing
both to test perfomance on both. If it results that the AXIOM is as fast as the
StAX one I recommend to drop the latest.
Modified:
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
Modified:
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/config/DispatcherBean.java?rev=698511&r1=698510&r2=698511&view=diff
==============================================================================
---
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
(original)
+++
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
Wed Sep 24 03:35:33 2008
@@ -28,7 +28,6 @@
public class DispatcherBean {
private boolean allowXmlProperties = false;
- private boolean domEnabled = false;
private Resolver resolver = null;
private String contractUriPrefix = "";
@@ -66,12 +65,4 @@
this.contractUriSufix = contractUriSufix;
}
- public boolean isDomEnabled() {
- return domEnabled;
- }
-
- public void setDomEnabled(boolean domEnabled) {
- this.domEnabled = domEnabled;
- }
-
}
Modified:
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java?rev=698511&r1=698510&r2=698511&view=diff
==============================================================================
---
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
(original)
+++
forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
Wed Sep 24 03:35:33 2008
@@ -55,8 +55,6 @@
private static final Object CONTRACT_RESULT_XPATH = "xpath";
- private final boolean dom;
-
private final Resolver resolver;
private final boolean allowXmlProperties;
@@ -68,7 +66,6 @@
private String currentPath = "";
public XMLStructurer(DispatcherBean config) {
- this.dom= config.isDomEnabled();
this.contractRep = new ContractFactory(config);
this.resolver = config.getResolver();
this.allowXmlProperties = config.isAllowXmlProperties();
@@ -148,12 +145,8 @@
case XMLStreamConstants.END_ELEMENT:
elementName = reader.getLocalName();
if (elementName.equals(STRUCTURE_ELEMENT)) {
- if(dom){
- // TODO implement me.
- }else{
- XMLEventWriter writer = getWriter(out);
- createResultStax(writer);
- }
+ XMLEventWriter writer = getWriter(out);
+ createResultStax(writer);
resultTree.clear();
process = false;
}else if (elementName.equals(HOOK_ELEMENT)){
@@ -339,13 +332,6 @@
private void processHook(XMLStreamReader reader, boolean start) throws
XMLStreamException {
- /*log.debug("currentPath: "+currentPath);
- if(start){
- String xpath= calculateXpathFromAtrributes(reader);
- //currentPath+="/"+
- log.debug(currentPath+"/"+HOOK_ELEMENT.toUpperCase()+xpath);
- currentPath+="/"+HOOK_ELEMENT;
- }*/
LinkedHashSet<XMLEvent> pathElement;
if (resultTree.containsKey(currentPath)){
pathElement = resultTree.get(currentPath);
@@ -356,24 +342,6 @@
XMLEvent currentEvent = allocator.allocate(reader);
pathElement.add(currentEvent);
resultTree.put(currentPath, pathElement);
- /*if(!start){
-
currentPath=currentPath.substring(0,currentPath.lastIndexOf(("/"+HOOK_ELEMENT)));
- }
- log.debug("currentPath (after): "+currentPath);*/
- }
-
- private String calculateXpathFromAtrributes(XMLStreamReader reader) {
- String xpath="";
- for (int i = 0; i < reader.getAttributeCount(); i++) {
- // Get attribute name
- String key = reader.getAttributeLocalName(i);
- String value = reader.getAttributeValue(i);
- xpath="@"+key+":"+value;
- }
- if(!xpath.equals("")){
- xpath="["+xpath+"]";
- }
- return xpath;
}
private void inject(LinkedHashSet<XMLEvent> pathElement,