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

Xml.PokeInnerText mangles DOCTYPE definition #1692

Closed
kentcb opened this issue Sep 29, 2017 · 3 comments
Closed

Xml.PokeInnerText mangles DOCTYPE definition #1692

kentcb opened this issue Sep 29, 2017 · 3 comments

Comments

@kentcb
Copy link
Contributor

kentcb commented Sep 29, 2017

Description

In migrating to FAKE 5, I've switched from XmlPokeInnerText to Xml.PokeInnerText. However, the result is that my XML is now left in an invalid state:

BEFORE:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

AFTER:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>

Repro steps

Please provide the steps required to reproduce the problem

  1. Update an XML file that has a DOCTYPE definition using Xml.PokeInnerText

Expected behavior

Should act same as old XmlPokeInnerText.

Actual behavior

Breaks the XML.

Known workarounds

Use old API.

@matthid
Copy link
Member

matthid commented Sep 30, 2017

Can you provide a minimal XML sample and the PokeInnerText call? I feel like this could be a framework bug as I cannot recall any code changes there. Though the [] look quite suspicious to an empty list being printed so I'd like to reproduce that locally before reporting to the corefx team.

@kentcb
Copy link
Contributor Author

kentcb commented Oct 2, 2017

Here's some example XML (Info.plist):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleIdentifier</key>
    <string>foo</string>
</dict>
</plist>

Here's an example target:

Target.Create "testing" (fun _ ->
    let plist = srcDir @@ "UI.iOS/Info.plist"
    let bundleIdentifier = "whateva"
    Xml.PokeInnerText plist "plist/dict/key[text()='CFBundleIdentifier']/following-sibling::string" bundleIdentifier
)

And here's the (invalid) output:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>
<plist version="1.0">
  <dict>
    <key>CFBundleIdentifier</key>
    <string>whateva</string>
  </dict>
</plist>

@matthid
Copy link
Member

matthid commented May 19, 2018

This is kind of an unfortunate side-effect of using XmlDocument:

I changed it in a way that without [] is always preferred but realistically that might break people who expect [], unfortunately it seems to be quite hard to leave it as-is.
So this should be fixed with RC015

@matthid matthid closed this as completed May 19, 2018
matthid added a commit that referenced this issue May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants