Comments (12)
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.
Can you express this bug in the form of a failing test?
from sax-js.
Yup. That's step 0 when I get a chance to dig in.
from sax-js.
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.
Wanna send a pull request?
from sax-js.
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.
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.
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.
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.
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.
Fixed on 58254b2, published as 0.3.0 (since the API changed).
from sax-js.
Looks good with some quick additional testing in my own app. Thanks for the quick turnaround.
from sax-js.
Related Issues (20)
- Question on special character & with Angular build HOT 2
- Exotic export strategy causes Rollup to fail HOT 2
- The startTagLine and startTagColumn members would be useful
- <script>a = "</scr" + "ipt>";<script> is parsed incorrectly
- Processing instruction ending with "?" fails to parse
- closing square bracket in a doctype comment leads to an error
- Missing dependency 'stream' HOT 8
- Project still active? HOT 5
- Move away from Buffer constructor
- Underscores in string causing Error
- Is this code safe against various XML attacks? HOT 1
- Multiple root elements, text in second root
- Problems with V10 HOT 2
- Are Promises supported (asynchronous callbacks)? HOT 2
- BUG: Non-strict entity detection misses close tag
- Attributes in root element not parsing
- XML within XML being parsed HOT 2
- Max buffer length exceeded: attribValue HOT 1
- opentag and closetag events not firing HOT 1
- Stream : Uncaught TypeError: Cannot read property 'prototype' of undefined HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sax-js.