Add ability for embeddings to set options on the XML implementation.

git-svn-id: svn://10.0.0.236/trunk@255805 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nboyd%atg.com
2009-01-14 13:31:23 +00:00
parent 91e02451f0
commit a442ef0308
3 changed files with 96 additions and 0 deletions

View File

@@ -130,4 +130,44 @@ public abstract class XMLLib
* Construct namespace for default xml statement.
*/
public abstract Object toDefaultXmlNamespace(Context cx, Object uriValue);
public void setIgnoreComments(boolean b) {
throw new UnsupportedOperationException();
}
public void setIgnoreWhitespace(boolean b) {
throw new UnsupportedOperationException();
}
public void setIgnoreProcessingInstructions(boolean b) {
throw new UnsupportedOperationException();
}
public void setPrettyPrinting(boolean b) {
throw new UnsupportedOperationException();
}
public void setPrettyIndent(int i) {
throw new UnsupportedOperationException();
}
public boolean isIgnoreComments() {
throw new UnsupportedOperationException();
}
public boolean isIgnoreProcessingInstructions() {
throw new UnsupportedOperationException();
}
public boolean isIgnoreWhitespace() {
throw new UnsupportedOperationException();
}
public boolean isPrettyPrinting() {
throw new UnsupportedOperationException();
}
public int getPrettyIndent() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,15 @@
js> var x = <foo><bar><baz>1</baz></bar></foo>;
js> x
<foo>
<bar>
<baz>1</baz>
</bar>
</foo>
js> var xmlLib = org.mozilla.javascript.xml.XMLLib.extractFromScope(this);
js> xmlLib.isPrettyPrinting();
true
js> xmlLib.setPrettyPrinting(false);
js> xmlLib.isPrettyPrinting();
false
js> x
<foo><bar><baz>1</baz></bar></foo>

View File

@@ -72,6 +72,47 @@ public final class XMLLibImpl extends XMLLib implements Serializable {
lib.exportToScope(sealed);
}
}
public void setIgnoreComments(boolean b) {
options.setIgnoreComments(b);
}
public void setIgnoreWhitespace(boolean b) {
options.setIgnoreWhitespace(b);
}
public void setIgnoreProcessingInstructions(boolean b) {
options.setIgnoreProcessingInstructions(b);
}
public void setPrettyPrinting(boolean b) {
options.setPrettyPrinting(b);
}
public void setPrettyIndent(int i) {
options.setPrettyIndent(i);
}
public boolean isIgnoreComments() {
return options.isIgnoreComments();
}
public boolean isIgnoreProcessingInstructions() {
return options.isIgnoreProcessingInstructions();
}
public boolean isIgnoreWhitespace() {
return options.isIgnoreWhitespace();
}
public boolean isPrettyPrinting() {
return options.isPrettyPrinting();
}
public int getPrettyIndent() {
return options.getPrettyIndent();
}
private Scriptable globalScope;