Class XmlNode
- java.lang.Object
-
- com._1c.g5.v8.dt.import_.xml.reader.node.XmlNode
-
-
Constructor Summary
Constructors Constructor Description XmlNode(Node parent, IXmlPartReader partReader)
ConstructorXmlNode(Node parent, String path, IXmlPartReader partReader)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
attribute(String name)
Try to read value of node attribute with nameboolean
exist()
Returns whether this node exists in the xml.IXmlNode
get(int index)
get child of current xml node at index positionIXmlNode
get(String name)
get all child nodes of current xml node with specific nameIXmlNode
get(String name, int index)
get child node of current xml node with specific name at index positionIXmlNode
getChildren()
get children nodes of current xml nodeString
getName()
Iterator<IXmlNode>
iterator()
String
lookupNamespaceURI(String prefix)
Look up the namespace URI associated to the given prefix, starting from this node.String
path()
int
size()
String
text()
Try to read text content of xml nodevoid
toModel(String attributeName, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, Version version, IXmlReadErrorCollector errorCollector)
Try to set attribute of current node in modelvoid
toModel(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, Version version, IXmlReadErrorCollector errorCollector)
Try to set text of current node in modelIXmlNode
withPartReader(IXmlPartReader partReader)
Get handle to this xml node with custom part readerString
xml()
Returns the text content of this node and its descendants-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
XmlNode
public XmlNode(Node parent, IXmlPartReader partReader)
Constructorusage example:
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file); IXmlNode rootNode = new XmlNode(doc, BaseXmlPartReaderProvider.INSTANCE);
- Parameters:
parent
- xml documentNode
partReader
- the specifedIXmlPartReader
for read this node hierarhy, cannot benull
-
XmlNode
public XmlNode(Node parent, String path, IXmlPartReader partReader)
Constructor- Parameters:
parent
- xml documentNode
path
- from the root node to current, cannot benull
partReader
- the specifedIXmlPartReader
for read this node hierarhy, cannot benull
- See Also:
usage example
-
-
Method Detail
-
getName
public String getName()
-
attribute
public String attribute(String name)
Description copied from interface:IXmlNode
Try to read value of node attribute with name
-
text
public String text()
Description copied from interface:IXmlNode
Try to read text content of xml node
-
xml
public String xml()
Description copied from interface:IXmlNode
Returns the text content of this node and its descendants
-
size
public int size()
-
path
public String path()
-
get
public IXmlNode get(int index)
Description copied from interface:IXmlNode
get child of current xml node at index position
-
get
public IXmlNode get(String name)
Description copied from interface:IXmlNode
get all child nodes of current xml node with specific name
-
get
public IXmlNode get(String name, int index)
Description copied from interface:IXmlNode
get child node of current xml node with specific name at index position
-
getChildren
public IXmlNode getChildren()
Description copied from interface:IXmlNode
get children nodes of current xml node- Specified by:
getChildren
in interfaceIXmlNode
- Returns:
- cached and get
IXmlNode
children nodes
-
exist
public boolean exist()
Description copied from interface:IXmlNode
Returns whether this node exists in the xml.
-
lookupNamespaceURI
public String lookupNamespaceURI(String prefix)
Description copied from interface:IXmlNode
Look up the namespace URI associated to the given prefix, starting from this node.- Specified by:
lookupNamespaceURI
in interfaceIXmlNode
- Parameters:
prefix
- The prefix to look for. If this parameter isnull
, the method will return the default namespace URI if any.- Returns:
- the associated namespace URI or
null
if none is found or this node not exist
-
toModel
public void toModel(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, Version version, IXmlReadErrorCollector errorCollector)
Description copied from interface:IXmlNode
Try to set text of current node in model- Specified by:
toModel
in interfaceIXmlNode
- Parameters:
context
-EObject
feature
-EStructuralFeature
version
- the version of importing 1C:Enterprise XML files, cannot benull
errorCollector
-IXmlReadErrorCollector
in which will be added error if it occur
-
toModel
public void toModel(String attributeName, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, Version version, IXmlReadErrorCollector errorCollector)
Description copied from interface:IXmlNode
Try to set attribute of current node in model- Specified by:
toModel
in interfaceIXmlNode
- Parameters:
attributeName
- the attribute name of this node to set in modelcontext
-EObject
feature
-EStructuralFeature
version
- the version of importing 1C:Enterprise XML files, cannot benull
errorCollector
-IXmlReadErrorCollector
in which will be added error if it occur
-
withPartReader
public IXmlNode withPartReader(IXmlPartReader partReader)
Description copied from interface:IXmlNode
Get handle to this xml node with custom part reader- Specified by:
withPartReader
in interfaceIXmlNode
- Parameters:
partReader
- theIXmlPartReader
to read node, cannot benull
- Returns:
- new instance of
IXmlNode
with specifedIXmlPartReader
for read this node hierarchy, nevernull
-
-