Hi All,
I have an xml

<?xml version="1.0" ?> 
- <Rowsets DateCreated="2011-03-15T16:31:51" EndDate="2011-03-15T16:31:51" StartDate="2011-03-15T15:31:51" Version="12.0.2 Build(88)">
- <Rowset>
- <Columns>
  <Column Description="ProductID" MaxRange="1" MinRange="0" Name="ProductID" SQLDataType="4" SourceColumn="ProductID" /> 
  <Column Description="BatchID" MaxRange="1" MinRange="0" Name="BatchID" SQLDataType="12" SourceColumn="BatchID" /> 
  <Column Description="ReviewVersion" MaxRange="1" MinRange="0" Name="ReviewVersion" SQLDataType="-6" SourceColumn="ReviewVersion" /> 
  <Column Description="DispositionVersion" MaxRange="1" MinRange="0" Name="DispositionVersion" SQLDataType="-6" SourceColumn="DispositionVersion" /> 
  <Column Description="ItemId" MaxRange="1" MinRange="0" Name="ItemId" SQLDataType="4" SourceColumn="ItemId" /> 
  <Column Description="ItemName" MaxRange="1" MinRange="0" Name="ItemName" SQLDataType="12" SourceColumn="ItemName" /> 
  <Column Description="ReviewCompleted" MaxRange="1" MinRange="0" Name="ReviewCompleted" SQLDataType="-7" SourceColumn="ReviewCompleted" /> 
  <Column Description="Reviewer" MaxRange="1" MinRange="0" Name="Reviewer" SQLDataType="12" SourceColumn="Reviewer" /> 
  <Column Description="Dispostioner" MaxRange="1" MinRange="0" Name="Dispostioner" SQLDataType="12" SourceColumn="Dispostioner" /> 
  </Columns>
- <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>99</ItemId> 
  <ItemName>CheckListItem1</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
- <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>100</ItemId> 
  <ItemName>CheckListItem2</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
- <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>101</ItemId> 
  <ItemName>CheckListItem3</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
- <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>102</ItemId> 
  <ItemName>CheckListItem4</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
- <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>103</ItemId> 
  <ItemName>CheckListItem5</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
+ <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>104</ItemId> 
  <ItemName>CheckListItem6</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
+ <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>105</ItemId> 
  <ItemName>CheckListItem7</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner>Reddy, Sireesha</Dispostioner> 
  </Row>
+ <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>106</ItemId> 
  <ItemName>CheckListItem8</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner>Reddy, Sireesha</Dispostioner> 
  </Row>
+ <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>107</ItemId> 
  <ItemName>CheckListItem9</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
+ <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>108</ItemId> 
  <ItemName>CheckListItem10</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer /> 
  <Dispostioner /> 
  </Row>
+ <Row>
  <ProductID>1</ProductID> 
  <BatchID>A1234</BatchID> 
  <ReviewVersion>1</ReviewVersion> 
  <DispositionVersion>1</DispositionVersion> 
  <ItemId>109</ItemId> 
  <ItemName>Investigations</ItemName> 
  <ReviewCompleted>0</ReviewCompleted> 
  <Reviewer>Sireesha</Reviewer> 
  <Dispostioner /> 
  </Row>
  </Rowset>
  </Rowsets>

in the above xml if Reviewer node does not have text node then it will be an empty tag.

My problem is like

in javascript i need to display like
if Reviewer is empty node
then i need to assign "" to a text box
else
i need to assign the text node value

when i alert this alert(XMLData.getElementsByTagName("ItemId ")[0].childNodes[0].Node.text );

ill get o/p as 99

but i alert this

when i alert this alert(XMLData.getElementsByTagName("Reviewer")[0].childNodes[0].Node.text );

it gives an runtime error saying that object expected because text node is not there.
but i dont know handle this, please help me if any knows how to do this.


Thanks in advance.
Regards,
Sireesha

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.