Package org.eclipse.lemminx.dom
Class DOMDocument
java.lang.Object
org.eclipse.lemminx.dom.DOMNode
org.eclipse.lemminx.dom.DOMDocument
XML document.
-
Field Summary
Fields inherited from class org.eclipse.lemminx.dom.DOMNode
DTD_ATT_LIST_NODE, DTD_DECL_NODE, DTD_ELEMENT_DECL_NODE, DTD_ENTITY_DECL_NODE, DTD_NOTATION_DECL, NULL_VALUEFields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE -
Constructor Summary
ConstructorsConstructorDescriptionDOMDocument(TextDocument textDocument, URIResolverExtensionManager resolverExtensionManager) -
Method Summary
Modifier and TypeMethodDescriptioncreateAttribute(String name) createAttributeNS(String namespaceURI, String qualifiedName) createCDataSection(int start, int end) createCDATASection(String data) createComment(int start, int end) createComment(String data) createDocumentType(int start, int end) createElement(int start, int end) createElement(String tagName) createElementNS(String namespaceURI, String qualifiedName) createEntityReference(String name) createProcessingInstruction(int start, int end) createProcessingInstruction(String target, String data) createText(int start, int end) createTextNode(String data) findDTDAttrList(String elementName) Returns the DTD Attribute list for the given element name and empty otherwise.org.eclipse.lsp4j.jsonrpc.CancelCheckergetElementById(String elementId) org.eclipse.lsp4j.RangegetElementNameRangeAt(int textOffset) Returns the element name on the left of the given position and null otherwise.getElementsByTagName(String tagname) getElementsByTagNameNS(String namespaceURI, String localName) Returns the grammar location found by the namespace URI from the document root element (ex : found with XML catalog) and null otherwise.Returns the external grammar location (XSD, DTD from xml file associations) and null otherwise.getLineIndentInfo(int lineNumber) shortReturns the declared "xsi:noNamespaceSchemaLocation" and null otherwise.Returns the owner document and null otherwise.If document has<?xml ... ?>, return this prolog, null otherwisegetRoots()Returns the (xsi) schema instance prefix and null otherwise.Returns the declared "xsi:schemaLocation" and null otherwise.Returns the XML Schema prefix (ex : 'xs' for xmlns:xs="http://www.w3.org/2001/XMLSchema")booleangetText()Returns the text content of the XML document.org.eclipse.lsp4j.RangegetTrimmedRange(int start, int end) org.eclipse.lsp4j.RangegetTrimmedRange(org.eclipse.lsp4j.Range range) Returns the list of xml-model processing instruction declared in the document.booleanbooleanhasDTD()Returns true if XML document has a DTD declaration and false otherwise.booleanReturns true if the document is bound to an external grammar (XML file associations, XLM catalog) and false otherwise.booleanReturns true if the document is bound to a grammar and false otherwise.booleanReturns true if document defines namespaces (with xmlns) and false otherwise.booleanReturns true if XML root element declares a "xsi:noNamespaceSchemaLocation" and false otherwise.booleanIf document has<?xml ... ?>booleanReturns true if (xsi) schema instance prefix exists.booleanReturns true if XML root element declares a "xsi:schemaLocation" and false otherwise.booleanReturns true if XML document has a xml-model processing declaration and false otherwise.importNode(Node importedNode, boolean deep) booleanisBeforeProlog(int offset) Returns true, if the given offset is before XML declaration (<?xml ...?>), false otherwise.booleanisDTD()Returns true if the XML document is a DTD and false otherwise.booleanisWithinInternalDTD(int offset) Returns true if 'offset' is within an internal DOCTYPE dtd.lineDelimiter(int lineNumber) lineText(int lineNumber) voidintoffsetAt(org.eclipse.lsp4j.Position position) org.eclipse.lsp4j.PositionpositionAt(int offset) renameNode(Node n, String namespaceURI, String qualifiedName) voidReset the cached grammar flag.voidsetCancelChecker(org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) voidsetDocumentURI(String documentURI) voidsetStrictErrorChecking(boolean strictErrorChecking) voidsetXmlStandalone(boolean xmlStandalone) voidsetXmlVersion(String xmlVersion) Methods inherited from class org.eclipse.lemminx.dom.DOMNode
addChild, appendChild, cloneNode, compareDocumentPosition, findAttrAt, findAttrAt, findNodeAt, findNodeBefore, findNodeOrAttrAt, findTextAt, getAttribute, getAttributeAtIndex, getAttributeNode, getAttributeNode, getAttributeNodes, getAttributes, getBaseURI, getChild, getChildNodes, getChildren, getChildrenWithAttributeValue, getEnd, getFeature, getFirstChild, getLastChild, getLocalName, getNextSibling, getNodeValue, getOrphanEndElement, getOrphanEndElement, getParentElement, getParentNode, getPrefix, getPreviousNonTextSibling, getPreviousSibling, getStart, getTextContent, getUserData, hasAttribute, hasAttributes, hasChildNodes, insertBefore, isAttribute, isCDATA, isCharacterData, isChildOfOwnerDocument, isClosed, isComment, isDefaultNamespace, isDoctype, isDTDAttListDecl, isDTDElementDecl, isDTDEntityDecl, isDTDNotationDecl, isElement, isEqualNode, isGenericDTDDecl, isIncluded, isIncluded, isOwnerDocument, isProcessingInstruction, isProlog, isSameNode, isSupported, isText, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setAttribute, setAttributeNode, setNodeValue, setPrefix, setTextContent, setUserData, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Constructor Details
-
DOMDocument
-
-
Method Details
-
setCancelChecker
public void setCancelChecker(org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) -
getCancelChecker
public org.eclipse.lsp4j.jsonrpc.CancelChecker getCancelChecker() -
getRoots
-
positionAt
- Throws:
BadLocationException
-
offsetAt
- Throws:
BadLocationException
-
lineText
- Throws:
BadLocationException
-
lineDelimiter
- Throws:
BadLocationException
-
getLineIndentInfo
- Throws:
BadLocationException
-
getElementNameRangeAt
public org.eclipse.lsp4j.Range getElementNameRangeAt(int textOffset) Returns the element name on the left of the given position and null otherwise.- Parameters:
textOffset-- Returns:
- the element name on the left of the given position and null otherwise.
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceNode- Overrides:
getNamespaceURIin classDOMNode
-
getText
Returns the text content of the XML document.- Returns:
- the text content of the XML document.
-
getTextDocument
-
hasGrammar
public boolean hasGrammar()Returns true if the document is bound to a grammar and false otherwise.- Returns:
- true if the document is bound to a grammar and false otherwise.
-
getSchemaLocation
Returns the declared "xsi:schemaLocation" and null otherwise.- Returns:
- the declared "xsi:schemaLocation" and null otherwise.
-
hasSchemaLocation
public boolean hasSchemaLocation()Returns true if XML root element declares a "xsi:schemaLocation" and false otherwise.- Returns:
- true if XML root element declares a "xsi:schemaLocation" and false otherwise.
-
getNoNamespaceSchemaLocation
Returns the declared "xsi:noNamespaceSchemaLocation" and null otherwise.- Returns:
- the declared "xsi:noNamespaceSchemaLocation" and null otherwise.
-
hasNoNamespaceSchemaLocation
public boolean hasNoNamespaceSchemaLocation()Returns true if XML root element declares a "xsi:noNamespaceSchemaLocation" and false otherwise.- Returns:
- true if XML root element declares a "xsi:noNamespaceSchemaLocation" and false otherwise.
-
hasNamespaces
public boolean hasNamespaces()Returns true if document defines namespaces (with xmlns) and false otherwise.- Returns:
- true if document defines namespaces (with xmlns) and false otherwise.
-
getSchemaInstancePrefix
Returns the (xsi) schema instance prefix and null otherwise.- Returns:
- the (xsi) schema instance prefix and null otherwise.
-
hasSchemaInstancePrefix
public boolean hasSchemaInstancePrefix()Returns true if (xsi) schema instance prefix exists.- Returns:
- true if (xsi) schema instance prefix exists.
-
hasProlog
public boolean hasProlog()If document has<?xml ... ?>- Returns:
-
getProlog
If document has<?xml ... ?>, return this prolog, null otherwise- Returns:
- prolog DOMNode, if the document has one, null otherwise
-
isBeforeProlog
public boolean isBeforeProlog(int offset) Returns true, if the given offset is before XML declaration (<?xml ...?>), false otherwise.- Parameters:
offset- the offset position in question- Returns:
- true, if before xml declaration; false otherwise
-
hasDTD
public boolean hasDTD()Returns true if XML document has a DTD declaration and false otherwise.- Returns:
- true if XML document has a DTD declaration and false otherwise.
-
hasXMLModel
public boolean hasXMLModel()Returns true if XML document has a xml-model processing declaration and false otherwise.- Returns:
- true if XML document has a xml-model processing declaration and false otherwise.
-
getXMLModels
Returns the list of xml-model processing instruction declared in the document.- Returns:
- the list of xml-model processing instruction declared in the document.
-
hasExternalGrammar
public boolean hasExternalGrammar()Returns true if the document is bound to an external grammar (XML file associations, XLM catalog) and false otherwise.- Returns:
- true if the document is bound to an external grammar (XML file associations, XLM catalog) and false otherwise.
-
getExternalGrammarLocation
Returns the external grammar location (XSD, DTD from xml file associations) and null otherwise.- Returns:
- the external grammar location (XSD, DTD from xml file associations) and null otherwise.
-
getExternalGrammarFromNamespaceURI
Returns the grammar location found by the namespace URI from the document root element (ex : found with XML catalog) and null otherwise.- Returns:
- the grammar location found by the namespace URI from the document root element (ex : found with XML catalog) and null otherwise.
-
createElement
-
createCDataSection
-
createProcessingInstruction
-
createComment
-
createText
-
createDocumentType
-
getNodeType
public short getNodeType()- Specified by:
getNodeTypein interfaceNode
-
getNodeName
- Specified by:
getNodeNamein interfaceNode
-
getDocumentElement
- Specified by:
getDocumentElementin interfaceDocument
-
getDoctype
- Specified by:
getDoctypein interfaceDocument
-
getOwnerDocument
Description copied from class:DOMNodeReturns the owner document and null otherwise.- Specified by:
getOwnerDocumentin interfaceDOMRange- Specified by:
getOwnerDocumentin interfaceNode- Overrides:
getOwnerDocumentin classDOMNode- Returns:
- the owner document and null otherwise.
-
getDocumentURI
- Specified by:
getDocumentURIin interfaceDocument
-
setDocumentURI
- Specified by:
setDocumentURIin interfaceDocument
-
adoptNode
- Specified by:
adoptNodein interfaceDocument- Throws:
DOMException
-
createAttribute
- Specified by:
createAttributein interfaceDocument- Throws:
DOMException
-
createAttributeNS
- Specified by:
createAttributeNSin interfaceDocument- Throws:
DOMException
-
createCDATASection
- Specified by:
createCDATASectionin interfaceDocument- Throws:
DOMException
-
createComment
- Specified by:
createCommentin interfaceDocument
-
createDocumentFragment
- Specified by:
createDocumentFragmentin interfaceDocument
-
createElement
- Specified by:
createElementin interfaceDocument- Throws:
DOMException
-
createElementNS
- Specified by:
createElementNSin interfaceDocument- Throws:
DOMException
-
createEntityReference
- Specified by:
createEntityReferencein interfaceDocument- Throws:
DOMException
-
createProcessingInstruction
public DOMProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException - Specified by:
createProcessingInstructionin interfaceDocument- Throws:
DOMException
-
createTextNode
- Specified by:
createTextNodein interfaceDocument
-
getDomConfig
- Specified by:
getDomConfigin interfaceDocument
-
getElementById
- Specified by:
getElementByIdin interfaceDocument
-
getElementsByTagName
- Specified by:
getElementsByTagNamein interfaceDocument
-
getElementsByTagNameNS
- Specified by:
getElementsByTagNameNSin interfaceDocument
-
getImplementation
- Specified by:
getImplementationin interfaceDocument
-
getInputEncoding
- Specified by:
getInputEncodingin interfaceDocument
-
getStrictErrorChecking
public boolean getStrictErrorChecking()- Specified by:
getStrictErrorCheckingin interfaceDocument
-
getXmlEncoding
- Specified by:
getXmlEncodingin interfaceDocument
-
getXmlStandalone
public boolean getXmlStandalone()- Specified by:
getXmlStandalonein interfaceDocument
-
getXmlVersion
- Specified by:
getXmlVersionin interfaceDocument
-
importNode
- Specified by:
importNodein interfaceDocument- Throws:
DOMException
-
normalizeDocument
public void normalizeDocument()- Specified by:
normalizeDocumentin interfaceDocument
-
renameNode
- Specified by:
renameNodein interfaceDocument- Throws:
DOMException
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean strictErrorChecking) - Specified by:
setStrictErrorCheckingin interfaceDocument
-
setXmlStandalone
- Specified by:
setXmlStandalonein interfaceDocument- Throws:
DOMException
-
setXmlVersion
- Specified by:
setXmlVersionin interfaceDocument- Throws:
DOMException
-
resetGrammar
public void resetGrammar()Reset the cached grammar flag. -
getResolverExtensionManager
-
isDTD
public boolean isDTD()Returns true if the XML document is a DTD and false otherwise.- Returns:
- true if the XML document is a DTD and false otherwise.
-
isWithinInternalDTD
public boolean isWithinInternalDTD(int offset) Returns true if 'offset' is within an internal DOCTYPE dtd. Else false.- Parameters:
offset-- Returns:
-
getTrimmedRange
public org.eclipse.lsp4j.Range getTrimmedRange(org.eclipse.lsp4j.Range range) -
getTrimmedRange
public org.eclipse.lsp4j.Range getTrimmedRange(int start, int end) -
findDTDAttrList
Returns the DTD Attribute list for the given element name and empty otherwise.- Parameters:
elementName-- Returns:
- the DTD Attribute list for the given element name and empty otherwise.
-
getSchemaPrefix
Returns the XML Schema prefix (ex : 'xs' for xmlns:xs="http://www.w3.org/2001/XMLSchema")- Returns:
- the XML Schema prefix (ex : 'xs' for xmlns:xs="http://www.w3.org/2001/XMLSchema")
-