abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r429215 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/model/ parser/src/main/java/org/apache/abdera/parser/stax/
Date Mon, 07 Aug 2006 00:04:19 GMT
Author: jmsnell
Date: Sun Aug  6 17:04:19 2006
New Revision: 429215

URL: http://svn.apache.org/viewvc?rev=429215&view=rev
Log:
Adding addProcessingInstruction, addStylesheet and addComment methods.

Document<Feed> doc = Factory.INSTANCE.newDocument();
doc.addStylesheet("/foo.xslt", "screen");
doc.addProcessingInstruction("foo", "bar);
doc.addComment("foo");

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Base.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Base.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Base.java?rev=429215&r1=429214&r2=429215&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Base.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Base.java Sun Aug
 6 17:04:19 2006
@@ -40,4 +40,9 @@
   
   Factory getFactory();
   
+  /**
+   * Add a comment
+   */
+  void addComment(String value);
+  
 }

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java?rev=429215&r1=429214&r2=429215&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java Sun
Aug  6 17:04:19 2006
@@ -89,4 +89,15 @@
    * Sets the charset used for this document
    */
   void setCharset(String charset);
+  
+  /**
+   * Add a processing instruction to the document
+   */
+  void addProcessingInstruction(String target, String value);
+  
+  /**
+   * Add a xml-stylesheet processing instruction to the document
+   */
+  void addStylesheet(String href, String media);
+  
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java?rev=429215&r1=429214&r2=429215&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
Sun Aug  6 17:04:19 2006
@@ -182,5 +182,37 @@
   public Factory getFactory() {
     return (Factory) this.factory;
   }
+
+  public void addProcessingInstruction(String target, String value) {
+    OMProcessingInstruction pi = 
+      this.factory.createOMProcessingInstruction(
+        null, target, value);
+    if (this.getOMDocumentElement() != null) {
+      this.getOMDocumentElement().insertSiblingBefore(pi);
+    } else {
+      this.addChild(pi);
+    }
+  }
+
+  public void addStylesheet(String href, String media) {
+    if (media == null) {
+      addProcessingInstruction(
+        "xml-stylesheet", "href=\"" + href + "\"");
+    } else {
+      addProcessingInstruction(
+        "xml-stylesheet", "href=\"" + href + 
+        "\" media=\"" + media + "\"");
+    }
+  }
+
+  public void addComment(String value) {
+    OMComment comment =
+      this.factory.createOMComment(null, value);
+    if (this.getOMDocumentElement() != null) {
+      this.getOMDocumentElement().insertSiblingBefore(comment);
+    } else {
+      this.addChild(comment);
+    }
+  }
   
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=429215&r1=429214&r2=429215&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
Sun Aug  6 17:04:19 2006
@@ -554,4 +554,8 @@
     }
     super.internalSerialize(writer, bool);
   }
+  
+  public void addComment(String value) {
+    factory.createOMComment(this, value);
+  }
 }



Mime
View raw message