Skip to content

Commit

Permalink
Merge pull request hsiafan#17 from soundmonster/master
Browse files Browse the repository at this point in the history
Proper namespace handling
  • Loading branch information
hsiafan committed Nov 19, 2014
2 parents cfedd67 + f8cbeee commit 9d6515f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repositories {

dependencies {
compile 'org.apache.commons:commons-compress:1.6'
compile 'org.apache.commons:commons-lang3:3.3.2'
testCompile 'junit:junit:4.+'
}

Expand Down Expand Up @@ -72,4 +73,4 @@ uploadArchives {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public void parse() throws IOException {
}

while (chunkHeader != null) {
if (chunkHeader.chunkType == ChunkType.XML_END_NAMESPACE) {
/*if (chunkHeader.chunkType == ChunkType.XML_END_NAMESPACE) {
break;
}
}*/
long beginPos = in.tell();
switch (chunkHeader.chunkType) {
case ChunkType.XML_END_NAMESPACE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ public boolean equals(Object o) {

XmlNamespace namespace = (XmlNamespace) o;

if (!prefix.equals(namespace.prefix)) return false;
if (!uri.equals(namespace.uri)) return false;
if (prefix == null && namespace.prefix != null) return false;
if (uri == null && namespace.uri != null) return false;
if (prefix != null && !prefix.equals(namespace.prefix)) return false;
if (uri != null && !uri.equals(namespace.uri)) return false;

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.List;
import java.util.Locale;

import org.apache.commons.lang3.StringEscapeUtils;

/**
* trans to xml text when parse binary xml file.
*
Expand Down Expand Up @@ -87,8 +89,9 @@ public void onAttribute(Attribute attribute) {
} catch (NumberFormatException e) {
finalValue = value;
}
String escapedFinalValue = StringEscapeUtils.escapeXml10(finalValue);
sb.append(attribute.name).append('=').append('"')
.append(finalValue.replace("\"", "\\\"")).append('"');
.append(escapedFinalValue).append('"');
}

//trans int attr value to string
Expand Down

0 comments on commit 9d6515f

Please sign in to comment.