开发者

how to maintain case of attribute name without changing to lower case in html agility pack

i want to maintain case of attribute name without changing to lower case

when i load xml in HTMLAgility pack attribute name开发者_运维问答 changed into lowercase like this

<Author affiliationids="Aff1" correspondingaffiliationid="Aff1"> i want output like this

<Author AffiliationIDS="Aff1" CorrespondingAffiliationID="Aff1">


It is now officially fixed and promised to be included in next release

As for now you can download source and build it yourself.

To prevent lowercase of all attributes use:

HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
document.OptionOutputOriginalCase = true;


You can't do this, unless you change the source (the Html Agility Pack is open source, so you're free to go). it's by design, as it was designed to handle HTML, and HTML is case-insensitive.


I got it! I dont know if it is about new version or something, but I hit the exact problem you had and by reading the innerhtml, i found out it is loaded ok and it's not a problem of reader but the writer.

So instead of using the writeHtml command, I just pulled the output by using DocumentNode.OuterHtml property and it all worked great!

Try it and you will see!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜