Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baseurl for xml (as well as html) #388

Merged
merged 1 commit into from
Mar 15, 2016
Merged

Conversation

Klortho
Copy link
Contributor

@Klortho Klortho commented Feb 10, 2016

This PR comprises two changes. I'll describe them as line comments below.

The main purpose of this PR is to add the baseUrl option to FromXml. I noticed that this (and a few other options) were already added to FromHtml a long time ago, so I added them to FromXml in the same way.

The two methods are almost identical, and probably should be refactored to move the common code into a separate function that they both call. If it had been done that way originally, then users of FromXml would have benefited from these extra options added to FromHtml.

So, some of the changes were just for the purposes of harmonizing the FromHtml and FromXml methods. I didn't want to factor out into a separate function, though -- it seemed like too big a change. In lieu of that, I just tried to get the two functions to be as similar as possible.

@@ -317,7 +317,7 @@ xmlParserOption getParserOptions(v8::Local<v8::Object> props) {
ret |= getParserOption(props, "cdata", XML_PARSE_NOCDATA, false); // 16384: merge CDATA as text nodes

ret |= getParserOption(props, "noxincnode", XML_PARSE_NOXINCNODE); // 32768: do not generate XINCLUDE START/END nodes
ret |= getParserOption(props, "xinclude", XML_PARSE_NOXINCNODE, false); // 32768: do not generate XINCLUDE START/END nodes
ret |= getParserOption(props, "xincnode", XML_PARSE_NOXINCNODE, false); // 32768: do not generate XINCLUDE START/END nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the commit message describes, I am having trouble getting xinclude to work, and tried to fix it with this change. This looks like a typo to me: the xinclude property is already defined above, and I think this one should be xincnode. But, it didn't fix my problem, and so I'm not sure. If I'm wrong, let me know, and I'll take this out of the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is a typo. The xinclude option is defined here. Good catch.

@Klortho
Copy link
Contributor Author

Klortho commented Feb 22, 2016

Hello?

@Klortho
Copy link
Contributor Author

Klortho commented Feb 29, 2016

In case someone comes along needing this feature, I published this as @klortho/libxmljs

@defunctzombie
Copy link
Collaborator

@teleological @rc0x03 could you take a look?

This also needs tests.

@rchipka
Copy link
Member

rchipka commented Mar 8, 2016

Since FromXml and FromHtml are so similar I think they should be consolidated into a simpler function. Maybe we could do this in the same PR? If you all agree, maybe @Klortho can make both functions call something like Parse(void* data, int isHtml = 0). If not, after tests are added I think this is fine as-is.

@Klortho
Copy link
Contributor Author

Klortho commented Mar 9, 2016

I just added a test for baseUrl on fromXml, but

consolidated into a simpler function. Maybe we could do this in the same PR?

I'm afraid I don't really have time right now, nor am I confident to do it -- that NAN code looks a little scary.

@Klortho
Copy link
Contributor Author

Klortho commented Mar 12, 2016

Tests pass CI.

@rchipka
Copy link
Member

rchipka commented Mar 14, 2016

Tests look good. Squash the commits and we can merge this.

@Klortho
Copy link
Contributor Author

Klortho commented Mar 14, 2016

Done

rchipka added a commit that referenced this pull request Mar 15, 2016
Fix fromXML baseURL and `xincnode` option typo.
@rchipka rchipka merged commit c711eeb into libxmljs:master Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants