Giter Club home page Giter Club logo

Comments (12)

jmakeig avatar jmakeig commented on July 17, 2024

I'll take a look and try to fix this. I imagine there's something going on with the order parsing the attributes and the xmlns bindings.

from sax-js.

isaacs avatar isaacs commented on July 17, 2024

Can you express this bug in the form of a failing test?

from sax-js.

jmakeig avatar jmakeig commented on July 17, 2024

Yup. That's step 0 when I get a chance to dig in.

from sax-js.

jmakeig avatar jmakeig commented on July 17, 2024

I think this test should pass if the binding and the attribute order is correct.

require(__dirname).test(
  { xml : "<parent a:attr='value' xmlns:a='http://ATTRIBUTE' />"
  , expect :
    [ 
      [ "opennamespace"
      , { prefix: "a"
        , uri: "http://ATTRIBUTE"
        }
      ]
    , [ "attribute"
      , { name: "a:attr"
        , local: "attr"
        , prefix: "a"
        , uri: "http://ATTRIBUTE"
        , value: "value"
        }
      ]
    , [ "attribute"
      , { name: 'xmlns:a',
        value: 'http://ATTRIBUTE',
        prefix: 'xmlns',
        local: 'a',
        uri: '' 
        }
      ]
    , [ "opentag"
      , { name: "parent"
        , uri: ""
        , prefix: ""
        , local: "parent"
        , attributes:
          { "attr":
            { name: "a:attr"
            , local: "attr"
            , prefix: "a"
            , uri: "http://ATTRIBUTE"
            , value: "value"
            }
          , "xmlns:a":
            { name: "xmlns:a"
            , local: "a"
            , prefix: "xmlns"
            , uri: ""
            , value: "http://ATTRIBUTE"
            }
          }
        , bindings: ["a"]
        }
      ]
    , ["closetag", "parent"]
    , ["closenamespace", { prefix: 'a', uri: 'http://ATTRIBUTE' }
]
    ]
  , strict : true
  , opt : { xmlns: true }
  }
)

from sax-js.

isaacs avatar isaacs commented on July 17, 2024

Wanna send a pull request?

from sax-js.

jmakeig avatar jmakeig commented on July 17, 2024

I haven't fixed the code yet. Probably won't get to it until the weekend. I could pull just the test, if that's what you're asking.

from sax-js.

isaacs avatar isaacs commented on July 17, 2024

Sure, you can just send a pull req with the test, that's fine. I can
usually track down the bug pretty quickly.

On Wed, Oct 12, 2011 at 12:24, Justin Makeig
[email protected]
wrote:

I haven't fixed the code yet. Probably won't get to it until the weekend. I could pull just the test, if that's what you're asking.

Reply to this email directly or view it on GitHub:
#41 (comment)

from sax-js.

isaacs avatar isaacs commented on July 17, 2024

I see... so, it seems like the attributes would always have to be held until the end of the tag if xmlns is set, since you could get a new namespace definition at any time.

Am I understanding that properly?

from sax-js.

jmakeig avatar jmakeig commented on July 17, 2024

Yes, within an element declaration you can both declare a new namespace binding and use it on an attribute. Without doing some fancy peek-ahead on attribute prefixes, you'd have to figure out an element's declared bindings before parsing the attributes.

from sax-js.

isaacs avatar isaacs commented on July 17, 2024

Got a fix for this partly done. didn't mean to close this bug, I was just fixing the test, not the code that it's testing, whoops :)

from sax-js.

isaacs avatar isaacs commented on July 17, 2024

Fixed on 58254b2, published as 0.3.0 (since the API changed).

from sax-js.

jmakeig avatar jmakeig commented on July 17, 2024

Looks good with some quick additional testing in my own app. Thanks for the quick turnaround.

from sax-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.