|
SAP NetWeaver 7.40 SP 06 KMC | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sapportals.wcm.protocol.webdav.DomElement
public class DomElement
Utility functions for working with Nodes.
Note: most methods are static, some are also available as non-static
methods of DomElement (which in this case is only a container for
a Document).
Copyright (c) SAP AG 2001-2007
| Nested Class Summary | |
|---|---|
static class |
DomElement.DomElementException
|
static class |
DomElement.NotUniqueChildException
|
static class |
DomElement.RequiredChildMissingException
|
static class |
DomElement.UnexpectedChildException
|
| Constructor Summary | |
|---|---|
DomElement(Document owner)
|
|
| Method Summary | |
|---|---|
static void |
addDavStatus(Element prop,
String status)
Adds a DAV:status child element with the given content. |
static void |
attachPropertyFlag(Element e,
String flag,
boolean value)
Attaches property flag to a property. |
static void |
attachSoapArrayType(Element e,
QualifiedName dt,
int size)
Attaches SOAP array type information to an element. |
static void |
attachXmlDataDataType(Element e,
String dt)
Attaches XML DATA datatype information to an element to support the special requirements of the Microsoft Webfolder client. |
static void |
attachXsdDataType(Element e,
QualifiedName dt)
Attaches XML Schema datatype information to an element. |
static void |
checkChildElementConstraints(Node parent,
IName allowed)
|
static void |
checkChildElementConstraints(Node parent,
Set allowed)
|
static List |
getChildren(Node parent,
IName name)
Gets all child element nodes with matching IName. |
static List |
getChildren(Node parent,
String namespaceUri,
String name)
Get all children with matching namespace and name. |
static NodeList |
getElements(Element parent,
IName name)
Get NodeList containing all descendants with a certain element name. |
static Node |
getFirstChild(Node parent,
IName name)
Get first child element with given name. |
static Node |
getFirstChildOrDie(Node parent,
IName name,
boolean required)
Get first child with specified name, throwing an exception when there are multiple. |
static List |
getHrefList(Node e)
|
static Set |
getHrefs(Node e)
|
static IInternationalString |
getInternationalText(Node e)
Gets an IInternationalString from a node. |
static String |
getProcessingInstruction(Document doc,
String target)
Get the value of the first instance of a top-level processing instruction by name. |
static String |
getSingleHref(Node e)
|
static String |
getSingleHref(Node e,
boolean required)
|
static String |
getText(Node e)
Get the (concatenated) text content of an element (only visits direct children of type Node.TEXT_NODE and Node.CDATA_SECTION_NODE). |
static Object |
getTypedValue(Element e,
DateFormat df)
Gets the typed value from text content of an element based on it's xsi:type attribute. |
static boolean |
hasChild(Node parent,
IName name)
Determines if node has child with matching IName. |
static boolean |
hasElementChildrenInDavNs(Element elem)
Checks whether there are Element children in the DAV: namespace. |
static boolean |
hasOnlyTextContent(Node e)
Checks whether an element node contains only text content (being nodes of type Node.TEXT_NODE or Node.CDATA_SECTION_NODE}. |
static Node |
importNode(Document owner,
Node imp,
boolean deep)
Wrapper method for Document.importNode(Node, boolean), providing logging of
fatal errors (seen in early Xerces versions). |
static void |
inheritXmlAttributes(Element elem)
Inherit all attributes in the XML namespace, according to Canonical XML |
static Element |
makeNew(Document doc,
IName name)
Create a new element node with the given name. |
static Element |
makeNew(Document doc,
IName name,
Object content)
Create a new element node with the given name and optional content |
static Element |
makeNew(Document doc,
QualifiedName name)
Create a new element node with the given qualified name (respecting the namespace prefix). |
static Element |
makeNew(Document doc,
QualifiedName name,
Object content)
Create a new element node with the given name (respecting the prefix) and optional content |
static Element |
makeNew(Document doc,
String namespace,
String name)
Create a new element node |
static Element |
makeNew(Document doc,
String namespace,
String name,
Object content)
Create a new element node with optional content |
static Element |
makeNew(Document doc,
String namespace,
String prefix,
String name,
Object content)
Create a new element node (with specific prefix) and optional content |
Element |
makeNew(IName name)
Create a new element node |
Element |
makeNew(IName name,
Object content)
Create a new element node with optional content |
static Comment |
makeSafeComment(Document doc,
String text)
|
static String |
makeSafeXml(String val)
Check the string's content for XML compliance (whether it can be used as value for a text node). |
static boolean |
match(Node n,
IName name)
Compare a node's namespace and name |
static boolean |
match(Node n,
Set names)
|
static boolean |
match(Node n,
String namespace,
String name)
Compare a node's namespace and name |
static void |
setText(Element e,
long val)
Set the text element content of an element to a stringified long value, removing all previous content. |
static void |
setText(Element e,
String val)
Set the text element content of an element, allowing null
and removing all previous content. |
static void |
setUnsafeText(Element e,
String val)
Set the text element content of an element, allowing null
and removing all previous content. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DomElement(Document owner)
| Method Detail |
|---|
public static Comment makeSafeComment(Document doc,
String text)
public Element makeNew(IName name,
Object content)
name - name for the elementcontent - optional content (content of type Element
is added as a child node, IInternationalStrings are added as Text node
while setting the attribute xml:lang, otherwise the string value is added as a
Text node)
public Element makeNew(IName name)
name - name for the element
public static Element makeNew(Document doc,
String namespace,
String prefix,
String name,
Object content)
doc - the owner documentnamespace - namespace namename - element's local namecontent - optional content (content of type Element
is added as a child node, IInternationalStrings are added as Text node
while setting the attribute xml:lang, otherwise the string value is added as a
Text node)
public static Element makeNew(Document doc,
String namespace,
String name)
doc - the owner documentnamespace - namespace namename - element's local name
public static Element makeNew(Document doc,
String namespace,
String name,
Object content)
doc - the owner documentnamespace - namespace namename - element's local namecontent - optional content (content of type Element
is added as a child node, IInternationalStrings are added as Text node
while setting the attribute xml:lang, otherwise the string value is added as a
Text node)
public static Element makeNew(Document doc,
IName name)
doc - the owner documentname - element's name
public static Element makeNew(Document doc,
QualifiedName name)
doc - the owner documentname - element's name
public static Element makeNew(Document doc,
IName name,
Object content)
doc - the owner documentname - element's namecontent - optional content (content of type Element
is added as a child node, IInternationalStrings are added as Text node
while setting the attribute xml:lang, otherwise the string value is added as a
Text node)
public static Element makeNew(Document doc,
QualifiedName name,
Object content)
doc - the owner documentname - element's namecontent - optional content (content of type Element
is added as a child node, IInternationalStrings are added as Text node
while setting the attribute xml:lang, otherwise the string value is added as a
Text node)
public static boolean match(Node n,
String namespace,
String name)
n - nodenamespace - namespace namename - name
public static boolean match(Node n,
IName name)
n - nodename - name
DAV: and the name matches
public static boolean match(Node n,
Set names)
public static void attachXmlDataDataType(Element e,
String dt)
e - the element to which the datatype should be attacheddt - the datatype
public static void attachPropertyFlag(Element e,
String flag,
boolean value)
e - the element to which the datatype should be attachedflag - name of flagvalue - boolean value of flag
public static void attachXsdDataType(Element e,
QualifiedName dt)
e - the element to which the datatype should be attacheddt - the datatype
public static void attachSoapArrayType(Element e,
QualifiedName dt,
int size)
e - the element to wich the datatype should be attacheddt - the datatypesize - size of arraypublic static boolean hasElementChildrenInDavNs(Element elem)
elem - the element to check
public static void addDavStatus(Element prop,
String status)
prop - Element to which the DAV:status shall be addedstatus - the HTTP status to set
public static Object getTypedValue(Element e,
DateFormat df)
Boolean),
xs:dateTime
(mapped to Date),
xs:long
(mapped to Long) and
xs:int
(mapped to Integer).
Other types are treated as string values. If the text content can not
be parsed according to the data type information, it's treated as string
as well.
e - containing elementdf - date format parser (for ISO8601 dates)
public static String getText(Node e)
Node.TEXT_NODE and Node.CDATA_SECTION_NODE).
e - parent element
public static Set getHrefs(Node e)
public static List getHrefList(Node e)
public static String getSingleHref(Node e,
boolean required)
throws DomElement.DomElementException
DomElement.DomElementException
public static String getSingleHref(Node e)
throws DomElement.DomElementException
DomElement.DomElementExceptionpublic static IInternationalString getInternationalText(Node e)
IInternationalString from a node. For non-elements,
this is just the text content without language identification. For
elements, an attempts is made to find an xml:lang attribute in scope
to determine the language.
e - containing node
IInternationalStringpublic static boolean hasOnlyTextContent(Node e)
Node.TEXT_NODE or Node.CDATA_SECTION_NODE}.
e - containing element
true if only text content
public static NodeList getElements(Element parent,
IName name)
parent - the parent of the elements to findname - the name of the elements to find
public static List getChildren(Node parent,
String namespaceUri,
String name)
public static Node getFirstChildOrDie(Node parent,
IName name,
boolean required)
throws DomElement.DomElementException
parent - container elementname - name of requested child elementrequired - when true, an exception is thrown when the child element doesn't exist
null when not present
DomElement.NotUniqueChildException - when multiple childs present
DomElement.RequiredChildMissingException - when child not present and required was set to true
DomElement.DomElementException
public static void checkChildElementConstraints(Node parent,
IName allowed)
throws DomElement.UnexpectedChildException
DomElement.UnexpectedChildException
public static void checkChildElementConstraints(Node parent,
Set allowed)
throws DomElement.UnexpectedChildException
DomElement.UnexpectedChildException
public static Node getFirstChild(Node parent,
IName name)
parent - container elementname - specified name
null when not present
public static List getChildren(Node parent,
IName name)
IName.
parent - parent node from hwere to matchname - element name to match for
null).
public static boolean hasChild(Node parent,
IName name)
IName.
parent - parent node from hwere to matchname - element name to match for
public static String getProcessingInstruction(Document doc,
String target)
doc - to be checkedtarget - PI target
null
public static void setUnsafeText(Element e,
String val)
throws DOMException
null
and removing all previous content. Checks for valid character content.
e - the elementval - the text content
DOMException - with code DOMException.INVALID_CHARACTER_ERR when invalid content presentpublic static String makeSafeXml(String val)
val - string value
DOMException - with code DOMException.INVALID_CHARACTER_ERR when invalid content present
public static void setText(Element e,
String val)
null
and removing all previous content.
e - the elementval - the text content
public static void setText(Element e,
long val)
e - the elementval - the long valuepublic static void inheritXmlAttributes(Element elem)
elem - anchor element (attributes are added)
public static Node importNode(Document owner,
Node imp,
boolean deep)
Document.importNode(Node, boolean), providing logging of
fatal errors (seen in early Xerces versions).
owner - owner documentimp - node to importdeep - true when importing recursively
| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] KMC-CM
|
[sap.com] tc/km/frwk
|
api
|
EP-KM-CM
|
[sap.com] KMC-WPC
|
[sap.com] tc/kmc/wpc/wpcfacade
|
api
|
EP-PIN-WPC-WCM
|
|
SAP NetWeaver 7.40 SP 06 KMC | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||