Skip to content

Cosmetic xml adjuster fixes #82

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

Merged
merged 2 commits into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public static class JavaApiXmlGeneratorExtensions
{
public static void Save (this JavaApi api, string xmlfile)
{
using (var reader = XmlWriter.Create (xmlfile, new XmlWriterSettings () {
using (var writer = XmlWriter.Create (xmlfile, new XmlWriterSettings () {
Encoding = new UTF8Encoding (false, true),
Indent = true,
OmitXmlDeclaration = true,
}))
api.Save (reader);
api.Save (writer);
}

public static void Save (this JavaApi api, XmlWriter writer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ public static void Load (this JavaApi api, XmlReader reader, bool isReferenceOnl
break; // </api>
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "package")
throw XmlUtil.UnexpectedElementOrContent ("api", reader, "package");
var pkg = api.Packages.FirstOrDefault (p => p.Name == reader.GetAttribute ("name")) ?? new JavaPackage (api);
var pkg = api.Packages.FirstOrDefault (p => p.Name == reader.GetAttribute ("name"));
if (pkg == null) {
pkg = new JavaPackage (api);
api.Packages.Add (pkg);
}
pkg.Load (reader, isReferenceOnly);
api.Packages.Add (pkg);
} while (true);

XmlUtil.VerifyEndElement (reader, "api");
Expand Down