XML valueless parameters?

Discussion in 'Java' started by lbrtchx@gmail.com, Apr 9, 2009.

  1. Guest

    I was wondering what the method getValue(int) of SAX2 Attributes
    returns if the parameter is just flag, something like:
    ~
    <par conf="0" do />
    ~
    instead of
    ~
    <par conf="0" do="true|false" />
    ~
    this is what the method def. says:
    ~
    http://java.sun.com/webservices/docs/1.6/api/org/xml/sax/Attributes.html#getValue(int)
    Look up an attribute's value by index.
    If the attribute value is a list of tokens (IDREFS, ENTITIES, or
    NMTOKENS), the tokens will be concatenated into a single string with
    each token separated by a single space.
    Parameters: index - The attribute index (zero-based).
    Returns: The attribute's value as a string, or null if the index is
    out of range.
    ~
    Thanks
    lbrtchx
     
    , Apr 9, 2009
    #1
    1. Advertising

  2. Lew Guest

    wrote:
    > I was wondering what the method getValue(int) of SAX2 Attributes
    > returns if the parameter is just flag, something like:
    > ~
    > <par conf="0" do />


    This is not well-formed XML and should be rejected outright by the parser.
    <http://www.w3.org/TR/REC-xml/#sec-starttags>
    <http://www.w3.org/TR/REC-xml/#dt-attr>

    --
    Lew
     
    Lew, Apr 10, 2009
    #2
    1. Advertising

  3. Lew wrote:
    > wrote:
    >> I was wondering what the method getValue(int) of SAX2 Attributes
    >> returns if the parameter is just flag, something like:
    >> ~
    >> <par conf="0" do />

    >
    > This is not well-formed XML and should be rejected outright by the
    > parser. <http://www.w3.org/TR/REC-xml/#sec-starttags>
    > <http://www.w3.org/TR/REC-xml/#dt-attr>


    What Lew said. The closest you can come that's well-formed is

    <par config="" />

    Which returns an empty string, not null, in case there was any question.
     
    Mike Schilling, Apr 10, 2009
    #3
  4. On Apr 10, 10:09 am, Lew <> wrote:
    > wrote:
    > > I was wondering what the method getValue(int) of SAX2 Attributes
    > > returns if the parameter is just flag, something like:
    > > ~
    > > <par conf="0" do />

    >
    > This is not well-formed XML ..


    You can check the well-formedness of your XML in the XMLWFC.
    <http://pscode.org/xml/xmltools.html#xmlwfc>

    --
    Andrew T.
    pscode.org
     
    Andrew Thompson, Apr 10, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jonck van der Kogel
    Replies:
    2
    Views:
    1,004
    Jonck van der Kogel
    May 27, 2004
  2. Jason
    Replies:
    2
    Views:
    541
    Jonathan Mcdougall
    May 13, 2006
  3. kito
    Replies:
    2
    Views:
    436
  4. Erik Wasser
    Replies:
    5
    Views:
    500
    Peter J. Holzer
    Mar 5, 2006
  5. Florian Loitsch
    Replies:
    11
    Views:
    259
    Michael Winter
    Mar 15, 2005
Loading...

Share This Page