P
paul_zaoldyeck
Good Day everyone!!!
i have here a serious problem.my project is delayed because of this.
i'm trying to make a function for an XML Reader that accepts values
from the other modules(done by the others). they only have to specify
the name of the element where they want to get the value. i only need
to return a specific value.
here's an xml example:
<ParseObject xmlns="urnarser-schema">
<Element>
<ID>1</ID>
<ElementType>method</ElementType>
<Names>add</Names>
</Element>
<Element>
<ID>1</ID>
<ElementID>0</ElementID>
<ElementType>method</ElementType>
<Names>add</Names>
<AccessModifier>protected</AccessModifier>
<Return>Int32</Return>
<Parameter>
<ParamID>0</ParamID>
<Reference>1</Reference>
<ParamType>Int32</ParamType>
</Parameter>
<Parameter>
<ParamID>1</ParamID>
<Reference>1</Reference>
<ParamType>Int32</ParamType>
</Parameter>
</Element>
</ParseObject>
the other module may for example want to get the value of
AccessModifier. All they need to do is to pass the value of the
ElementID and of the ElementType and the element name AccessModifier.
how will i emplement this. my code can't read the ElementType and
AccessModifier.if i try another way, it won't return the exact
one.here's my code.
while (reader.Read())
{
if(reader.NodeType == XmlNodeType.Element)
{
if(reader.Name == "ElementID")
{
idFromXml = reader.ReadElementString();
if(idFromXml == elementId)
{
Console.WriteLine(idFromXml);
reader.MoveToNextAttribute();
Console.WriteLine(reader.Name);
if(reader.Name == "ElementType")
{
Console.WriteLine(reader.Name);
}
}
else
{
Console.WriteLine("ElementID not found");
break;
}
please help me...thanks
i have here a serious problem.my project is delayed because of this.
i'm trying to make a function for an XML Reader that accepts values
from the other modules(done by the others). they only have to specify
the name of the element where they want to get the value. i only need
to return a specific value.
here's an xml example:
<ParseObject xmlns="urnarser-schema">
<Element>
<ID>1</ID>
<ElementType>method</ElementType>
<Names>add</Names>
</Element>
<Element>
<ID>1</ID>
<ElementID>0</ElementID>
<ElementType>method</ElementType>
<Names>add</Names>
<AccessModifier>protected</AccessModifier>
<Return>Int32</Return>
<Parameter>
<ParamID>0</ParamID>
<Reference>1</Reference>
<ParamType>Int32</ParamType>
</Parameter>
<Parameter>
<ParamID>1</ParamID>
<Reference>1</Reference>
<ParamType>Int32</ParamType>
</Parameter>
</Element>
</ParseObject>
the other module may for example want to get the value of
AccessModifier. All they need to do is to pass the value of the
ElementID and of the ElementType and the element name AccessModifier.
how will i emplement this. my code can't read the ElementType and
AccessModifier.if i try another way, it won't return the exact
one.here's my code.
while (reader.Read())
{
if(reader.NodeType == XmlNodeType.Element)
{
if(reader.Name == "ElementID")
{
idFromXml = reader.ReadElementString();
if(idFromXml == elementId)
{
Console.WriteLine(idFromXml);
reader.MoveToNextAttribute();
Console.WriteLine(reader.Name);
if(reader.Name == "ElementType")
{
Console.WriteLine(reader.Name);
}
}
else
{
Console.WriteLine("ElementID not found");
break;
}
please help me...thanks