Skip to content

updated: output xml with comment node. - #9

Merged
zhengchun merged 2 commits into
antchfx:masterfrom
yitype:output-xml
Dec 23, 2018
Merged

zhengchun merged 2 commits into
antchfx:masterfrom
yitype:output-xml

Conversation

@yitype

@yitype yitype commented Dec 22, 2018

Copy link
Copy Markdown
Contributor

The comment node should output as a block of comment text

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 82.663% when pulling d622cb9 on zhao5908:output-xml into 431a9e9 on antchfx:master.

@coveralls

coveralls commented Dec 22, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.06%) to 82.25% when pulling e31a81f on zhao5908:output-xml into 431a9e9 on antchfx:master.

@zhengchun

Copy link
Copy Markdown
Contributor

Thanks for your commit, test is passed. But i have a question, when or under what case should we output comment node? At most of the time, comment node doesn't make sense in the XML document, we don't care about it.

@zhengchun

zhengchun commented Dec 23, 2018 •

Copy link
Copy Markdown
Contributor

belowing document output is incorrect.

<?xml version="1.0" encoding="UTF-8"?>
	<!-- comment here-->
    <AAA> 
        <BBB> 
            <DDD> 
                <CCC> 
					<DDD/> 
					<!-- DDD -->
					<!-- DDD -->
					<!-- DDD -->
					<EEE/> 
				</CCC> 
				<!-- CCC -->
				<!-- CCC -->
            </DDD> 
		</BBB> 
		<!-- CCC -->
		<!-- CCC -->
        <CCC> 
			<DDD> 
			<!-- EEE -->
			<!-- EEE -->
			<!-- EEE -->
			<!-- EEE -->
                <EEE> 
					<DDD> 
					<!-- FFF -->
                        <FFF/> 
					</DDD> 
					<!-- FFF -->
					<!-- FFF -->
					<!-- FFF -->
                </EEE> 
            </DDD> 
        </CCC> 		
     </AAA>

should add following code to confirm its level.

for i := prev.level - level; i > 1; i-- {
	prev = prev.Parent
}
addSibling(prev.Parent, node)

@yitype

yitype commented Dec 23, 2018

Copy link
Copy Markdown
Contributor Author

Thanks for your advice, In my api proxy case, I parse xml-rpc, record some raw xml node value, then convert to other type. The OutputXML() should distinguish between text and comment. comment should been ignored, not as text.

@zhengchun
zhengchun merged commit e31a81f into antchfx:master Dec 23, 2018
zhengchun added a commit that referenced this pull request Dec 23, 2018
zhengchun added a commit that referenced this pull request Dec 23, 2018
zhengchun added a commit that referenced this pull request Dec 23, 2018
@zhengchun

Copy link
Copy Markdown
Contributor

Thanks, merged.

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

⌂ 换网址