OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XML Designing Problems.

[ Lists Home | Date Index | Thread Index ]

Thanks for all those who responded.

I am developing an application using the XERCES DOM parser which will
provide some methods using which you can retrive the values from a given XML
document.  For example the below piece of code takes document object as a
parameter and returns the value represented by tagName Node.

 public String getValueByTag(Document document, String tagName, int index)
    throws NullPointerException, Exception
 {
  String value = null;

  try
  {
    NodeList
nodelist=document.getDocumentElement().getElementsByTagName(tagName);

value=((Node)((Element)nodelist.item(index))).getFirstChild().getNodeValue()
.trim();
  }
  catch(Exception e)
  {
   throw e;
  }
  return value;
 }

Now if I have this kind of design for the document the results will be
unpredictable right?  I never know corresponding the which XYZ tag the value
has been returned.  Any suggestions on how I can modify my method so that
the caller can say, get me the value of XYZ which is a child of the root
element or something like that.

Thanks & Regards,
Rajesh


----- Original Message -----
From: "Lisa Retief" <lisa@itouchlabs.com>
To: "'Rajesh AVRS'" <rajesh.ram@wipro.com>; <xml-dev@lists.xml.org>
Sent: Friday, February 08, 2002 12:10 PM
Subject: RE: [xml-dev] XML Designing Problems.


> Hi Rajesh,
>
> There is nothing wrong with re-using an element in different places and
> levels. A <date> elements, for example, could be used in many contexts in
> the same document. If you are duplicating the actual information then that
> is bad.
>
> Lisa
>
> -----Original Message-----
> From: Rajesh AVRS [mailto:rajesh.ram@wipro.com]
> Sent: 08 February 2002 06:25
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] XML Designing Problems.
>
>
> Hi All,
>
> I have an xml document that looks like this.
>
> <XML>
>     <XYZ> Value of xyz </XYZ>
>     <Children1>
>         <ABC> Value of Element1 </ABC>
>         <XYZ> Value for this xyz </XYZ>
>     </Children1>
> </XML>
>
> As you can see, the element XYZ is being used twice, once as the direct
> child of the root and another as children for the element 'Children1'.
>
> My Questions:
>
> 1) Is this an acceptible design for the document?
> 2) Is there any specification that states that XML document shouldn't have
> duplicate elements like this?
>
> Please respond ASAP!
>
> Thanks & Regards,
> Rajesh
>
>

**************************Disclaimer************************************
      


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 ********************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS