|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.simonstl.moe.CoreComponent | +--com.simonstl.moe.explicit.Attribute | +--com.simonstl.moe.Namespace
The Namespace class provides a foundation for MOE objects to store namespaces.
There are some real complications in dealing with namespaces in an event context, made only more difficult by the potential creation of partial trees. The SAX event startPrefixMapping() takes place before the startElement() call, and similarly endPrefixMapping() is reported after endElement().
SAX also provides options for reporting/not reporting the attributes which define namespaces. In MOE, when events are assembled, the namespaces will be associated with the elements containing the definitions.
I've defined the Namespace class to be something of a broken attribute, much like Namespace declarations in XML 1.0. The prefix of the attribute is fixed to xmlns, the localName defines the prefix defined by the namespace. The toString() method handles the xmlns/xmlns:prefix issues.
The namespace URI is stored as textual content, just as with attributes. This potentially supports some rather perverse things like the use of general entities in the attribute values used to define namespaces.
nsURI is fixed to http://www.w3.org/TR/REC-xml-names/
.
version 0.01 is the initial release and contains plenty of bogus placeholder functionality.
Field Summary | |
protected boolean |
current
current indicates that a namespace needs to be declared in the current context. |
protected int |
level
level is used by NamespaceContext to determine where in a tree a given namespace applies. |
protected NamespaceName |
name
Override regular name object with NamespaceName. |
Fields inherited from class com.simonstl.moe.CoreComponent |
annotations, complete, componentType, content, context, parent, unorderedContent |
Fields inherited from interface com.simonstl.moe.CoreComponentI |
ATTRIBUTE, CDATA, CHARS, COMMENT, CONTAINER, DOCTYPE, DOCUMENT, ELEMENT, END_ATTRIBUTE, END_CDATA, END_COMMENT, END_CONTAINER, END_DOCTYPE, END_DOCUMENT, END_ELEMENT, END_NAMESPACE, END_PI, END_PROPERTY, GEN_ENTITY_END, GEN_ENTITY_REF, GEN_ENTITY_START, IG_WHITESPACE, NAMESPACE_DECL, PI, PROPERTY, UNPARSED, VALUE, XML_DECL |
Constructor Summary | |
Namespace()
|
Method Summary | |
java.lang.Object |
clone()
Non-clone implementation needs replacement. |
int |
getBasicType()
Namespace has the basic type NAMESPACE_DECL. |
boolean |
getCurrent()
getCurrent()is used by the Element object to figure out if a namespace needs to be declared here. |
int |
getLevel()
getLevel()is used by the NamespaceContext object to figure out which declarations appeared where. |
java.lang.String |
getLocalName()
Returns the local name for the component |
NamingI |
getName()
Returns the name object for the component. |
java.lang.String |
getNsURI()
Returns the URI reference value for the namespace. |
java.lang.String |
getPrefix()
Returns the prefix used to represent the namespace URI reference for this component. |
java.lang.String |
getQName()
Returns the Qualified Name (QName) for the component. |
boolean |
listen(CoreComponentI component)
For now, the namespace class doesn't listen. |
static void |
main(java.lang.String[] args)
Need to update - currently elements only |
void |
setCurrent(boolean _current)
setLevel()is used by the NamespaceContext object to establish which declarations appeared in the current element. |
void |
setLevel(int _level)
setLevel()is used by the NamespaceContext object to establish which declarations appeared where. |
void |
setLocalName(java.lang.String _localName)
Accepts a string which will serve as the local name for this component. |
void |
setName(NamingI _name)
Sets the name object for the component. |
void |
setNsURI(java.lang.String _nsURI)
Accepts a URI reference value which is used as the namespace for the component. |
void |
setPrefix(java.lang.String _prefix)
Accepts a string which serves as the prefix for this component. |
void |
setQName(java.lang.String QName)
Sets the Qualified Name (QName) for the component. |
java.lang.String |
toString()
Returns a representation of the component as a String. |
java.lang.String |
toString(ComponentSetI namespaceContext)
Returns a representation of the component as a String. |
Methods inherited from class com.simonstl.moe.CoreComponent |
add, addAll, addContent, addUnorderedContent, annotate, clearAll, clearContent, clearName, clearUnorderedContent, getAllAnnotations, getAnnotations, getContent, getIsComplete, getParent, getTextContent, getTypes, getUnorderedContent, hasAnnotation, hasAnnotationOfType, hasAnnotations, hashCode, print, removeAllAnnotations, removeAnnotation, setContent, setContent, setIsComplete, setParent, setUnorderedContent, textComponent |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int level
NamespaceContext
to determine where in a tree a given namespace applies.protected boolean current
protected NamespaceName name
Constructor Detail |
public Namespace()
Method Detail |
public void setNsURI(java.lang.String _nsURI)
CoreComponentI
setNsURI
in class CoreComponent
public java.lang.String getNsURI()
CoreComponentI
getNsURI
in class CoreComponent
public void setLocalName(java.lang.String _localName)
CoreComponentI
setLocalName
in class CoreComponent
public java.lang.String getLocalName()
CoreComponentI
getLocalName
in class CoreComponent
public void setPrefix(java.lang.String _prefix)
CoreComponentI
setPrefix
in class CoreComponent
public java.lang.String getPrefix()
CoreComponentI
getPrefix
in class CoreComponent
public java.lang.String getQName()
getQName
in class CoreComponent
public void setQName(java.lang.String QName)
setQName
in class CoreComponent
public NamingI getName()
getName
in class CoreComponent
public void setName(NamingI _name)
setName
in class CoreComponent
public java.lang.String toString()
CoreComponentI
toString
in class Attribute
public java.lang.String toString(ComponentSetI namespaceContext)
CoreComponentI
toString
in class Attribute
public java.lang.Object clone()
CoreComponent
clone
in class Attribute
public int getBasicType()
getBasicType
in class Attribute
public boolean listen(CoreComponentI component)
listen
in class Attribute
public int getLevel()
NamespaceContext
object to figure out which declarations appeared where.public void setLevel(int _level)
NamespaceContext
object to establish which declarations appeared where.public boolean getCurrent()
Element
object to figure out if a namespace needs to be declared here.public void setCurrent(boolean _current)
NamespaceContext
object to establish which declarations appeared in the current element.public static void main(java.lang.String[] args) throws java.lang.Exception
Attribute
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |