C# 클래스 SIL.Utils.XmlUtils

Summary description for XmlUtils.
파일 보기 프로젝트 열기: sillsdev/FieldWorks

공개 메소드들

메소드 설명
AppendAttribute ( XmlNode parent, string attrName, string attrVal ) : void

Append an attribute with the specified name and value to parent.

AppendElement ( XmlNode parent, string elementName ) : XmlElement

Append an attribute with the specified name and value to parent.

CloneNodeWithDocument ( XmlNode node ) : XmlNode

return the deep clone of the given node, in a clone of its document context.

CreateTransform ( string xslName, string assemblyName ) : XslCompiledTransform
DecodeXml ( string sInput ) : string

Convert an encoded string (safe XML) into plain text.

DecodeXmlAttribute ( string sInput ) : string

Convert an encoded attribute string into plain text.

FindIndexOfMatchingNode ( IEnumerable nodes, XmlNode target ) : int

Find the index of the node in nodes that 'matches' the target node. Return -1 if not found.

FindNode ( XmlNode node, string name ) : XmlNode

Return the node that has the desired 'name', either the input node or a decendent.

GetAttributeValue ( XmlNode node, string attrName ) : string

Get an optional attribute value from an XmlNode.

GetAttributeValue ( XmlNode node, string attrName, string defaultValue ) : string

Deprecated: use GetOptionalAttributeValue instead.

GetBooleanAttributeValue ( XmlNode node, string attrName ) : bool

Returns true if value of attrName is 'true' or 'yes' (case ignored)

GetBooleanAttributeValue ( string sValue ) : bool

Returns true if sValue is 'true' or 'yes' (case ignored)

GetFirstNonCommentChild ( XmlNode node ) : XmlNode

Return the first child of the node that is not a comment (or null).

GetLocalizedAttributeValue ( SIL.Utils.StringTable tbl, XmlNode node, string attrName, string defaultString ) : string

Get an optional attribute value from an XmlNode, and look up its localized value in the given StringTable.

GetMandatoryIntegerAttributeValue ( XmlNode node, string attrName ) : int

Returns a integer obtained from the (mandatory) attribute named.

GetMandatoryIntegerListAttributeValue ( XmlNode node, string attrName ) : int[]

Retrieve an array, given an attribute consisting of a comma-separated list of integers

GetMandatoryUIntegerListAttributeValue ( XmlNode node, string attrName ) : uint[]

Retrieve an array, given an attribute consisting of a comma-separated list of integers

GetManditoryAttributeValue ( XmlNode node, string attrName ) : string

Get an obligatory attribute value.

GetOptionalAttributeValue ( XmlNode node, string attrName ) : string

Get an optional attribute value from an XmlNode.

GetOptionalAttributeValue ( XmlNode node, string attrName, string defaultString ) : string

Get an optional attribute value from an XmlNode.

GetOptionalBooleanAttributeValue ( XmlNode node, string attrName, bool defaultValue ) : bool

Get an optional attribute value from an XmlNode.

GetOptionalIntegerValue ( XmlNode node, string attrName, int defaultVal ) : int

Return an optional integer attribute value, or if not found, the default value.

GetStaticMethod ( XmlNode node, string sAssemblyAttr, string sClassAttr, string sMethodName, Type &typeFound ) : MethodInfo

Utility function to find a methodInfo for the named method. It is a static method of the class specified in the EditRowClass of the EditRowAssembly.

GetXPathInDocument ( XmlNode node ) : string

build an xpath to the given node in its document.

MakeIntegerListValue ( int vals ) : string

Make a value suitable for GetMandatoryIntegerListAttributeValue to parse.

MakeListValue ( List vals ) : string

Make a comma-separated list of the ToStrings of the values in the list.

MakeListValue ( List vals ) : string

Make a comma-separated list of the ToStrings of the values in the list.

MakeSafeXml ( string sInput ) : string

Fix the string to be safe in a text region of XML.

MakeSafeXmlAttribute ( string sInput ) : string

Fix the string to be safe in an attribute value of XML.

NodesMatch ( XmlNode node1, XmlNode node2 ) : bool

Return true if the two nodes match. Corresponding children should match, and corresponding attributes (though not necessarily in the same order). The nodes are expected to be actually XmlElements; not tested for other cases. Comments do not affect equality.

SerializeObjectToXmlString ( object objToSerialize ) : string

Try to serialize the given object into an xml string

SetAttribute ( XmlNode parent, string attrName, string attrVal ) : void

Change the value of the specified attribute, appending it if not already present.

VisitAttributes ( XmlNode input, IAttributeVisitor visitor ) : bool

Allow the visitor to 'visit' each attribute in the input XmlNode.

보호된 메소드들

메소드 설명
MakeGetStaticMethodErrorMessage ( string sMainMsg, string sContext ) : string

비공개 메소드들

메소드 설명
ConvertMultiparagraphToSafeXml ( string sInput ) : string
DeserializeXmlString ( string xml, Type targetType ) : object
GetIndexAmongSiblings ( XmlNode node ) : int
GetStaticMethod ( string sAssemblyName, string sClassName, string sMethodName, string sContext, Type &typeFound ) : MethodInfo

메소드 상세

AppendAttribute() 공개 정적인 메소드

Append an attribute with the specified name and value to parent.
public static AppendAttribute ( XmlNode parent, string attrName, string attrVal ) : void
parent System.Xml.XmlNode
attrName string
attrVal string
리턴 void

AppendElement() 공개 정적인 메소드

Append an attribute with the specified name and value to parent.
public static AppendElement ( XmlNode parent, string elementName ) : XmlElement
parent System.Xml.XmlNode
elementName string
리턴 System.Xml.XmlElement

CloneNodeWithDocument() 공개 정적인 메소드

return the deep clone of the given node, in a clone of its document context.
public static CloneNodeWithDocument ( XmlNode node ) : XmlNode
node System.Xml.XmlNode
리턴 System.Xml.XmlNode

CreateTransform() 공개 정적인 메소드

public static CreateTransform ( string xslName, string assemblyName ) : XslCompiledTransform
xslName string
assemblyName string
리턴 System.Xml.Xsl.XslCompiledTransform

DecodeXml() 공개 정적인 메소드

Convert an encoded string (safe XML) into plain text.
public static DecodeXml ( string sInput ) : string
sInput string
리턴 string

DecodeXmlAttribute() 공개 정적인 메소드

Convert an encoded attribute string into plain text.
public static DecodeXmlAttribute ( string sInput ) : string
sInput string
리턴 string

FindIndexOfMatchingNode() 공개 정적인 메소드

Find the index of the node in nodes that 'matches' the target node. Return -1 if not found.
public static FindIndexOfMatchingNode ( IEnumerable nodes, XmlNode target ) : int
nodes IEnumerable The nodes.
target System.Xml.XmlNode The target.
리턴 int

FindNode() 공개 정적인 메소드

Return the node that has the desired 'name', either the input node or a decendent.
public static FindNode ( XmlNode node, string name ) : XmlNode
node System.Xml.XmlNode The XmlNode to look in.
name string The XmlNode name to find.
리턴 System.Xml.XmlNode

GetAttributeValue() 공개 정적인 메소드

Get an optional attribute value from an XmlNode.
public static GetAttributeValue ( XmlNode node, string attrName ) : string
node System.Xml.XmlNode The XmlNode to look in.
attrName string The attribute to find.
리턴 string

GetAttributeValue() 공개 정적인 메소드

Deprecated: use GetOptionalAttributeValue instead.
public static GetAttributeValue ( XmlNode node, string attrName, string defaultValue ) : string
node System.Xml.XmlNode
attrName string
defaultValue string
리턴 string

GetBooleanAttributeValue() 공개 정적인 메소드

Returns true if value of attrName is 'true' or 'yes' (case ignored)
public static GetBooleanAttributeValue ( XmlNode node, string attrName ) : bool
node System.Xml.XmlNode The XmlNode to look in.
attrName string The optional attribute to find.
리턴 bool

GetBooleanAttributeValue() 공개 정적인 메소드

Returns true if sValue is 'true' or 'yes' (case ignored)
public static GetBooleanAttributeValue ( string sValue ) : bool
sValue string
리턴 bool

GetFirstNonCommentChild() 공개 정적인 메소드

Return the first child of the node that is not a comment (or null).
public static GetFirstNonCommentChild ( XmlNode node ) : XmlNode
node System.Xml.XmlNode
리턴 System.Xml.XmlNode

GetLocalizedAttributeValue() 공개 정적인 메소드

Get an optional attribute value from an XmlNode, and look up its localized value in the given StringTable.
public static GetLocalizedAttributeValue ( SIL.Utils.StringTable tbl, XmlNode node, string attrName, string defaultString ) : string
tbl SIL.Utils.StringTable
node System.Xml.XmlNode
attrName string
defaultString string
리턴 string

GetMandatoryIntegerAttributeValue() 공개 정적인 메소드

Returns a integer obtained from the (mandatory) attribute named.
public static GetMandatoryIntegerAttributeValue ( XmlNode node, string attrName ) : int
node System.Xml.XmlNode The XmlNode to look in.
attrName string The mandatory attribute to find.
리턴 int

GetMandatoryIntegerListAttributeValue() 공개 정적인 메소드

Retrieve an array, given an attribute consisting of a comma-separated list of integers
public static GetMandatoryIntegerListAttributeValue ( XmlNode node, string attrName ) : int[]
node System.Xml.XmlNode
attrName string
리턴 int[]

GetMandatoryUIntegerListAttributeValue() 공개 정적인 메소드

Retrieve an array, given an attribute consisting of a comma-separated list of integers
public static GetMandatoryUIntegerListAttributeValue ( XmlNode node, string attrName ) : uint[]
node System.Xml.XmlNode
attrName string
리턴 uint[]

GetManditoryAttributeValue() 공개 정적인 메소드

Get an obligatory attribute value.
/// Thrown when the value is not found in the node. ///
public static GetManditoryAttributeValue ( XmlNode node, string attrName ) : string
node System.Xml.XmlNode The XmlNode to look in.
attrName string The required attribute to find.
리턴 string

GetOptionalAttributeValue() 공개 정적인 메소드

Get an optional attribute value from an XmlNode.
public static GetOptionalAttributeValue ( XmlNode node, string attrName ) : string
node System.Xml.XmlNode The XmlNode to look in.
attrName string The attribute to find.
리턴 string

GetOptionalAttributeValue() 공개 정적인 메소드

Get an optional attribute value from an XmlNode.
public static GetOptionalAttributeValue ( XmlNode node, string attrName, string defaultString ) : string
node System.Xml.XmlNode The XmlNode to look in.
attrName string The attribute to find.
defaultString string
리턴 string

GetOptionalBooleanAttributeValue() 공개 정적인 메소드

Get an optional attribute value from an XmlNode.
public static GetOptionalBooleanAttributeValue ( XmlNode node, string attrName, bool defaultValue ) : bool
node System.Xml.XmlNode The XmlNode to look in.
attrName string The attribute to find.
defaultValue bool
리턴 bool

GetOptionalIntegerValue() 공개 정적인 메소드

Return an optional integer attribute value, or if not found, the default value.
public static GetOptionalIntegerValue ( XmlNode node, string attrName, int defaultVal ) : int
node System.Xml.XmlNode
attrName string
defaultVal int
리턴 int

GetStaticMethod() 공개 정적인 메소드

Utility function to find a methodInfo for the named method. It is a static method of the class specified in the EditRowClass of the EditRowAssembly.
public static GetStaticMethod ( XmlNode node, string sAssemblyAttr, string sClassAttr, string sMethodName, Type &typeFound ) : MethodInfo
node System.Xml.XmlNode
sAssemblyAttr string
sClassAttr string
sMethodName string
typeFound System.Type
리턴 System.Reflection.MethodInfo

GetXPathInDocument() 공개 정적인 메소드

build an xpath to the given node in its document.
public static GetXPathInDocument ( XmlNode node ) : string
node System.Xml.XmlNode
리턴 string

MakeGetStaticMethodErrorMessage() 정적인 보호된 메소드

static protected MakeGetStaticMethodErrorMessage ( string sMainMsg, string sContext ) : string
sMainMsg string
sContext string
리턴 string

MakeIntegerListValue() 공개 정적인 메소드

Make a value suitable for GetMandatoryIntegerListAttributeValue to parse.
public static MakeIntegerListValue ( int vals ) : string
vals int
리턴 string

MakeListValue() 공개 정적인 메소드

Make a comma-separated list of the ToStrings of the values in the list.
public static MakeListValue ( List vals ) : string
vals List
리턴 string

MakeListValue() 공개 정적인 메소드

Make a comma-separated list of the ToStrings of the values in the list.
public static MakeListValue ( List vals ) : string
vals List
리턴 string

MakeSafeXml() 공개 정적인 메소드

Fix the string to be safe in a text region of XML.
public static MakeSafeXml ( string sInput ) : string
sInput string
리턴 string

MakeSafeXmlAttribute() 공개 정적인 메소드

Fix the string to be safe in an attribute value of XML.
public static MakeSafeXmlAttribute ( string sInput ) : string
sInput string
리턴 string

NodesMatch() 정적인 공개 메소드

Return true if the two nodes match. Corresponding children should match, and corresponding attributes (though not necessarily in the same order). The nodes are expected to be actually XmlElements; not tested for other cases. Comments do not affect equality.
static public NodesMatch ( XmlNode node1, XmlNode node2 ) : bool
node1 System.Xml.XmlNode
node2 System.Xml.XmlNode
리턴 bool

SerializeObjectToXmlString() 공개 정적인 메소드

Try to serialize the given object into an xml string
public static SerializeObjectToXmlString ( object objToSerialize ) : string
objToSerialize object
리턴 string

SetAttribute() 공개 정적인 메소드

Change the value of the specified attribute, appending it if not already present.
public static SetAttribute ( XmlNode parent, string attrName, string attrVal ) : void
parent System.Xml.XmlNode
attrName string
attrVal string
리턴 void

VisitAttributes() 공개 정적인 메소드

Allow the visitor to 'visit' each attribute in the input XmlNode.
public static VisitAttributes ( XmlNode input, IAttributeVisitor visitor ) : bool
input System.Xml.XmlNode
visitor IAttributeVisitor
리턴 bool