2 package com
.interrupt
.bob
.base
;
5 import java
.io
.InputStream
;
6 import java
.io
.Serializable
;
8 import java
.util
.ArrayList
;
9 import java
.util
.HashMap
;
10 import org
.xml
.sax
.Attributes
;
12 public interface IBob
extends Serializable
{
15 public static final String XML_DEPTH
= "XML_DEPTH";
17 public void replace(IBob replacor
);
18 public void overwriteShallow(IBob overwritor
);
20 // Properties for this Bob node
21 public void setProperty(String name
, String value
);
22 public String
getProperty(String name
);
25 public boolean isNSVisible();
26 public void setNSVisible(boolean visible
);
30 public List
allChildren();
31 public void removeAllChildren();
32 public void addChild(IBob child
);
33 public void addChildren(List children
);
34 public boolean removeChild(IBob child
);
35 public boolean remove(String tagName
, String attName
, String attValue
);
36 public boolean remove(String tagName
, String tagId
);
40 public List
allGenChildren();
41 public void removeAllGenChildren();
42 public void addGenChild(IBob child
);
43 public boolean removeGenChild(IBob child
);
45 public IBob
getParent();
46 public void setParent(IBob _parent
);
52 added xpath find to the interface
53 A) public IBob find(String tagName, String tagId);
54 B) public IBob find(String xpath);
56 to take an xpath expression and return an XDM data type (sequence, element, string, number)
58 public IBob
find(String tagName
, String tagId
);
59 public List
find(String xpath
); // return result based on xpath string
60 public String
xpath(); // return the xpath string of this Bob node
61 public String
xpath(boolean relative
);
62 public boolean replace(String tagName
, String tagId
, IBob replacor
);
64 public String
buildAxisString();
65 public String
buildPredicateString(Attributes attributes
);
68 public IBob
getRoot();
70 // Search for the first node with tag and attribute name/value match
71 //public IBob search(String tag, String attributeName, String attributeValue);
72 //public IBob searchTree(String tag, String attributeName, String attributeValue);
77 * accept(IVisitor visitor) - visits the children first
78 * acceptFirst(IVisitor visitor) - visits the parent first
79 * acceptSax(ISaxVisitor visitor)
80 * - uses an ISaxVisitor to visit before(visitStart) and after(visitEnd) children
82 public void accept(IVisitor visitor
);
83 public void acceptFirst(IVisitor visitor
);
84 public void acceptSax(ISaxVisitor visitor
);
88 public IBob
pullNext();
89 public boolean canPull();
90 public void resetPull();
94 public void toXML(java
.io
.PrintStream ps
);
95 public void toXML(boolean inlineXML
, java
.io
.PrintStream ps
);
96 public String
toXML();
97 public String
toXML(boolean inlineXML
);
99 public void _setOpenString(String os
);
100 public String
_getOpenString();
101 public void _setCloseString(String cs
);
102 public String
_getCloseString();
104 // namespace and namespace list
105 public void setNamespace(String namespaceURI
);
106 public String
getNamespace();
108 public void addNamespace(String ns
, String value
); // TODO - deprecate
109 public String
getNamespace(String ns
); // TODO - deprecate
110 public HashMap
getNamespaces(); // TODO - deprecate
111 public boolean hasNamespaces(); // TODO - deprecate
114 public void setPrefixMappings(HashMap prefixMappings
);
115 public HashMap
getPrefixMappings();
117 public void setNSPrefix(String prefix
);
118 public String
getNSPrefix();
121 // attribute accessors
122 public void setTagName(String localName
);
123 public String
getTagName();
124 //public void setQName(String qName);
125 public String
getQName();
126 //public void setAttributes(com.interrupt.bob.Attributes attribs);
127 //public com.interrupt.bob.Attributes getAttributes();
128 public void setAttributes(Attributes attribs
);
129 public Attributes
getAttributes();
130 public String
getAttributeValue(String avalue
);
131 public void setAttributeValue(String aname
, String avalue
);
133 public void setContent(String text
);
134 public String
getContent();
136 public IBob
getChild(int cindex
);
137 public List
getChildren();
138 public void setChildren(List _children
);
141 //public static IBob make(String namespace, String localName);
142 //public static IBob make( String fqclassname );
144 public IBob
load(String xmlString
);
145 public IBob
load(String xmlString
, String definitionFiles
);
147 public IBob
load(File xmlFile
);
148 public IBob
load(File xmlFile
, String definitionFiles
);
150 public IBob
load(InputStream xmlis
);
151 public IBob
load(InputStream xmlis
, String definitionFiles
);